... and not just for Buehlmann. This makes the saturation
graphs meaningful for VPM-B.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Change runtime table string from ZHL-16B to ZHL-16C to reflect he fact
that we use 5min as half-time for the fastest compartment rather than
4min.
Further more trade pow(2.0, ...) for exp().
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This removes 'fixup_dc_cylinder_index()', which was added to fix up the
pressure sensor indexes from the Atomic Cobalt dive computer.
Even for the Cobalt it really shouldn't matter, because the
libdivecomputer backend for the Cobalt actually tries to do the right
thing. See for example commit 8853a1ccd422 ("Associate the pressure
samples with the primary tank.") in libdivecomputer.
Some historical digging shows that the subsurface sample pressure index
code came in from commit e32ba4d6d8 ("Improve tank handling for
Cobalt"), dated Tue Oct 28 13:48:15 2014.
And the libdivecomputer "use the right cylinder" code was around the
same time (Fri Oct 10 20:29:17 2014 +0200).
So I suspect that subsurface needed the fixup based on an older version
of libdivecomputer. Jef's patch is a couple of weeks before, but we may
not have tracked libdivecomputer religiously.
The reason to remove this code is because it can (and does) mess up the
sensor index when it is actually reliable, like in the multi-sensor case
of the Suunto EON Steel.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This adds the option to select a cylinder when adding or editing a dive.
Due to limited screen size we restrict the editing to the first cylinder only.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
With the recent setting cleanup, gradient factors were set to bool, so were
saved as 1/1, rather than say 50/80. This commit fixes that.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
No, they don't make sense. We should normally not have multiple samples
that are on the same second. But they seem to happen on the EON Steel
under some circumstances, and instead of dividing by zero when trying to
interpolate across such a sample, do something sane.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We used to clear the 'dc_tank_t' for each dive, but then only clear the
volume field in between each cylinder. That means that if the
libdivecomputer back-end does not touch a field, it might contain the
stale value from the previous tank information.
I'm not sure this is actually much of an issue, since I'd expect
back-ends do seem to initialize the fields fully (at least the EON Steel
back-end does). But it's inconsistent.
Also, the code was actually buggy because of the odd indentation: it
would only ask for new tank information up to 'ntanks' tanks, but
because of the final fixup that was done outside of the conditional, it
would actually update the cylinder begin/end pressure data *beyond*
'ntanks', and just re-use the last libdivecomputer data for the rest of
the cylinders.
Again, in practice, that probably never really happened, but it is a
real bug.
The fixed-up code actually looks better too, imho, and is one line
shorter because of the initialization now being done in one place rather
than two.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In subsurface, we only have one cylinder pressure per sample (well,
technically two: we have a separate o2 pressure for rebreather diving).
Which makes things "interesting" if the dive computer can actually have
multiple pressure sensors, and can report them all concurrently. Like
the Suunto EON Steel.
We used to just take the last one (each sensor reading would just
overwrite any previous ones), and this quick hack just changes the logic
to prefer the "current" cylinder instead.
It's wrong, and it's stupid, but it's the best we can do without major
surgery.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There's one function named uiLanguage() that should return
the current uiLanguage() that subsurface is running, but
it actually sets a whole lot of preferences, I think
that the general idea of that function is okay, but it seems
broken for me.
still, I used it to load the correct language from the preferences
since it's what this function is currently doing right now.
Also, a lot of missing groups where added.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Only set the settings if it actually changes, when the user
clicked on the save button on the preferences, the code would
run in every dialog saving each preferences on disk, but this
is uneeded if the value didn't changed.
Also, while doing that, I found a couple of places where I
used the wrong field, which are now fixed.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
In commit b76c1846bb ("Settings update: Simplify Update Manager")
the logic for when to show the UpdateManger question to the user got
broken. Unintuitively, a boolean setting actually has three possible
values. True, False, and Unset. This patch fixes things to work as
designed again.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Move Preferences sync / initialization out of the planner
widget prerferences to the ObjectWrapper.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
For some reason, the dive computer settings weren't in the
settings prefs. This moves it, makes the boilerplate on Settings
ObjectWrapper and make things compile.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
So, prefs.save_userid_local is being set outside of
a preferences set (it's set to true and false while
loading the files via xml or git) and because of that
I had to bypass a few method calls.
When something triggers a preferences change, the
application will be notified that the preferences
changed, thing that I couldn't do while reading the
xml or git because that should be local-only.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We have the serial number and firmware version fields in "struct
divecomputer", but we don't actually fill them in when loading the data
from git or xml, because we save all that information in the separate
device table instead.
But in order to always have the serial number associated with a device,
let's make sure to fill those fields in. It won't hurt, and this way we
have the information available whether we just loaded the dive from a
file, or imported it from the dive computer. One less semantic
difference to worry about.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The authentication count was a static counter in the authentication
callback, which gets incremented until we consider the authentication to
have failed.
The problem with that is that it doesn't get incremented for just _one_
authentication operation, it gets incremented each time you try to load
or save, so eventually the code considers authentication to have failed
even if nothing ever went wrong.
This fixes it by making it static to the whole git-access file, and have
each operation clear it before starting a new remote access.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Having only the last 2 digits of the year is somewhat confusing as one
can easily think that to be the day. Thus it is more clear to use full
year for the trip header.
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Windows Server 2008 seems to be missing the heavy dash in Courier New.
This replaces the symbol by an ordinary dash.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Subsurface uses "local time" which in particular means we never
display time zone information to the user. The user (and our file
format) only sees times like 5pm or 17:00. A better name than
local time (which could mean "local at the dive spot) would
be "watch time", the time displayed by the diver's watch when
she entered the water.
Internally, we store times as time_t, seconds since Jan 1 1970 0:00
UTC. Our convention for conversion between 5pm and time_t as always
been to treat 5pm as if it were UTC.
Then confusion arose since Qt's QDateTime (which is tied to UI elements
like QTimeEdit and similar) is time zone aware and by default assumes
the system time zone. So when we set a QDateTime to 5pm and then later
convert it to time_t we have to take care about the difference between
UTC and the system time zone.
This patch unifies our solution to this problem: With it, we set all
QDateTime's time zone to UTC. This means we don't have to correct for
a time zone anymore when converting to time_t (note, however, the
signedness issue: Qt's idea of time_t is broken since it assumes it
to be unsigned thus not allowing for dates before 1970. Better use the
millisecont variants).
We only need to be careful about time zones when using the current time.
With this convention, when assigning the current time to a QDateTime, we
need to shift for the time zone since its value in UTC should actually be
the watch time of the user who is most likely used to the system time zone.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
to allow grantlee to access individual fields of the cylinder_t struct
rather than a string representation of the whole cylinder info using a
grantlee structure like this one:
<table class="table_class">
<tr>
<td>Cylinder</td>
<td>Start press.</td>
<td>End press.</td>
<td>Gas mix</td>
</tr>
{% for cylinderObject in dive.cylinderObjects %}
<tr>
<td>{{ cylinderObject.description }}</td>
<td>{{ cylinderObject.startPressure }}</td>
<td>{{ cylinderObject.endPressure }}</td>
<td>{{ cylinderObject.gasMix }}</td>
</tr>
{% endfor %}
</table>
Signed-off-by: Tim Wootton <tim@tee-jay.org.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When stuck in areas with really bad internet 5 seconds may not be enough,
but making the timeout longer in general seems the wrong way to go. So
keep the default 5 seconds but allow the user to override that with
subsurface --cloud-timeout=NN
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are a lot more places all over Subsurface where this needs to be
cleaned up. The converstion of the preferences system has been a complete
mess.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Commit b1ed04a means that DivePlannerPointsModel::rememberTanks() and related
functions and variables are no longer required
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This way they display correctly when accessed from grantlee template
Fixes#1085
Signed-off-by: Tim Wootton <tim@tee-jay.org.uk>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Instead of having fixed numbers and trying to translate them into
strings, a dive computer could just give us the string directly. Like
the new EON Steel backend does.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The cylinder use field was not merged when dives were merged. This is
normally not noticeable, since hopefully the cylinder use should be the
same anyway, but when re-downloading the dives from the EON Steel after
updating it to also get cylinder use data, the dive merging threw the
data away again since the original dive lacked it.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This uses the extended tank type information to fill in the cylinder use
(OC gas, CC Diluent or CC O2) from libdivecomputer when available.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The imperial and metric unit formats already had this, but the
personalized one missed the newline at the end.
It shouldn't really matter, since it's the last line of the file, but it
is not right.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
It makes no sense to keep trying. Maybe we need a UI to force it online
again, but for now this works much better when using cloud storage while
actually offline.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>