[PATCH] Planner: Count the minimum stop time towards o2time

Rick Walsh rickmwalsh at gmail.com
Sun Jul 26 02:27:15 PDT 2015


When doing backgas breaks, count the minimum stop time towards o2time.
Previously, the initial minimum stop wasn't counted, so the time of the first
segment on oxygen was min_switch_duration + 12 minutes.

E.g. with 1 minute minimum switch duration.

Previously:
depth   duration        runtime gas
40m     1min    1min    air
40m     34min   35min
21m     2min    37min
21m     1min    38min   EAN50
18m     1min    39min
15m     3min    42min
12m     4min    46min
9m      5min    51min
6m      13min   64min   oxygen	<--13 minutes on O2
6m      6min    70min   air
6m      2min    72min   oxygen
0m      1min    73min

Now:
depth	duration	runtime	gas
40m	1min	1min	air
40m	34min	35min	 
21m	2min	37min	 
21m	1min	38min	EAN50
18m	1min	39min	 
15m	3min	42min	 
12m	4min	46min	 
9m	5min	51min	 
6m	12min	63min	oxygen
6m	6min	69min	air
6m	2min	71min	oxygen
0m	1min	72min	 

Signed-off-by: Rick Walsh <rickmwalsh at gmail.com>
---
 planner.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/planner.c b/planner.c
index f94676f..b6ffa57 100644
--- a/planner.c
+++ b/planner.c
@@ -1121,6 +1121,8 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
 							&displayed_dive.cylinder[current_cylinder].gasmix,
 							prefs.min_switch_duration, po2, &displayed_dive, prefs.decosac);
 						clock += prefs.min_switch_duration;
+						if (prefs.doo2breaks && get_o2(&displayed_dive.cylinder[current_cylinder].gasmix) == 1000)
+							o2time += prefs.min_switch_duration;
 					} else {
 						pendinggaschange = true;
 					}
@@ -1158,6 +1160,8 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
 						&displayed_dive.cylinder[current_cylinder].gasmix,
 						prefs.min_switch_duration, po2, &displayed_dive, prefs.decosac);
 					clock += prefs.min_switch_duration;
+					if (prefs.doo2breaks && get_o2(&displayed_dive.cylinder[current_cylinder].gasmix) == 1000)
+						o2time += prefs.min_switch_duration;
 					pendinggaschange = false;
 				}
 
-- 
2.4.3



More information about the subsurface mailing list