Add support for ascent rate warnings.
The Cressi Leonardo does store an indicator for the ascent rate (e.g.
the number of arrows) in the upper two bits. This results in 4 possible
values, ranging from 0 to 3, with the following interpretation:
0.0 - 3.9 m/min No signal
4.0 - 7.9 m/min 1 Arrow
8.0 - 11.9 m/min 2 Arrows
12.0+ m/min 3 Arrows (with STOP icon)
Reported-By: Nick Shore <support@mac-dive.com>
This commit is contained in:
parent
61e9847196
commit
1872b71dad
@ -163,6 +163,7 @@ cressi_leonardo_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callbac
|
||||
|
||||
unsigned int value = array_uint16_le (data + offset);
|
||||
unsigned int depth = value & 0x07FF;
|
||||
unsigned int ascent = (value & 0xC000) >> 14;
|
||||
|
||||
// Time (seconds).
|
||||
time += interval;
|
||||
@ -173,6 +174,15 @@ cressi_leonardo_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callbac
|
||||
sample.depth = depth / 10.0;
|
||||
if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata);
|
||||
|
||||
// Ascent rate
|
||||
if (ascent) {
|
||||
sample.event.type = SAMPLE_EVENT_ASCENT;
|
||||
sample.event.time = 0;
|
||||
sample.event.flags = 0;
|
||||
sample.event.value = ascent;
|
||||
if (callback) callback (DC_SAMPLE_EVENT, sample, userdata);
|
||||
}
|
||||
|
||||
offset += 2;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user