diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-10-28 13:48:15 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-10-28 14:04:19 -0700 |
commit | e32ba4d6d8115176e1ce0f4960926985b52164ca (patch) | |
tree | 8b45963724d70eaf69d2af61b81c27c836a1213e /qt-ui/profile/diveeventitem.cpp | |
parent | 874754e22b8678ab3d5314c56fda860ea844fc55 (diff) | |
download | subsurface-e32ba4d6d8115176e1ce0f4960926985b52164ca.tar.gz |
Improve tank handling for Cobalt
This isn't Cobalt specific, this is specific to dive computers that
indicate the first tank that's in use with a gaschange event that
coincides with the first sample.
We need to make sure that we suppress showing that gas change event
(regardless which cylinder it goes to) and instead set the correct
cylinder index from the very start of the dive.
This works with the test data I have and doesn't seem to break thing with
any of the files that I tried... but I'm worried that this is not the
right way to do things.
Fixes #742
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/diveeventitem.cpp')
-rw-r--r-- | qt-ui/profile/diveeventitem.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/qt-ui/profile/diveeventitem.cpp b/qt-ui/profile/diveeventitem.cpp index bd22c0db9..bd9735a96 100644 --- a/qt-ui/profile/diveeventitem.cpp +++ b/qt-ui/profile/diveeventitem.cpp @@ -127,16 +127,13 @@ bool DiveEventItem::shouldBeHidden() struct event *event = internalEvent; /* - * Gas change events - particularly at the beginning of a dive - are - * special. It's just the dive computer specifying the initial gas. - * - * Don't bother showing them if they match the first gas already + * Some gas change events are special. Some dive computers just tell us the initial gas this way. + * Don't bother showing those */ - if (!strcmp(event->name, "gaschange") && event->time.seconds <= 30) { - struct dive *dive = &displayed_dive; - if (dive && get_cylinder_index(dive, event) == 0) - return true; - } + struct sample *first_sample = &get_dive_dc(&displayed_dive, dc_number)->sample[0]; + if (!strcmp(event->name, "gaschange") && (event->time.seconds < 30 || event->time.seconds == first_sample->time.seconds)) + return true; + for (int i = 0; i < evn_used; i++) { if (!strcmp(event->name, ev_namelist[i].ev_name) && ev_namelist[i].plot_ev == false) return true; |