core: add a special NO_SENSOR value for sample::sensor

The sensor member of sample refers to a cylinder from which
the pressure was read. However, some dives don't even have
a cylinder. Therefore, introduce a special NO_SENSOR value
for these dives. Since the cylinder is given as a uint8_t,
0xff seems to be a sensible choice.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2021-07-18 22:26:38 +02:00 committed by Dirk Hohndel
parent 48c2929f48
commit 7e11a35371
3 changed files with 8 additions and 5 deletions

View file

@ -566,9 +566,9 @@ static void populate_plot_entries(const struct dive *dive, const struct divecomp
} else {
entry->pressures.o2 = sample->setpoint.mbar / 1000.0;
}
if (sample->pressure[0].mbar)
if (sample->pressure[0].mbar && sample->sensor[0] != NO_SENSOR)
set_plot_pressure_data(pi, idx, SENSOR_PR, sample->sensor[0], sample->pressure[0].mbar);
if (sample->pressure[1].mbar)
if (sample->pressure[1].mbar && sample->sensor[1] != NO_SENSOR)
set_plot_pressure_data(pi, idx, SENSOR_PR, sample->sensor[1], sample->pressure[1].mbar);
if (sample->temperature.mkelvin)
entry->temperature = lasttemp = sample->temperature.mkelvin;