Commit graph

115 commits

Author SHA1 Message Date
Jan Mulder
5a235aea12 minimal pO2 threshold: color the p02 graph also for minumum
Color the p02 graph also in red for going under the minumum p02 value as
set in the Preferences.

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-03-28 11:17:03 -07:00
Jan Mulder
bb31c77597 minimal pO2 threshold: split max threshold into min and max
Nothing really special here. Just a split of the only p02 max threshold into
a min threshold and max threshold, and the adaptation of the UI. Change of
translatable strings included.

ref: https://github.com/Subsurface-divelog/subsurface/issues/259

Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-03-28 11:17:03 -07:00
Joakim Bygdell
bd0c99dfb7 MOBILE: Display pO2 and Setpoint for CCR dives
For CCR dives we want to display the setpoint and pO2 information,
due to the limited screensize we have to remove the temperature graph or
the view will be to cluttered.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-03-26 21:57:57 -07:00
Jeremie Guichard
597539ce39 Fix double to int truncation in C++ code
Wfloat-conversion enabled for C++ part of the code
Fix warnings raised by the flag using lrint

Original issue reported on the mailing list:
The ascent/descent rates are sometimes not what is expected.
E.g. setting the ascent rate to 10m/min results in an actual
ascent rate of 9m/min.
This is due to truncating the ascent rate preference,
then effectively rounding up the time to reach each stop to 2s intervals.
The result being that setting the ascent rate to 10m/min
results in 20s to ascend 3m (9m/min), when it should be exactly 18s.

Reported-by: John Smith <noseygit@hotmail.com>
Reported-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-24 09:39:25 -07:00
Dirk Hohndel
08284275e7 Merge branch 'master' of https://github.com/dje29/subsurface 2017-03-11 08:41:41 -08:00
Martin Měřinský
95d5771513 We use 'setpoint' in UI. Use it also for documentation and comments. No semantic change. 2017-03-11 08:09:07 -08:00
Martin Měřinský
dcf2542215 Use abbreviations with dots. 2017-03-11 08:09:07 -08:00
Robert C. Helling
eae4bd82a5 Change type of divedatepoint.depth to depth_t
... for consistency, while we are at it.

There are still some internal depth variables which are ints
somebody might take a go at those.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-03-11 08:03:25 -08:00
Jeremie Guichard
406e4287eb Change calls to rint into lrint avoiding conversion warnings
Using gcc option "-Wfloat-conversion" is useful to catch
potential conversion errors (where lrint should be used).
rint returns double and still raises the same warning,
this is why this change updates all rint calls to lrint.
In few places, where input type is a float, corresponding
lrinf is used.

Signed-off-by: Jeremie Guichard <djebrest@gmail.com>
2017-03-08 14:04:17 +07:00
Martin Měřinský
b14301a84c heartrate, heartbeat > heart rate 2017-03-04 12:08:17 -08:00
Martin Měřinský
59d18a00db divecomputer > dive computer 2017-03-04 12:08:17 -08:00
Stefan Fuchs
7eda24d6b1 Correct "set-point" -> "setpoint" and window title setpoint change
Change 2x "set-point" to "setpoint".
Correct window title for "Add setpoint change" window.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-03-04 12:04:20 -08:00
Stefan Fuchs
508387b1e1 Add units and nicer formating for items in profile info box
"SP change" info format in info box: Added/changed formating and add "bar" unit.
"waypoint above ceiling" event in info box: Added formating, depth conversation to ft/m and depth unit.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-02-21 13:11:19 -08:00
Stefan Fuchs
b39b641a05 Translate names of additional dive events and nicer format info box text
Enable translation for a few additional internal dive events.
Ensure that all event names in datatrak.c are collected for translation.
Ensure that for gaschange in profile info box the "cyl." string is also translated.

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-02-21 13:11:19 -08:00
Joakim Bygdell
12c33a038f Mobile: Do not show tankbar for CCR dives
If we are showing the setpoint and sensor pO2 we need the space.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-05 12:20:33 -08:00
Joakim Bygdell
11ccadbab5 MOBILE: Reposition objects in the profile
Add the tankbar to the profile and change the relative positions of the depth
and temperature curves to minimize overlap.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-05 11:59:47 -08:00
Robert C. Helling
2516ae7e5f Let cylinderid = -1 mean same gas as before
It's not too clever to give 0 a special meaning (as here:
use same gas as for previous leg) when 0 is a legitimate
value.

This should solve Willem's gas disappearance problem when
reediting a dive in the planner.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-02-04 07:09:35 -08:00
Dirk Hohndel
f5a4838519 Fix dive visual editor being too quick to rescale time
When moving the last handle of a dive (in the planner, in dive add, or
when editing a dive), we rescaled the time axis whenever our idea of the
maximum duration that we should show changed. That lead to the odd
situation that you couldn't get to certain dive durations with the
visual editor (e.g. 64 minutes) because just as you approach that time
the scale changes and the dive duration jumps past the desired value.

