aboutsummaryrefslogtreecommitdiffstats
path: root/profile-widget
AgeCommit message (Collapse)Author
2017-07-27Profile support for multiple concurrent pressure sensorsGravatar Linus Torvalds
This finally handles multiple cylinder pressures, both overlapping and consecutive, and it seems to work on the nasty cases I've thrown at it. Want to just track five different cylinders all at once, without any pesky gas switch events? Sure, you can do that. It will show five different gas pressures for your five cylinders, and they will go down as you breathe down the cylinders. I obviously don't have any real data for that case, but I do have a test file with five actual cylinders that all have samples over the whole course of the dive. The end result looks messy as hell, but what did you expect? HOWEVER. The only way to do this sanely was - actually make the "struct plot_info" have all the cylinder pressures (so no "sensor index and pressure" - every cylinder has a pressure for every plot info entry) This obviously makes the plot_info much bigger. We used to have MAX_CYLINDERS be a fairly generous 8, which seems sane. The planning code made that 8 be 20. That seems questionable. But whatever. The good news is that the plot-info should hopefully get freed, and only be allocated one dive at a time, so the fact that it is big and nasty shouldn't be a scaling issue, though. - the "populate_pressure_information()" function had to be rewritten quite a bit. The good news is that it's actually simpler now, although I would not go so far as to really call it simple. It's still complicated and suble, but now it explicitly just does one cylinder at a time. It *used* to have this insanely complicated "keep track of the pressure ranges for every cylinder at once". I just couldn't stand that model and keep my sanity, so it now just tracks one cylinder at a time, and doesn't have an array of live data, instead the caller will just call it for each cylinder. - get rid of some of our hackier stuff, like the code that populates the plot_info data code with the currently selected cylinder number, and clears out any other pressures. That obviously does *not* work when you may not have a single primary cylinder any more. Now, the above sounds like all good things. Yeah, it mostly is. BUT. There's a few big downsides from the above: - there's no sane way to do this as a series of small changes. The change to make the plot_info take an array of cylinder pressures rather than the sensor+pressure model really isn't amenable to "fix up one use at a time". When you switch over to the new data structure model, you have to switch over to the new way of populating the pressure ranges. The two just go hand in hand. - Some of our code *depended* on the "sensor+pressure" model. I fixed all the ones I could sanely fix. There was one particular case that I just couldn't sanely fix, and I didn't care enough about it to do something insane. So the only _known_ breakage is the "TankItem" profile widget. That's the bar at the bottom of the profile that shows which cylinder is in use right now. You'd think that would be trivial to fix up, and yes it would be - I could just use the regular model of firstcyl = explicit_first_cylinder(dive, dc) .. then iterate over the gas change events to see the others .. but the problem with the "TankItem" widget is that it does its own model, and it has thrown away the dive and the dive computer information. It just doesn't even know. It only knows what cylinders there are, and the plot_info. And it just used to look at the sensor number in the plot_info, and be done with that. That number no longer exists. - I have tested it, and I think the code is better, but hey, it's a fairly large patch to some of the more complex code in our code base. That "interpolate missing pressure fields" code really isn't pretty. It may be prettier, but.. Anyway, without further ado, here's the patch. No sign-off yet, because I do think people should look and comment. But I think the patch is fine, and I'll fix anythign that anybody can find, *except* for that TankItem thing that I will refuse to touch. That class is ugly. It needs to have access to the actual dive. Note how it actually does remove more lines than it adds, and that's despite added comments etc. The code really is simpler, but there may be cases in there that need more work. Known missing pieces that don't currently take advantage of concurrent cylinder pressure data: - the momentary SAC rate coloring for dives will need more work - dive merging (but we expect to generally normally not merge dive computers, which is the main source of sensor data) - actually taking advantage of different sensor data from different dive computers But most of all: Testing. Lots and lots of testing to find all the corner cases. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-22Show multiple gas pressures in the profile even if the dive isn't CCRGravatar Linus Torvalds
Now that the cylinder pressures are more generalized, we should show them even for non-CCR dives if we have them. The most notable example would be having separate pressure transmitters for both cylinders in a sidemount setup. The code no longer really depends on any CCR logic. NOTE! This is still preparatory work, in that this is one part of supporting multiple simulataneous cylinder pressures, but we are still lacking in other departments (eg properly filling those fields in when a dive computer exports multiple pressure sensors etc). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-21Start cleaning up sensor indexing for multiple sensorsGravatar Linus Torvalds
This is a very timid start at making us actually use multiple sensors without the magical special case for just CCR oxygen tracking. It mainly does: - turn the "sample->sensor" index into an array of two indexes, to match the pressures themselves. - get rid of dive->{oxygen_cylinder_index,diluent_cylinder_index}, since a CCR dive should now simply set the sample->sensor[] indices correctly instead. - in a couple of places, start actually looping over the sensors rather than special-case the O2 case (although often the small "loops" are just unrolled, since it's just two cases. but in many cases we still end up only covering the zero sensor case, because the CCR O2 sensor code coverage was fairly limited. It's entirely possible (even likely) that this migth break some existing case: it tries to be a fairly direct ("stupid") translation of the old code, but unlike the preparatory patch this does actually does change some semantics. For example, right now the git loader code assumes that if the git save data contains a o2pressure entry, it just hardcodes the O2 sensor index to 1. In fact, one issue is going to simply be that our file formats do not have that multiple sensor format, but instead had very clearly encoded things as being the CCR O2 pressure sensor. But this is hopefully close to usable, and I will need feedback (and maybe test cases) from people who have existing CCR dives with pressure data. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-22Translate the strings "planned dive" and "manually added dive" in the profileGravatar Stefan Fuchs
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-06-16code cleanup: remove unimplemented classes and structsGravatar Jan Mulder
Remove forward declared but not implemented classes and structs. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-05-26Display gas density instead of SAC in plannerGravatar Robert C. Helling
In the planner, the SAC is prescribed, so there is little use in plotting it (as the color of the cylinder pressure line). Rather use the color to show the density of breathing gas. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-05-26Fix right boundary when moving last handle in plannerGravatar Robert C. Helling
There was a bug in the old code due to confusion between minutes and seconds as the unit of the time axis. But rather than limiting the time for the last handle in terms of the time axis (which potentially includes long deco and allowing that for bottom time quickly leads to dives many many hours long) limit it to 150% of the previous bottom time. Signed-off-by: Robert C. Helling <helling@atdotde.de>
2017-04-29Add SPDX header to profile widgetsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-03-28minimal pO2 threshold: color the p02 graph also for minumumGravatar Jan Mulder
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-28minimal pO2 threshold: split max threshold into min and maxGravatar Jan Mulder
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-26MOBILE: Display pO2 and Setpoint for CCR divesGravatar Joakim Bygdell
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-24Fix double to int truncation in C++ codeGravatar Jeremie Guichard
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-11Merge branch 'master' of https://github.com/dje29/subsurfaceGravatar Dirk Hohndel
2017-03-11We use 'setpoint' in UI. Use it also for documentation and comments. No ↵Gravatar Martin Měřinský
semantic change.
2017-03-11Use abbreviations with dots.Gravatar Martin Měřinský
2017-03-11Change type of divedatepoint.depth to depth_tGravatar Robert C. Helling
... 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-08Change calls to rint into lrint avoiding conversion warningsGravatar Jeremie Guichard
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-04heartrate, heartbeat > heart rateGravatar Martin Měřinský
2017-03-04divecomputer > dive computerGravatar Martin Měřinský
2017-03-04Correct "set-point" -> "setpoint" and window title setpoint changeGravatar Stefan Fuchs
Change 2x "set-point" to "setpoint". Correct window title for "Add setpoint change" window. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
2017-02-21Add units and nicer formating for items in profile info boxGravatar Stefan Fuchs
"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-21Translate names of additional dive events and nicer format info box textGravatar Stefan Fuchs
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-05Mobile: Do not show tankbar for CCR divesGravatar Joakim Bygdell
If we are showing the setpoint and sensor pO2 we need the space. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
2017-02-05MOBILE: Reposition objects in the profileGravatar Joakim Bygdell
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-04Let cylinderid = -1 mean same gas as beforeGravatar Robert C. Helling
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-01-28Fix dive visual editor being too quick to rescale timeGravatar Dirk Hohndel
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-21Fix tankbar offset at gas switch eventGravatar Joakim Bygdell
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-21Don't let the tankbar overlap the tissue heatmapGravatar Joakim Bygdell
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-15Prevent the heatmap form overlapping at the endsv4.6.0Gravatar Robert C. Helling
...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-06Fix deco_mode confusionGravatar Robert C. Helling
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>
2016-11-01Deco mode for plannining is not deco mode for showingGravatar Tomaz Canabrava
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-01More preference handling fixesGravatar Tomaz Canabrava
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-01Use the new preferences object to set the preferencesGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-27ToolTipItem: only show gf line in pressure graph when using Buhlmann modelGravatar Rick Walsh
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-10-20Heatmap: Show more yellowGravatar Rick Walsh
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-20Heatmap: Color undersaturated values relative to inert gas pressureGravatar Rick Walsh
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-20Heatmap: Draw lines between data points rather than big dotsGravatar Rick Walsh
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-03Initialize tooltip tissue pixmap properlyGravatar Robert C. Helling
...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-09-24Correctly hook up visibility toggle for tissue heat mapGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24Hook up the code to toggle DC reported ceiling visibilityGravatar Dirk Hohndel
This got broken a long time ago it seems and no one ever noticed. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-24Separate VPM-B conservatism preference for planner and profileGravatar Rick Walsh
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-24Rename conservatism_level to vpmb_conservatismGravatar Rick Walsh
Make the variable purpose less ambiguous Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-09-17Separate method for heatmap color scalingGravatar Robert C. Helling
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-17Allow heat map to zoomGravatar Rick Walsh
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-17Adjust heat map colour scaleGravatar Rick Walsh
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-17Introduce heat mapGravatar Robert C. Helling
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-07-24Event name heuristics to show better event iconsGravatar Dirk Hohndel
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-24Avoid compile time warningGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-07-24Show different icons based on event severityGravatar Dirk Hohndel
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-23Event flags should be checked as bits, not valuesGravatar Linus Torvalds
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>