From cfe345aa8e19391a6fa369e376be5dc17e9d6fd3 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 11 Jan 2024 23:09:11 +0100 Subject: [PATCH] Exclude O2 sensors without calibration data O2 sensor for which no calibration data is available will always result in a ppO2 value of zero for all samples, which isn't very useful. --- src/divesoft_freedom_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/divesoft_freedom_parser.c b/src/divesoft_freedom_parser.c index 49c0f0f..9647511 100644 --- a/src/divesoft_freedom_parser.c +++ b/src/divesoft_freedom_parser.c @@ -1017,8 +1017,8 @@ divesoft_freedom_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callba for (unsigned int i = 0; i < NSENSORS; ++i) { unsigned int value = array_uint16_le (data + offset + 4 + i * 2); unsigned int state = data[offset + 12 + i]; - if (!parser->calibrated || state == SENSTAT_UNCALIBRATED || - state == SENSTAT_NOT_EXIST) + if (!parser->calibrated || parser->calibration[i] == 0 || + state == SENSTAT_UNCALIBRATED || state == SENSTAT_NOT_EXIST) continue; sample.ppo2.sensor = i; sample.ppo2.value = value / 100.0 * parser->calibration[i] / BAR;