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

@ -1657,9 +1657,10 @@ static void sample_renumber(struct sample *s, int i, const int mapping[])
int j;
for (j = 0; j < MAX_SENSORS; j++) {
int sensor;
int sensor = -1;
sensor = mapping[s->sensor[j]];
if (s->sensor[j] != NO_SENSOR)
sensor = mapping[s->sensor[j]];
if (sensor == -1) {
// Remove sensor and gas pressure info
if (i == 0) {