summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-05 09:28:58 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-05 09:32:13 -0700
commit3063991e4ed22932c3c66d3970d22f4f9a513bbf (patch)
treed65608d0fd795f59db1f5f4504c9f4e6e27ba13a /planner.c
parent8de1a736693e1fa4ff2cf79b284b44c3b2e1d639 (diff)
downloadsubsurface-3063991e4ed22932c3c66d3970d22f4f9a513bbf.tar.gz
Fix bug in handling of fake SAMPLE_EVENT_PO2 events
In commit bcdd6192fe45 ("Show translated event names in tooltip") I was too aggressive in replacing the checking for event names with checking for event types. It turns out that we are abusing an existing event type in the planner (and use a different event name to mark the difference). By just checking for the type this now caused incorrect information to be displayed in the info box (a simply "PO2 warning" on a Suunto D9 could turn into a "Bailing out to OC" notice). The correct fix is to get our own range of SAMPLE_EVENT_xxx numbers from libdivecomputer. Once we have those, we can do this the right way. For now we just fall back to also checking the event name (which is what I wanted to get away from so translated names don't trip us up). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/planner.c b/planner.c
index c56f04639..5c0bbecbc 100644
--- a/planner.c
+++ b/planner.c
@@ -264,6 +264,9 @@ struct dive *create_dive_from_plan(struct diveplan *diveplan)
/* Check for SetPoint change */
if (oldpo2 != po2) {
if (lasttime)
+ /* this is a bad idea - we should get a different SAMPLE_EVENT type
+ * reserved for this in libdivecomputer... overloading SMAPLE_EVENT_PO2
+ * with a different meaning will only cause confusion elsewhere in the code */
add_event(dc, lasttime, SAMPLE_EVENT_PO2, 0, po2, "SP change");
oldpo2 = po2;
}