libdivecomputer: allow a "zero depth" deco stop depth

That just means that we're not in deco, the same way as giving a nonzero
NDL value does.  But if you don't have NDL, this is a much more
convenient way of saying "not in deco".

The Garmin Descent gives us stop information, but not necessarily NDL,
and really wants this.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2018-09-02 13:52:48 -07:00 committed by Dirk Hohndel
parent faea11e4fb
commit 5c2bca048f

View file

@ -418,9 +418,9 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, void *userdata)
sample->in_deco = in_deco = false; sample->in_deco = in_deco = false;
} else if (value.deco.type == DC_DECO_DECOSTOP || } else if (value.deco.type == DC_DECO_DECOSTOP ||
value.deco.type == DC_DECO_DEEPSTOP) { value.deco.type == DC_DECO_DEEPSTOP) {
sample->in_deco = in_deco = true;
sample->stopdepth.mm = stopdepth = lrint(value.deco.depth * 1000.0); sample->stopdepth.mm = stopdepth = lrint(value.deco.depth * 1000.0);
sample->stoptime.seconds = stoptime = value.deco.time; sample->stoptime.seconds = stoptime = value.deco.time;
sample->in_deco = in_deco = stopdepth > 0;
ndl = 0; ndl = 0;
} else if (value.deco.type == DC_DECO_SAFETYSTOP) { } else if (value.deco.type == DC_DECO_SAFETYSTOP) {
sample->in_deco = in_deco = false; sample->in_deco = in_deco = false;