summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-10-24 16:40:21 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-04 07:13:04 -0800
commit06ddfc01222879ee0463affe796dba05de33b368 (patch)
treef098f39a8ffb7321e3db08989960b9dd511a1b53 /planner.c
parentf31d34adfd9676d7ccb6544d4a2b50336295e917 (diff)
downloadsubsurface-06ddfc01222879ee0463affe796dba05de33b368.tar.gz
Prepare for PSCR calculations
Calculations for passive semi-closed rebreathers are pretty much like OC except the pO2 is lower bey a certain (SAC dependent) factor. This patch introduces the corresponding calculations in case dctype == PSCR which is so far never set and there is currently no UI for these calculations. As pO2 is SAC dependent it takes a certain attempt at getting it and drops to defaults from the prefs otherwise. As there is no UI at this point and I also don't have any dives, this has not received much testing, yet, but it compiles. At least. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/planner.c b/planner.c
index b88c8fe82..a4181907e 100644
--- a/planner.c
+++ b/planner.c
@@ -127,7 +127,7 @@ double interpolate_transition(struct dive *dive, duration_t t0, duration_t t1, d
for (j = t0.seconds; j < t1.seconds; j++) {
int depth = interpolate(d0.mm, d1.mm, j - t0.seconds, t1.seconds - t0.seconds);
- tissue_tolerance = add_segment(depth_to_mbar(depth, dive) / 1000.0, gasmix, 1, po2.mbar, dive);
+ tissue_tolerance = add_segment(depth_to_mbar(depth, dive) / 1000.0, gasmix, 1, po2.mbar, dive, prefs.bottomsac);
}
return tissue_tolerance;
}
@@ -831,7 +831,7 @@ int plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool s
tissue_tolerance = add_segment(depth_to_mbar(depth, &displayed_dive) / 1000.0,
&displayed_dive.cylinder[current_cylinder].gasmix,
- TIMESTEP, po2, &displayed_dive);
+ TIMESTEP, po2, &displayed_dive, prefs.decosac);
clock += TIMESTEP;
depth -= deltad;
} while (depth > stoplevels[stopidx]);
@@ -869,7 +869,7 @@ int plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool s
deltad = trial_depth;
tissue_tolerance = add_segment(depth_to_mbar(trial_depth, &displayed_dive) / 1000.0,
&displayed_dive.cylinder[current_cylinder].gasmix,
- TIMESTEP, po2, &displayed_dive);
+ TIMESTEP, po2, &displayed_dive, prefs.decosac);
if (deco_allowed_depth(tissue_tolerance, diveplan->surface_pressure / 1000.0, &displayed_dive, 1) > trial_depth - deltad) {
/* We should have stopped */
clear_to_ascend = false;
@@ -892,7 +892,7 @@ int plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool s
}
tissue_tolerance = add_segment(depth_to_mbar(depth, &displayed_dive) / 1000.0,
&displayed_dive.cylinder[current_cylinder].gasmix,
- DECOTIMESTEP, po2, &displayed_dive);
+ DECOTIMESTEP, po2, &displayed_dive, prefs.decosac);
cache_deco_state(tissue_tolerance, &trial_cache);
clock += DECOTIMESTEP;
/* Finish infinite deco */