aboutsummaryrefslogtreecommitdiffstats
path: root/core/dive.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/dive.c')
-rw-r--r--core/dive.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/dive.c b/core/dive.c
index 528cf9efa..c4a903eec 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -2072,7 +2072,7 @@ static void dc_cylinder_renumber(struct dive *dive, struct divecomputer *dc, int
if (mapping[0] > 0)
add_initial_gaschange(dive, dc);
- /* Remap the sensor indexes */
+ /* Remap or delete the sensor indexes */
for (i = 0; i < dc->samples; i++) {
struct sample *s = dc->sample + i;
int j;
@@ -2081,8 +2081,18 @@ static void dc_cylinder_renumber(struct dive *dive, struct divecomputer *dc, int
int sensor;
sensor = mapping[s->sensor[j]];
- if (sensor >= 0)
+ if (sensor == -1) {
+ // Remove sensor and gas pressure info
+ if (i == 0) {
+ s->sensor[j] = 0;
+ s->pressure[j].mbar = 0;
+ } else {
+ s->sensor[j] = s[-1].sensor[j];
+ s->pressure[j].mbar = s[-1].pressure[j].mbar;
+ }
+ } else {
s->sensor[j] = sensor;
+ }
}
}