Pass infinite NDL values to the application

When the last deco stop is cleared, the dive computer switches to NDL
mode with an infinite time (0x7FFF for APOS4 and 0xFFFF for APOS3). But
because libdivecomputer does not report those infinite values to the
application, detecting the end of the deco phase is not very intuitive.

This issue is fixed by passing those infinite NDL values as-is to the
application, despite the relative large values (respectively 9.1 and
18.2 hours). For reference, the finite NDL values reported by the ratio
dive computers can be large as well, with values up to 0x4000 (4.55
hours).
This commit is contained in:
Jef Driesen 2020-02-25 21:18:19 +01:00
parent 416022f3cc
commit 8a1d32d319

View File

@ -477,28 +477,20 @@ divesystem_idive_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba
decostop = array_uint16_le (data + offset + 21);
decotime = array_uint16_le (data + offset + 23);
tts = array_uint16_le (data + offset + 25);
if (tts == 0x7FFF) {
tts = INVALID;
}
} else {
decostop = array_uint16_le (data + offset + 21);
tts = array_uint16_le (data + offset + 23);
if (tts == 0xFFFF) {
tts = INVALID;
}
}
if (tts != INVALID) {
if (decostop) {
sample.deco.type = DC_DECO_DECOSTOP;
sample.deco.depth = decostop / 10.0;
sample.deco.time = apos4 ? decotime : tts;
} else {
sample.deco.type = DC_DECO_NDL;
sample.deco.depth = 0.0;
sample.deco.time = tts;
}
if (callback) callback (DC_SAMPLE_DECO, sample, userdata);
if (decostop) {
sample.deco.type = DC_DECO_DECOSTOP;
sample.deco.depth = decostop / 10.0;
sample.deco.time = apos4 ? decotime : tts;
} else {
sample.deco.type = DC_DECO_NDL;
sample.deco.depth = 0.0;
sample.deco.time = tts;
}
if (callback) callback (DC_SAMPLE_DECO, sample, userdata);
// CNS
unsigned int cns = array_uint16_le (data + offset + 29);