Use our the decopo2 from preferences for mod/switchdepth calculations
when re-planning a dive or planning a dive based on a previous dive.

Signed-off-by: Anton Lundin <gla...@acc.umu.se>
---
 equipment.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/equipment.c b/equipment.c
index 6396df0..32f7774 100644
--- a/equipment.c
+++ b/equipment.c
@@ -215,14 +215,14 @@ void remove_weightsystem(struct dive *dive, int idx)
 void reset_cylinders(struct dive *dive, bool track_gas)
 {
        int i;
-       pressure_t pO2 = {.mbar = 1400};
+       pressure_t decopo2 = {.mbar = prefs.decopo2};
 
        for (i = 0; i < MAX_CYLINDERS; i++) {
                cylinder_t *cyl = &dive->cylinder[i];
                if (cylinder_none(cyl))
                        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->depth.mm == 0) /* if the gas doesn't give a mod, 
calculate based on prefs */
+                       cyl->depth = gas_mod(&cyl->gasmix, decopo2, 
M_OR_FT(3,10));
                if (track_gas)
                        cyl->start.mbar = cyl->end.mbar = 
cyl->type.workingpressure.mbar;
                cyl->gas_used.mliter = 0;
-- 
2.1.0

_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to