mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
46b64d8e21
commit
e3ab1c0701
7 changed files with 40 additions and 27 deletions
|
@ -330,6 +330,8 @@ static void save_sample(FILE *f, struct sample *sample, const struct sample *pre
|
|||
/* the deco/ndl values are stored whenever they change */
|
||||
if (sample->ndl.seconds != prev->ndl.seconds)
|
||||
fprintf(f, " ndl='%u:%02u min'", FRACTION(sample->ndl.seconds, 60));
|
||||
if (sample->in_deco != prev->in_deco)
|
||||
fprintf(f, " in_deco='%d'", sample->in_deco ? 1 : 0);
|
||||
if (sample->stoptime.seconds != prev->stoptime.seconds)
|
||||
fprintf(f, " stoptime='%u:%02u min'", FRACTION(sample->stoptime.seconds, 60));
|
||||
if (sample->stopdepth.mm != prev->stopdepth.mm)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue