This introduces a state check to only continue to try to read/write from
the bluetooth device while its in a sane state.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds a read timeout to the qt serial bluetooth code. This is needed
for error handling and error recovery purposes.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch changes the dive merging to be much more careful about
things, because it turns out that we had several small oddities that
caused big merge issues.
The oddities are:
- the dive "duration" is actually how long we spend under water.
But that means that when we do "dive->when + dive.duration.seconds"
to calculate the end of the dive, that is nonsensical if you came up
to the surface in the middle of a dive.
Now, normally you don't see profiles like that, but once you start
merging dives together, it can go from "small detail" to "dominant
factor".
- We have two different cases of merging: the automatic "merge new dive
computer download if it looks like the same dive" (which always has a
merge offset of 0, since we merge it as a new dive computer) and the
"merge two different dives into one longer dive.
The code assumed that it could look at the "downloaded" flag for the
dive to check one or the other, but that doesn't really work.
Reading a dive from an XML file isn't any different from downloading
it.
So we need to change the logic to determine what kind of merge it is
to actually check the passed-in time offset.
With this, Stuart Vernon's test-case of eight dives with short surface
intervals in between end up merging correctly into one dive.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Reported-by: Stuart Vernon <stuartv@force2.net>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If variables were accidentally carried through from a previous calculated plan,
subsequent plan could be affected. This test aims to detect if this happens.
Commit 8994270 corrected such a bug. If it were reverted, this test would fail
(as it should).
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This patch adds the option to retrive Marble with pkg-config in a
similar way to Grantlee, libgit2, etc.
It reorganizes the "if(NO_MARBLE)" case to be the "else()" of
if(NOT NO_MARBLE).
Also, it adds the "-r" option to "rm" here:
add_custom_target(link_marble_data ALL COMMAND rm -rf ./marbledata ...
as otherwise it fails on Win32/Msys with "marbledata is a directory".
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instructions how to use it are in the script.
As of today this doesn't create working binaries - this worked perfectly
fine back when MXE was still based on Qt5.4
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It seems this has never worked and nobody ever tested it. There was some
confusion with time zones since Qt takes by default local time when
converting from/to epoch while the exif library used UTC.
For my single test dive, this works now. But this needs more testing!!!
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
From DiveList section to printing section
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This was originally triggered by an odd merge of two dives that should
have been the same, but that showed a corner case where the plot entry
creation could create broken results that violated our assumptions about
time stamps being monotonous.
When setting up the plot entries we create surface entries at the
beginning and end. We then fill in the plot entries between them based on
the samples from the dive computer plus our own interpolation (so we have
one entry at least every ten seconds). The loop ends when we are out of
space - which in this instance caused us to exit before updating the
maxtime and therefore the final plot entries having time stamps that were
smaller than the last entry filled in by the inner loop.
This patch makes sure we have enough space in the plot entry structure and
moves the exit from the inner loop until after we have updated the
maxtime.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I'm not quite sure why this works, but it appears to do the trick.
Apparently you are supposed not to have the meta type declaration in a
shared header file. Also, with Qt5.5 you can't have the declaration for
QBluetoothDeviceInfo, not even on Windows.
This may need more tweaking to make sure it works on all combinations of
OS and Qt version.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If a user gets stuck accessing cloud storage it's often hard to figure out
which step is hanging which makes it much harder to narrow down the
problem. With this patch calling Subsurface with '-v' will give somewhat
finely grained progress information on stderr.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If Subsurface is started with the verbose flag, also give progress
information on the consol (just in case there are issues with the progress
dialog).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Passing the cloud URL to the file select box leaves "git syntax" in the
filename which makes us look for a directory with a git repository in it
and give non-sensical error messages to the user.
With this we simply use the users email address as local filename with a
.ssrf suffix.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We do not want to remember max_bottom_ceiling_pressure from the previous planned
dive - it makes the Boyle's law compensation incorrect if the previous planned
dive was a deeper deep-to-shallow multi-level dive.
E.g. Plan these dives (without applying this patch) with VPM-B nominal
conservatism:
Plan 30 m for 20 min (total run time = 28 min)
Now plan 100 m for 20 min, followed by 70 m @ 23 min and 70 m at 30 min
Re-plan 30 m for 20 min (total run time = 50 min)
With this change, the re-planned dive run time is 28 min, as it should be.
We probably don't have to reset first_ceiling_pressure too, but it's cleaner if
we do.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't do this expensive calculation when not needed.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The data are supposed to be sorted with monotonous time stamp. And while
the actual bug that causes this needs to be identified and fixed, this is
at least a stop gap measure that shows the issue and prevents Subsurface
from hanging.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The logic to pick the initial dive ID for the uemis downloader was very
confused, and did not work at all when restarting a download when the
Uemis filled up, and the "Force download all dives" flag was set. It
also required a rather odd Uemis-specific callback from the download UI
because of how it picked the initial ID.
This changes the logic to just look at the list of downloaded dives when
restarting, which simplifies the logic a lot, gets rid of the odd
special callback, and also means that the whole "Force download" issue
just goes away. It seems to work now.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Uemis downloader blindly just did a strstr on 'nds->name', even if
there wasn't necessarily a dive location at all.
Add the proper NULL pointer checks.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On some Windows platforms when we convert a Bth address to a String
it is formatted as "(XX:XX:XX:XX:XX:XX)". Therefore we first try to
remove the round parentheses and finally we truncate the string
to 17 because there are 6 two-digit hex values and 5 colons.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Don't overwrite existing data.
[Dirk Hohndel: rewrote this a litte, but the logic is the same]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Changing the logic to check if a divespot was already read in
this round of reading in dives.
Signed-off-by: Guido Lerch <glerch@Guidos-MacBook-Air.local>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I hate this patch. But it makes no sense to expose users to git level
error messages. So this is trying to make things much easier (and,
frankly, less informative) if we are accessing the Subsurface cloud.
The way this is implemented is really ugly; it tries to avoid frequent
repetition of the same strings by using different exit points for the
functions in question. I'm not convinced this was the best way to do it
but it's what I have.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Spell Setpoint without space in user visable strings.
Explain authorized_paired.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Up to now, we only computed hashes of images upon actually displaying the images.
With this patch we start to compute hashes once we load the xml or from git. This
happens in the background, so the user should note an increased CPU load only once
per divelog.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Implemented suggestion from Dirk on how to deal with dive details
not being found.
Also cleaned up some unused variables, got rid of the last_log_file_nr
because it's not needed anymore.
One thing in question I still need to check is whether we really need to
decrease the dive_to_read if we find deleted dive details, this is still
in but I dont think it's really needed.
Signed-off-by: glerch <guido.lerch@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Now inplace edit is supported, so enable editing the "Default"
statistics template, Also show warning when editing this template.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>