summaryrefslogtreecommitdiffstats
path: root/core/planner.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2017-09-17 21:06:44 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-10-01 23:58:55 +0300
commit1f50485732f5a84dc1e41014f760f55852da188a (patch)
treed706fe17091995037933ecef56207d7ecf904ebe /core/planner.c
parent7713c7e607b11c0828decdbf35d910280153f880 (diff)
downloadsubsurface-1f50485732f5a84dc1e41014f760f55852da188a.tar.gz
More VPMB state in special structure
... and reset deco information in profile ceiling computation. The planner test then needs to know about the struct holding the deco state. Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core/planner.c')
-rw-r--r--core/planner.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/core/planner.c b/core/planner.c
index 3ea829ba4..f53b9df2e 100644
--- a/core/planner.c
+++ b/core/planner.c
@@ -39,8 +39,6 @@ extern double regressiona();
extern double regressionb();
extern void reset_regression();
-pressure_t first_ceiling_pressure, max_bottom_ceiling_pressure = {};
-
char *disclaimer;
int plot_depth = 0;
#if DEBUG_PLAN
@@ -184,8 +182,8 @@ unsigned int tissue_at_end(struct dive *dive, struct deco_state **cached_datap)
dive,
1),
dive);
- if (ceiling_pressure.mbar > max_bottom_ceiling_pressure.mbar)
- max_bottom_ceiling_pressure.mbar = ceiling_pressure.mbar;
+ if (ceiling_pressure.mbar > deco_state->max_bottom_ceiling_pressure.mbar)
+ deco_state->max_bottom_ceiling_pressure.mbar = ceiling_pressure.mbar;
}
interpolate_transition(dive, t0, t1, lastdepth, sample->depth, &gas, setpoint);
@@ -691,7 +689,7 @@ bool plan(struct diveplan *diveplan, struct dive *dive, int timestep, struct dec
diveplan->surface_pressure = SURFACE_PRESSURE;
dive->surface_pressure.mbar = diveplan->surface_pressure;
clear_deco(dive->surface_pressure.mbar / 1000.0);
- max_bottom_ceiling_pressure.mbar = first_ceiling_pressure.mbar = 0;
+ deco_state->max_bottom_ceiling_pressure.mbar = deco_state->first_ceiling_pressure.mbar = 0;
create_dive_from_plan(diveplan, dive, is_planner);
// Do we want deco stop array in metres or feet?
@@ -859,14 +857,14 @@ bool plan(struct diveplan *diveplan, struct dive *dive, int timestep, struct dec
breaktime = -1;
breakcylinder = 0;
o2time = 0;
- first_ceiling_pressure.mbar = depth_to_mbar(deco_allowed_depth(tissue_tolerance_calc(dive,
+ deco_state->first_ceiling_pressure.mbar = depth_to_mbar(deco_allowed_depth(tissue_tolerance_calc(dive,
depth_to_bar(depth, dive)),
diveplan->surface_pressure / 1000.0,
dive,
1),
dive);
- if (max_bottom_ceiling_pressure.mbar > first_ceiling_pressure.mbar)
- first_ceiling_pressure.mbar = max_bottom_ceiling_pressure.mbar;
+ if (deco_state->max_bottom_ceiling_pressure.mbar > deco_state->first_ceiling_pressure.mbar)
+ deco_state->first_ceiling_pressure.mbar = deco_state->max_bottom_ceiling_pressure.mbar;
last_ascend_rate = ascent_velocity(depth, avg_depth, bottom_time);
if ((current_cylinder = get_gasidx(dive, &gas)) == -1) {