Maintain sensor index for uemis and liquivision

Previosuly they always used index 0 for the active sensor, use
add_sample_pressure instead.

Signed-off-by: Michael Andreen <michael@andreen.dev>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Michael Andreen 2022-03-06 11:34:12 +01:00 committed by Dirk Hohndel
parent 9b4263aa87
commit 4e92cb2567
2 changed files with 4 additions and 9 deletions

View file

@ -343,8 +343,7 @@ static void parse_dives(int log_version, const unsigned char *buf, unsigned int
sample->time.seconds = event.time;
sample->depth.mm = array_uint16_le(ds + (d - 1) * 2) * 10; // cm->mm
sample->temperature.mkelvin = C_to_mkelvin((float) array_uint16_le(ts + (d - 1) * 2) / 10); // dC->mK
sample->sensor[0] = event.pressure.sensor;
sample->pressure[0].mbar = event.pressure.mbar;
add_sample_pressure(sample, event.pressure.sensor, event.pressure.mbar);
finish_sample(dc);
break;
@ -361,16 +360,14 @@ static void parse_dives(int log_version, const unsigned char *buf, unsigned int
sample->time.seconds = sample_time;
sample->depth.mm = depth_mm;
sample->temperature.mkelvin = temp_mk;
sample->sensor[0] = event.pressure.sensor;
sample->pressure[0].mbar = event.pressure.mbar;
add_sample_pressure(sample, event.pressure.sensor, event.pressure.mbar);
finish_sample(dc);
d++;
break;
} else { // Event is prior to sample
sample->time.seconds = event.time;
sample->sensor[0] = event.pressure.sensor;
sample->pressure[0].mbar = event.pressure.mbar;
add_sample_pressure(sample, event.pressure.sensor, event.pressure.mbar);
if (last_time == sample_time) {
sample->depth.mm = depth_mm;
sample->temperature.mkelvin = temp_mk;