summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dive.h2
-rw-r--r--equipment.c6
-rw-r--r--planner.c2
-rw-r--r--qt-ui/diveplanner.cpp4
4 files changed, 7 insertions, 7 deletions
diff --git a/dive.h b/dive.h
index d22ff0543..d4bce9d6e 100644
--- a/dive.h
+++ b/dive.h
@@ -741,7 +741,7 @@ extern bool no_weightsystems(weightsystem_t *ws);
extern bool weightsystems_equal(weightsystem_t *ws1, weightsystem_t *ws2);
extern void remove_cylinder(struct dive *dive, int idx);
extern void remove_weightsystem(struct dive *dive, int idx);
-extern void reset_cylinders(struct dive *dive);
+extern void reset_cylinders(struct dive *dive, bool track_gas);
/*
* String handling.
diff --git a/equipment.c b/equipment.c
index 0cc7ea918..438bca02a 100644
--- a/equipment.c
+++ b/equipment.c
@@ -231,8 +231,8 @@ void remove_weightsystem(struct dive *dive, int idx)
}
/* when planning a dive we need to make sure that all cylinders have a sane depth assigned
- * and that the pressures are reset to start = end = workingpressure */
-void reset_cylinders(struct dive *dive)
+ * and if we are tracking gas consumption the pressures need to be reset to start = end = workingpressure */
+void reset_cylinders(struct dive *dive, bool track_gas)
{
int i;
pressure_t pO2 = {.mbar = 1400};
@@ -243,7 +243,7 @@ void reset_cylinders(struct dive *dive)
continue;
if (cyl->depth.mm == 0) /* if the gas doesn't give a mod, assume conservative pO2 */
cyl->depth = gas_mod(&cyl->gasmix, pO2, M_OR_FT(3,10));
- if (cyl->type.workingpressure.mbar)
+ if (track_gas && cyl->type.workingpressure.mbar)
cyl->start.mbar = cyl->end.mbar = cyl->type.workingpressure.mbar;
cyl->gas_used.mliter = 0;
}
diff --git a/planner.c b/planner.c
index fcbb579d9..31ba3310c 100644
--- a/planner.c
+++ b/planner.c
@@ -260,7 +260,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
#endif
// reset the cylinders and clear out the samples and events of the
// displayed dive so we can restart
- reset_cylinders(&displayed_dive);
+ reset_cylinders(&displayed_dive, track_gas);
dc = &displayed_dive.dc;
free(dc->sample);
dc->sample = NULL;
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 78bcff19d..0bc9a1271 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -143,7 +143,7 @@ void DivePlannerPointsModel::setupCylinders()
// take the used cylinders from the selected dive as starting point
CylindersModel::instance()->copyFromDive(current_dive);
copy_cylinders(current_dive, &displayed_dive, true);
- reset_cylinders(&displayed_dive);
+ reset_cylinders(&displayed_dive, true);
return;
}
if (!same_string(prefs.default_cylinder, "")) {
@@ -154,7 +154,7 @@ void DivePlannerPointsModel::setupCylinders()
displayed_dive.cylinder[0].type.size.mliter = 11100;
displayed_dive.cylinder[0].type.workingpressure.mbar = 207000;
}
- reset_cylinders(&displayed_dive);
+ reset_cylinders(&displayed_dive, false);
CylindersModel::instance()->copyFromDive(&displayed_dive);
}