mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Enforce planner minimum gas switch duration
Enforce a minimum duration for gas switching in the planner. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4dfdea1e1d
commit
845030a8ad
1 changed files with 13 additions and 4 deletions
17
planner.c
17
planner.c
|
@ -1040,12 +1040,21 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
|
||||||
previous_point_time = clock;
|
previous_point_time = clock;
|
||||||
stopping = true;
|
stopping = true;
|
||||||
|
|
||||||
current_cylinder = gaschanges[gi].gasidx;
|
/* Check we need to change cylinder.
|
||||||
gas = displayed_dive.cylinder[current_cylinder].gasmix;
|
* We might not if the cylinder was chosen by the user */
|
||||||
|
if (current_cylinder != gaschanges[gi].gasidx) {
|
||||||
|
current_cylinder = gaschanges[gi].gasidx;
|
||||||
|
gas = displayed_dive.cylinder[current_cylinder].gasmix;
|
||||||
#if DEBUG_PLAN & 16
|
#if DEBUG_PLAN & 16
|
||||||
printf("switch to gas %d (%d/%d) @ %5.2lfm\n", gaschanges[gi].gasidx,
|
printf("switch to gas %d (%d/%d) @ %5.2lfm\n", gaschanges[gi].gasidx,
|
||||||
(get_o2(&gas) + 5) / 10, (get_he(&gas) + 5) / 10, gaschanges[gi].depth / 1000.0);
|
(get_o2(&gas) + 5) / 10, (get_he(&gas) + 5) / 10, gaschanges[gi].depth / 1000.0);
|
||||||
#endif
|
#endif
|
||||||
|
/* Stop for the minimum duration to switch gas */
|
||||||
|
tissue_tolerance = add_segment(depth_to_mbar(depth, &displayed_dive) / 1000.0,
|
||||||
|
&displayed_dive.cylinder[current_cylinder].gasmix,
|
||||||
|
prefs.min_switch_duration, po2, &displayed_dive, prefs.decosac);
|
||||||
|
clock += prefs.min_switch_duration;
|
||||||
|
}
|
||||||
gi--;
|
gi--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue