Shearwater: Add Sensor Calibration Info.

Add the calibration values for ppO2 sonsors in CCR mode as extra info
fields.

Signed-off-by: Michael Keller <github@ike.ch>
This commit is contained in:
Michael Keller 2024-05-04 02:02:19 +12:00
parent 6e65428fc8
commit a7fb341fb0

View File

@ -727,9 +727,11 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser)
dc_field_add_string_fmt(&parser->cache, "Logversion", "%d%s", logversion, pnf ? "(PNF)" : "");
// Cache sensor calibration for later use
unsigned int nsensors = 0;
unsigned int base = parser->opening[3] + (pnf ? 6 : 86);
parser->calibrated = data[base];
for (size_t i = 0; i < 3; ++i) {
if (parser->calibrated & (1 << i)) {
unsigned int calibration = array_uint16_be(data + base + 1 + i * 2);
parser->calibration[i] = calibration / 100000.0;
if (parser->model == PREDATOR) {
@ -739,12 +741,16 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser)
// sensors lines up and matches the average.
parser->calibration[i] *= 2.2;
}
if (data[base] & (1 << i)) {
nsensors++;
}
}
parser->calibrated = data[base];
static const char *name[] = {
"Sensor 1 calibration [bar / V]",
"Sensor 2 calibration [bar / V]",
"Sensor 3 calibration [bar / V]",
};
dc_field_add_string_fmt(&parser->cache, name[i], "%.2f", parser->calibration[i] * 1000);
}
}
// Get the dive mode from the header (if available).
if (logversion >= 8) {