summaryrefslogtreecommitdiffstats
path: root/core/planner.c
diff options
context:
space:
mode:
authorGravatar Rick Walsh <rickmwalsh@gmail.com>2017-10-27 10:06:11 +1100
committerGravatar Robert C. Helling <helling@atdotde.de>2017-10-30 21:48:15 +0100
commit04383e27e5d5c9563e7b0f68f425b3ae079d5427 (patch)
tree1969f79381ecad9c255041b78dd4a1554177f914 /core/planner.c
parentd470ef05e026adf6bf73753774f5be92b96f1ec7 (diff)
downloadsubsurface-04383e27e5d5c9563e7b0f68f425b3ae079d5427.tar.gz
VPMB profile: use bottom_time to calculate deco_time in planner
This corrects the issue where the displayed ceiling in the profile was "broken" by the planner, especially for shorter and shallower dives. Also fixes issue outside of planner where the deepest VPM-B ceiling was shown too early, messing up the deco_time calculation. VPM-B plans respond to change in O2% in gas as expected (in my testing) Fixes: #630 Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Diffstat (limited to 'core/planner.c')
-rw-r--r--core/planner.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/planner.c b/core/planner.c
index 18f3c8701..c0b07680d 100644
--- a/core/planner.c
+++ b/core/planner.c
@@ -34,6 +34,7 @@ int decostoplevels_imperial[] = { 0, 3048, 6096, 9144, 12192, 15240, 18288, 2133
325120, 345440, 365760, 386080 };
double plangflow, plangfhigh;
+int bottom_time = 0;
extern double regressiona();
extern double regressionb();
@@ -669,7 +670,7 @@ bool plan(struct diveplan *diveplan, struct dive *dive, int timestep, struct dec
bool stopping = false;
bool pendinggaschange = false;
int clock, previous_point_time;
- int avg_depth, max_depth, bottom_time = 0;
+ int avg_depth, max_depth;
int last_ascend_rate;
int best_first_ascend_cylinder;
struct gasmix gas, bottom_gas;
@@ -1066,6 +1067,7 @@ bool plan(struct diveplan *diveplan, struct dive *dive, int timestep, struct dec
diveplan->eff_gflow = lrint(100.0 * (regressiona() * first_stop_depth + regressionb()));
}
+
create_dive_from_plan(diveplan, dive, is_planner);
add_plan_to_notes(diveplan, dive, show_disclaimer, error);
fixup_dc_duration(&dive->dc);