Fixes issue #174

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-01-28 21:04:50 -08:00
Joakim Bygdell
dd2791fa1e Fix tankbar offset at gas switch event
When painting the tankbar the function triggers on change in cylinder index,
as a result the new gascolour are changed at the next sample time point.
On a divecomputer with a reasonable fast sample rate the 2-3s offset are hardly
noticable, especially on a longer dive.
For divecomputers with slow sample rate the 10-30s offset are clearly visible.

This is fixed by start painting the new gascolour at the time point of the switch event rather than the time point of the next sample.

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-01-21 06:07:31 -08:00
Joakim Bygdell
f7cecf506f Don't let the tankbar overlap the tissue heatmap
Shift the position of the tankbar to prevent it from overlapping the tissue heatmap

Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-01-21 06:07:31 -08:00
Robert C. Helling
fedadc65db Prevent the heatmap form overlapping at the ends
...by making the pen start at its first position rather
than first position minus half width.

Sorry for my first attempt to solve this in a totally
differen (read: wrong) way.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-15 11:37:26 -08:00
Robert C. Helling
bb4bf639c3 Fix deco_mode confusion
We have two prefernces determining the deco_mode (BUEHLMANN vs VPMB
vs RECREATIONAL): One for the planner (deco_mode) and one for
displaying dives (display_deco_mode). The former is set in the planner
settings while the latter is set in the preferences.

This patch clears up a confusion which of the two to use by introducing
a helper function that selects the correct variable.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-01-06 20:43:23 -08:00
Tomaz Canabrava
37e3e7e69a Deco mode for plannining is not deco mode for showing
We had (in the wrong place, imo) a new feature that
should differentiate the different deco_modes, you could
plan your dive in buelhman and see it in vpm-b, for instance
but both of them accessed the same pref.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:41:17 -07:00
Tomaz Canabrava
c110b4a238 More preference handling fixes
Remove a few uneeded lines and add more loading code for
the preferences.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:40:43 -07:00
Tomaz Canabrava
27d1385c65 Use the new preferences object to set the preferences
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-11-01 09:40:06 -07:00
Rick Walsh
a2d6bcf23f ToolTipItem: only show gf line in pressure graph when using Buhlmann model
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-27 20:36:08 -07:00
Rick Walsh
d689390140 Heatmap: Show more yellow
Stretch out the yellow zone of the HSV scale, because the yellow band of the
true scale appears narrow.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-20 21:14:27 -07:00
Rick Walsh
fd46167ae0 Heatmap: Color undersaturated values relative to inert gas pressure
Color "undersaturated" values relative to inert gas pressure of gas being
breathed, rather than relative to inert gas pressure of air.
Also change slightly the point at which bright green (hue = 120 deg) from 10%
of M value to 0% of M value (=ambient pressure).
Other than the slight shift in lower bound of the green-red scale, this does
not affect the colors of the tissues with inert gas pressure greater than
ambient pressure, which are relative to the Buhlmann M value.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-20 21:14:19 -07:00
Rick Walsh
a67d3f0e30 Heatmap: Draw lines between data points rather than big dots
By drawing oversize dots for each data point, dots were overlapping such that
the change in tissue presssure wasn't displayed at the right time - typically
out by 1-2 minutes, depending on dive duration.

Drawing a line between discrete points, the data points don't overlap and
change in tissue pressure is displayed at the right time.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-20 21:11:15 -07:00
Robert C. Helling
87ced29e09 Initialize tooltip tissue pixmap properly
...otherwise we show garbage before the mouse enters the
profile for the first time.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-03 07:58:43 -07:00
Dirk Hohndel
c907efb22e Correctly hook up visibility toggle for tissue heat map
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24 12:50:19 -07:00
Dirk Hohndel
0296a456b2 Hook up the code to toggle DC reported ceiling visibility
This got broken a long time ago it seems and no one ever noticed.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24 12:38:24 -07:00
Rick Walsh
7e09a6c7bc Separate VPM-B conservatism preference for planner and profile
Separate the VPM-B conservatism preference into diveplan.vpmb_conservatism for
planning dives and prefs.vpmb_conservatism for profile ceiling display of
saved dives.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24 08:30:11 -07:00
Rick Walsh
7b891904e7 Rename conservatism_level to vpmb_conservatism
Make the variable purpose less ambiguous

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24 08:29:56 -07:00
Robert C. Helling
1b57b6cc17 Separate method for heatmap color scaling
I separated out the color scaling and slightly simplified the expressions.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-17 13:42:46 -07:00
Rick Walsh
1cae1255d7 Allow heat map to zoom
Setting the pen to non-cosmetic means the painted width scales when zoomed

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-17 13:42:33 -07:00
Rick Walsh
ddc7f3dc98 Adjust heat map colour scale
Make the heat map use a colour scale similar to that by Kevin Watt, as used in
Simon Mitchell's presentation, Decompression Controversies
https://www.youtube.com/watch?v=UY61E49lyos&t=2090&authuser=0

