summaryrefslogtreecommitdiffstats
path: root/uemis.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-30 18:11:01 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2012-12-30 18:17:21 -0800
commite3ab1c0701fceffa370d56bff187d0c0e90d5d21 (patch)
treea4c3dec2c1de47494f4ceec9e82b8f994c596455 /uemis.c
parent46b64d8e21bd770c908cc883f3627f4f08a2c0a7 (diff)
downloadsubsurface-e3ab1c0701fceffa370d56bff187d0c0e90d5d21.tar.gz
Update deco handling
This commit makes deco handling in Subsurface more compatible with the way libdivecomputer creates the data. Previously we assumed that having a stopdepth or stoptime and no ndl meant that we were in deco. But libdivecomputer supports many dive computers that provide the deco state of the diver but with no information about the next stop or the time needed there. In order to be able to model this in Subsurface this adds an in_deco flag to the samples. This is only stored to the XML file when it changes so it doesn't add much overhead but will allow us to display some deco information on dive computers like the Atomic Aquatics Cobalt or many of the Suuntos (among others). The commit also removes the old event based deco code that was commented out already. And fixes the code so that the deco / ndl information is stored for the very last sample as well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'uemis.c')
-rw-r--r--uemis.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/uemis.c b/uemis.c
index 8d05a99f9..ded060b44 100644
--- a/uemis.c
+++ b/uemis.c
@@ -254,17 +254,20 @@ static void uemis_event(struct dive *dive, struct divecomputer *dc, struct sampl
stopdepth = rel_mbar_to_depth(u_sample->hold_depth, dive);
if ((flags[3] & 1) | (flags[5] & 2)) {
/* deco */
+ sample->in_deco = TRUE;
sample->stopdepth.mm = stopdepth;
sample->stoptime.seconds = u_sample->hold_time *60;
sample->ndl.seconds = 0;
} else if (flags[0] & 128) {
/* safety stop - distinguished from deco stop by having
* both ndl and stop information */
+ sample->in_deco = FALSE;
sample->stopdepth.mm = stopdepth;
sample->stoptime.seconds = u_sample->hold_time *60;
sample->ndl.seconds = lastndl;
} else {
/* NDL */
+ sample->in_deco = FALSE;
lastndl = sample->ndl.seconds = u_sample->hold_time *60;
sample->stopdepth.mm = 0;
sample->stoptime.seconds = 0;