diff options
author | Robert C. Helling <helling@atdotde.de> | 2014-07-02 22:07:38 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-07-03 16:33:19 -0700 |
commit | 5db706d291e8916cd9ba63a3b26b24d4471c608d (patch) | |
tree | b71313f4e9023091fd5de61e8a78017a91902525 /planner.c | |
parent | 611bae344111845bfa8bd676c0fad49d1c051c10 (diff) | |
download | subsurface-5db706d291e8916cd9ba63a3b26b24d4471c608d.tar.gz |
Planner: Add backgas breaks
If the corresponding checkbox is checked the planner does interrupt
pure O2 deco after 12min for 6min on cylinder 0.
To make this work for air I removed the gasmix_is_null logic.
I guess that makes the planner feature complete for the next release.
[Dirk Hohndel: trivial merge into latest master]
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.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -721,6 +721,9 @@ void plan(struct diveplan *diveplan, char **cached_datap, bool add_deco, bool sh int last_ascend_rate; int best_first_ascend_cylinder; struct gasmix gas; + int o2time = 0; + int breaktime = -1; + int breakcylinder; set_gf(diveplan->gflow, diveplan->gfhigh, prefs.gf_low_at_maxdepth); if (!diveplan->surface_pressure) @@ -862,6 +865,31 @@ void plan(struct diveplan *diveplan, char **cached_datap, bool add_deco, bool sh DECOTIMESTEP, po2, &displayed_dive); cache_deco_state(tissue_tolerance, &trial_cache); clock += DECOTIMESTEP; + if (prefs.doo2breaks) { + if (get_o2(&displayed_dive.cylinder[current_cylinder].gasmix) == 1000) { + o2time += DECOTIMESTEP; + if (o2time >= 12 * 60) { + breaktime = 0; + breakcylinder = current_cylinder; + plan_add_segment(diveplan, clock - previous_point_time, depth, gas, po2, false); + previous_point_time = clock; + current_cylinder = 0; + gas = displayed_dive.cylinder[current_cylinder].gasmix; + } + } else { + if (breaktime >= 0) { + breaktime += DECOTIMESTEP; + if (breaktime >= 6 * 60) { + o2time = 0; + plan_add_segment(diveplan, clock - previous_point_time, depth, gas, po2, false); + previous_point_time = clock; + current_cylinder = breakcylinder; + gas = displayed_dive.cylinder[current_cylinder].gasmix; + breaktime = -1; + } + } + } + } trial_depth = depth; } if (stopping) { |