summaryrefslogtreecommitdiffstats
path: root/core/libdivecomputer.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/libdivecomputer.c')
-rw-r--r--core/libdivecomputer.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index 2d7778346..c935ecbce 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -352,17 +352,15 @@ sample_cb(dc_sample_type_t type, dc_sample_value_t value, void *userdata)
case DC_SAMPLE_DEPTH:
sample->depth.mm = lrint(value.depth * 1000);
break;
- case DC_SAMPLE_PRESSURE:
+ case DC_SAMPLE_PRESSURE: {
+ int sensoridx = 0;
/* Do we already have a pressure reading? */
- if (sample->pressure[0].mbar) {
- /* Do we prefer the one we already have? */
- /* If so, just ignore the new one */
- if (sample->sensor == current_gas_index)
- break;
- }
- sample->sensor = value.pressure.tank;
- sample->pressure[0].mbar = lrint(value.pressure.value * 1000);
+ if (sample->pressure[0].mbar)
+ sensoridx = 1;
+ sample->sensor[sensoridx] = value.pressure.tank;
+ sample->pressure[sensoridx].mbar = lrint(value.pressure.value * 1000);
break;
+ }
case DC_SAMPLE_GASMIX:
handle_gasmix(dc, sample, value.gasmix);
break;