Use MAX_SENSORS define everywhere

Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
This commit is contained in:
Stefan Fuchs 2017-11-27 14:40:51 +01:00 committed by Lubomir I. Ivanov
parent 276fd441b5
commit b17f1e2d30

View file

@ -750,8 +750,8 @@ struct sample *prepare_sample(struct divecomputer *dc)
// Copy the sensor numbers - but not the pressure values // Copy the sensor numbers - but not the pressure values
// from the previous sample if any. // from the previous sample if any.
if (nr) { if (nr) {
sample->sensor[0] = sample[-1].sensor[0]; for (int idx = 0; idx < MAX_SENSORS; idx++)
sample->sensor[1] = sample[-1].sensor[1]; sample->sensor[idx] = sample[-1].sensor[idx];
} }
// Init some values with -1 // Init some values with -1
sample->bearing.degrees = -1; sample->bearing.degrees = -1;
@ -1477,7 +1477,7 @@ static void simplify_dc_pressures(struct divecomputer *dc)
int j; int j;
struct sample *sample = dc->sample + i; struct sample *sample = dc->sample + i;
for (j = 0; j < 2; j++) { for (j = 0; j < MAX_SENSORS; j++) {
int pressure = sample->pressure[j].mbar; int pressure = sample->pressure[j].mbar;
int index = sample->sensor[j]; int index = sample->sensor[j];
@ -2075,7 +2075,7 @@ static void dc_cylinder_renumber(struct dive *dive, struct divecomputer *dc, int
struct sample *s = dc->sample + i; struct sample *s = dc->sample + i;
int j; int j;
for (j = 0; j < 2; j++) { for (j = 0; j < MAX_SENSORS; j++) {
int sensor; int sensor;
sensor = mapping[s->sensor[j]]; sensor = mapping[s->sensor[j]];