diff options
author | Robert C. Helling <helling@atdotde.de> | 2019-01-10 21:18:53 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-01-13 15:02:07 -0800 |
commit | 2c794348c1060c8f6ce55c598c0a20690c4967f2 (patch) | |
tree | f5a47767117dd43ee20a878c7132b944e2609682 /core | |
parent | 7f2c7aa7dee10d419fe3ce208d6a36cc1e93b580 (diff) | |
download | subsurface-2c794348c1060c8f6ce55c598c0a20690c4967f2.tar.gz |
Planner: Add checkbox to force OC bailout
This adds a checkbox for rebreather modes of the planner
that force the ascent to be in OC mode. Before, one had
to add a one minute last segment with the mode change but
this is not practical when manually searching for the
maximal bottom time given gas reserves.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core')
-rw-r--r-- | core/planner.c | 4 | ||||
-rw-r--r-- | core/pref.h | 1 | ||||
-rw-r--r-- | core/settings/qPrefDivePlanner.cpp | 2 | ||||
-rw-r--r-- | core/settings/qPrefDivePlanner.h | 5 | ||||
-rw-r--r-- | core/subsurfacestartup.c | 1 |
5 files changed, 13 insertions, 0 deletions
diff --git a/core/planner.c b/core/planner.c index 1077fb313..3f5de00de 100644 --- a/core/planner.c +++ b/core/planner.c @@ -742,6 +742,10 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i printf("depth %5.2lfm \n", depth / 1000.0); printf("current_cylinder %i\n", current_cylinder); #endif + if ((divemode == CCR || divemode == PSCR) && prefs.dobailout) { + divemode = OC; + po2 = 0; + } best_first_ascend_cylinder = current_cylinder; /* Find the gases available for deco */ diff --git a/core/pref.h b/core/pref.h index 9662b1a57..3cfc90ebd 100644 --- a/core/pref.h +++ b/core/pref.h @@ -168,6 +168,7 @@ struct preferences { bool display_transitions; bool display_variations; bool doo2breaks; + bool dobailout; bool drop_stone_mode; bool last_stop; // At 6m? int min_switch_duration; // seconds diff --git a/core/settings/qPrefDivePlanner.cpp b/core/settings/qPrefDivePlanner.cpp index ce15a081e..04a2ba7e7 100644 --- a/core/settings/qPrefDivePlanner.cpp +++ b/core/settings/qPrefDivePlanner.cpp @@ -34,6 +34,7 @@ void qPrefDivePlanner::loadSync(bool doSync) disk_display_transitions(doSync); disk_display_variations(doSync); disk_doo2breaks(doSync); + disk_dobailout(doSync); disk_drop_stone_mode(doSync); disk_last_stop(doSync); disk_min_switch_duration(doSync); @@ -74,6 +75,7 @@ HANDLE_PREFERENCE_BOOL(DivePlanner, "display_transitions", display_transitions); HANDLE_PREFERENCE_BOOL(DivePlanner, "display_variations", display_variations); HANDLE_PREFERENCE_BOOL(DivePlanner, "doo2breaks", doo2breaks); +HANDLE_PREFERENCE_BOOL(DivePlanner, "dobailbout", dobailout); HANDLE_PREFERENCE_BOOL(DivePlanner, "drop_stone_mode", drop_stone_mode); diff --git a/core/settings/qPrefDivePlanner.h b/core/settings/qPrefDivePlanner.h index 1e282eaa1..b6ec1a0f7 100644 --- a/core/settings/qPrefDivePlanner.h +++ b/core/settings/qPrefDivePlanner.h @@ -22,6 +22,7 @@ class qPrefDivePlanner : public QObject { Q_PROPERTY(bool display_transitions READ display_transitions WRITE set_display_transitions NOTIFY display_transitionsChanged); Q_PROPERTY(bool display_variations READ display_variations WRITE set_display_variations NOTIFY display_variationsChanged); Q_PROPERTY(bool doo2breaks READ doo2breaks WRITE set_doo2breaks NOTIFY doo2breaksChanged); + Q_PROPERTY(bool dobailout READ dobailout WRITE set_dobailout NOTIFY dobailoutChanged); Q_PROPERTY(bool drop_stone_mode READ drop_stone_mode WRITE set_drop_stone_mode NOTIFY drop_stone_modeChanged); Q_PROPERTY(bool last_stop READ last_stop WRITE set_last_stop NOTIFY last_stopChanged); Q_PROPERTY(int min_switch_duration READ min_switch_duration WRITE set_min_switch_duration NOTIFY min_switch_durationChanged); @@ -58,6 +59,7 @@ public: static bool display_transitions() { return prefs.display_transitions; } static bool display_variations() { return prefs.display_variations; } static bool doo2breaks() { return prefs.doo2breaks; } + static bool dobailout() { return prefs.dobailout; } static bool drop_stone_mode() { return prefs.drop_stone_mode; } static bool last_stop() { return prefs.last_stop; } static int min_switch_duration() { return prefs.min_switch_duration; } @@ -85,6 +87,7 @@ public slots: static void set_display_transitions(bool value); static void set_display_variations(bool value); static void set_doo2breaks(bool value); + static void set_dobailout(bool value); static void set_drop_stone_mode(bool value); static void set_last_stop(bool value); static void set_min_switch_duration(int value); @@ -112,6 +115,7 @@ signals: void display_transitionsChanged(bool value); void display_variationsChanged(bool value); void doo2breaksChanged(bool value); + void dobailoutChanged(bool value); void drop_stone_modeChanged(bool value); void last_stopChanged(bool value); void min_switch_durationChanged(int value); @@ -140,6 +144,7 @@ private: static void disk_display_transitions(bool doSync); static void disk_display_variations(bool doSync); static void disk_doo2breaks(bool doSync); + static void disk_dobailout(bool doSync); static void disk_drop_stone_mode(bool doSync); static void disk_last_stop(bool doSync); static void disk_min_switch_duration(bool doSync); diff --git a/core/subsurfacestartup.c b/core/subsurfacestartup.c index 607090219..07be0cb43 100644 --- a/core/subsurfacestartup.c +++ b/core/subsurfacestartup.c @@ -59,6 +59,7 @@ struct preferences default_prefs = { .decopo2 = 1600, .bestmixend.mm = 30000, .doo2breaks = false, + .dobailout = false, .drop_stone_mode = false, .switch_at_req_stop = false, .min_switch_duration = 60, |