Skip to content

Commit

Permalink
Exclude O2 sensors without calibration data
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jefdriesen committed Jan 12, 2024
1 parent d47e1ce commit cfe345a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/divesoft_freedom_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit cfe345a

Please sign in to comment.