Undersaturated: cyan -> blue ->purple -> black
Supersaturated up to M value: black -> yellow -> red
Exceeding M value: red -> white

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-17 13:42:08 -07:00
Robert C. Helling
893bea700c Introduce heat map
This replaces the tissue percentage graph that probably nobody ever
understood with a heat map like the one used in the discussion
of bubble model deco. The information shown is the same but the
saturation is now in the color while the tissue determines the y
position.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-17 13:39:54 -07:00
Dirk Hohndel
8c2668a6b1 Event name heuristics to show better event icons
This matches the strings for a couple of generic events from
libdivecomputer that should obviously info or violation events, and
matches quite a few more from the Uemis downloader (as those are much more
specific).

Everything else is still shown as a yellow warning triangle.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-24 09:53:24 +09:00
Dirk Hohndel
70e1938aa7 Avoid compile time warning
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-24 09:53:24 +09:00
Dirk Hohndel
c1f9cfe9a8 Show different icons based on event severity
So far this is only supported in the Suunto EON Steel backend, but we
should try to add this to others where we have such a distinction (and
maybe assign different values to the predefined libdivecomputer events).

This also adds three new icons for info, warning, and violation. The
warning icon we had already, but I drew a new one from scratch to have it
match the violation icon.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-24 09:53:24 +09:00
Linus Torvalds
f718fdab80 Event flags should be checked as bits, not values
This becomes obvious with the new severity bits introduced in the Suunto
EON Steel parser.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-23 16:01:26 +09:00
Dirk Hohndel
aa404b3469 Undefine both macros
There really is not need to do this, but at least do it symmetrically.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-22 09:00:35 +09:00
Rick Walsh
b1ed04a7f4 Have divedatapoint store cylinder id instead of gasmix
Determining the correct cylinder index from a known gas mix can be
complicated, but it is trivial to look up the gasmix from the cylinder_t
structure.

It makes sense to remember which cylinder is being used. This simplifies
handling changing a cylinder's gas mix, either directly by the user, or
indirectly in the planner. It also permits tracking of multiple cylinders of
the same mix, e.g. independent twins / sidemount.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-09 12:07:25 -07:00
Dirk Hohndel
9aa7399c1d Now that we are building with C++11 we need override keyword
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-06-23 16:43:05 -07:00
Linus Torvalds
36a3f649c5 Don't show surface events at the beginning or end of the dive
That's just annoying and pointless.  So we arbitrarily say that surface
events within the first and last 30s of the dive are suppressed.

But we now do show them in the middle, in case the sampling rate is too
low, and the profile itself doesn't show that we got to the surface.

These heuristics still needs tweaking - if the profile already shows
that we're at the surface, then we should probably suppress the event
triangle.

But in the meantime this at least gets rid of the truly pointless cases.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-06-01 13:08:45 -07:00
Dirk Hohndel
eb07faef00 Only do 9 minute interval for min/max/avg
We don't use 3 and 6 minute values anywhere, so why calculate them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-20 15:55:51 -07:00
Linus Torvalds
e0ac1c9a26 Fix 3-, 6- and 9-minute min/max calculations
Make them use indices into the plot-info, fix calculation of average
depth, and fix and add comments.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-20 15:36:25 -07:00
Dirk Hohndel
176b92776b Silence warning
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-14 09:19:01 -07:00
Linus Torvalds
eff4059802 Start using the actual cylinder data for gas switch events
Now that gas switch events always have indices into the cylinder table,
start using that to look up the gas mix from the cylinders rather than
from the gas switch event itself.  In other words, the cylinder index is
now the primary data for gas switch events.

This means that now as you change the cylinder information, the gas
switch events will automatically update to reflect those changes.

Note that on loading data from the outside (either from a xml file, from
a git/cloud account, or from a dive computer), we may or may not
initially have an index for the gas change event.  The external data may
be from an older version of subsurface, or it may be from a
libdivecomputer download that just doesn't give index data at all.

In that case, we will do:

 - if there is no index, but there is explicit gas mix information, we
   will look up the index based on that gas mix, picking the cylinder
   that has the closest mix.

 - if there isn't even explicit gas mix data, so we only have the event
   value from libdivecomputer, we will turn that value into a gasmix,
   and use that to look up the cylinder index as above.

 - if no valid cylinder information is available at all, gas switch
   events will just be dropped.

When saving the data, we now always save the cylinder index, and the gas
mix associated with that cylinder (that gas mix will be ignored on load,
since the index is the primary, but it makes the event much easier to
read).

It is worth noting we do not modify the libdivecomputer value, even if
the gasmix has changed, so that remains as a record of the original
download.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-04-04 22:37:18 -07:00