summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Joakim Bygdell <j.bygdell@gmail.com>2015-05-21 19:55:28 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-05-21 13:26:49 -0700
commit9ca033c55038efed82b8a09dcd84e310a58f2e73 (patch)
tree4edf4edfa46517abd3343006d24d287edfd2ae18 /planner.c
parent95c2c06be440be62850ae06d201e55aa28415085 (diff)
downloadsubsurface-9ca033c55038efed82b8a09dcd84e310a58f2e73.tar.gz
Be more precise about the safety-stop.
There is no point in doing a stop at 5m if the last manual waypoint is shallower. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/planner.c b/planner.c
index 92ddc8491..3c9b9df33 100644
--- a/planner.c
+++ b/planner.c
@@ -807,7 +807,7 @@ void track_ascent_gas(int depth, cylinder_t *cylinder, int avg_depth, int bottom
if (deltad > depth)
deltad = depth;
update_cylinder_pressure(&displayed_dive, depth, depth - deltad, TIMESTEP, prefs.decosac, cylinder, true);
- if (depth <= 5000 && safety_stop){
+ if (depth <= 5000 && depth >= (5000 - deltad) && safety_stop) {
update_cylinder_pressure(&displayed_dive, 5000, 5000, 180, prefs.decosac, cylinder, true);
safety_stop = false;
}
@@ -978,7 +978,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
TIMESTEP, po2, &displayed_dive, prefs.decosac);
clock += TIMESTEP;
depth -= deltad;
- if (depth <= 5000 && safety_stop) {
+ if (depth <= 5000 && depth >= (5000 - deltad) && safety_stop) {
plan_add_segment(diveplan, clock - previous_point_time, 5000, gas, po2, false);
previous_point_time = clock;
clock += 180;