Aeris A300CS: add support for NDL / deco data

Encoded in every sample. The depth is in multiples of 10 feet which gives
somewhat odd metric stop depth - but rounding to full meters would take
care of that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-09-30 12:35:04 -07:00 committed by Jef Driesen
parent d89dd952c9
commit 16fb1c1869

View File

@ -634,6 +634,22 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
sample.depth = depth / 16.0 * FEET;
if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata);
// NDL / Deco
// bits 6..4 of byte 15 encode deco state & depth
// bytes 6 & 7 encode minutes of NDL / deco
if (parser->model == A300CS) {
unsigned int deco = (data[offset + 15] & 0x70) >> 4;
if (deco) {
sample.deco.type = DC_DECO_DECOSTOP;
sample.deco.depth = deco * 10 * FEET;
} else {
sample.deco.type = DC_DECO_NDL;
sample.deco.depth = 0.0;
}
sample.deco.time = array_uint16_le(data + offset + 6) & 0x03FF;
if (callback) callback (DC_SAMPLE_DECO, sample, userdata);
}
complete = 1;
}