summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--planner.c5
-rw-r--r--pref.h1
-rw-r--r--qt-ui/diveplanner.cpp10
-rw-r--r--qt-ui/diveplanner.h1
-rw-r--r--qt-ui/plannerSettings.ui44
-rw-r--r--subsurfacestartup.c1
6 files changed, 49 insertions, 13 deletions
diff --git a/planner.c b/planner.c
index bd34f175a..bc7f9c475 100644
--- a/planner.c
+++ b/planner.c
@@ -17,8 +17,6 @@
#define TIMESTEP 3 /* second */
#define DECOTIMESTEP 60 /* seconds. Unit of deco stop times */
-#define RESERVE 40000 /* Remaining gas in recreational mode */
-
int decostoplevels[] = { 0, 3000, 6000, 9000, 12000, 15000, 18000, 21000, 24000, 27000,
30000, 33000, 36000, 39000, 42000, 45000, 48000, 51000, 54000, 57000,
60000, 63000, 66000, 69000, 72000, 75000, 78000, 81000, 84000, 87000,
@@ -845,13 +843,12 @@ bool trial_ascent(int trial_depth, int stoplevel, int avg_depth, int bottom_time
bool enough_gas(int current_cylinder)
{
cylinder_t *cyl;
-
cyl = &displayed_dive.cylinder[current_cylinder];
if (!cyl->start.mbar)
return true;
if (cyl->type.size.mliter)
- return (float) (cyl->end.mbar - RESERVE) * cyl->type.size.mliter / 1000.0 > (float) cyl->deco_gas_used.mliter;
+ return (float) (cyl->end.mbar - prefs.reserve_gas) * cyl->type.size.mliter / 1000.0 > (float) cyl->deco_gas_used.mliter;
else
return true;
}
diff --git a/pref.h b/pref.h
index 14cc57cac..afc5373fd 100644
--- a/pref.h
+++ b/pref.h
@@ -80,6 +80,7 @@ struct preferences {
bool display_transitions;
bool recreational_mode;
bool safetystop;
+ int reserve_gas;
int bottomsac;
int decosac;
int o2consumption; // ml per min
diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp
index 40ec3986f..b21f7f945 100644
--- a/qt-ui/diveplanner.cpp
+++ b/qt-ui/diveplanner.cpp
@@ -395,6 +395,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
prefs.display_transitions = s.value("display_transitions", prefs.display_transitions).toBool();
prefs.recreational_mode = s.value("recreational_mode", prefs.recreational_mode).toBool();
prefs.safetystop = s.value("safetystop", prefs.safetystop).toBool();
+ prefs.reserve_gas = s.value("reserve_gas", prefs.reserve_gas).toInt();
prefs.ascrate75 = s.value("ascrate75", prefs.ascrate75).toInt();
prefs.ascrate50 = s.value("ascrate50", prefs.ascrate50).toInt();
prefs.ascratestops = s.value("ascratestops", prefs.ascratestops).toInt();
@@ -418,6 +419,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
ui.display_transitions->setChecked(prefs.display_transitions);
ui.recreational_mode->setChecked(prefs.recreational_mode);
ui.safetystop->setChecked(prefs.safetystop);
+ ui.reserve_gas->setValue(prefs.reserve_gas / 1000);
ui.bottompo2->setValue(prefs.bottompo2 / 1000.0);
ui.decopo2->setValue(prefs.decopo2 / 1000.0);
ui.backgasBreaks->setChecked(prefs.doo2breaks);
@@ -433,6 +435,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
connect(ui.display_transitions, SIGNAL(toggled(bool)), plannerModel, SLOT(setDisplayTransitions(bool)));
connect(ui.safetystop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSafetyStop(bool)));
connect(ui.recreational_mode, SIGNAL(toggled(bool)), plannerModel, SLOT(setRecreationalMode(bool)));
+ connect(ui.reserve_gas, SIGNAL(valueChanged(int)), plannerModel, SLOT(setReserveGas(int)));
connect(ui.ascRate75, SIGNAL(valueChanged(int)), this, SLOT(setAscRate75(int)));
connect(ui.ascRate75, SIGNAL(valueChanged(int)), plannerModel, SLOT(emitDataChanged()));
connect(ui.ascRate50, SIGNAL(valueChanged(int)), this, SLOT(setAscRate50(int)));
@@ -482,6 +485,7 @@ PlannerSettingsWidget::~PlannerSettingsWidget()
s.setValue("display_transitions", prefs.display_transitions);
s.setValue("recreational_mode", prefs.recreational_mode);
s.setValue("safetystop", prefs.safetystop);
+ s.setValue("reserve_gas", prefs.reserve_gas);
s.setValue("ascrate75", prefs.ascrate75);
s.setValue("ascrate50", prefs.ascrate50);
s.setValue("ascratestops", prefs.ascratestops);
@@ -881,6 +885,12 @@ void DivePlannerPointsModel::setSafetyStop(bool value)
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS -1));
}
+void DivePlannerPointsModel::setReserveGas(int reserve)
+{
+ prefs.reserve_gas = reserve * 1000;
+ emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
+}
+
void DivePlannerPointsModel::setDropStoneMode(bool value)
{
prefs.drop_stone_mode = value;
diff --git a/qt-ui/diveplanner.h b/qt-ui/diveplanner.h
index a4752b502..6cfcc5efb 100644
--- a/qt-ui/diveplanner.h
+++ b/qt-ui/diveplanner.h
@@ -93,6 +93,7 @@ slots:
void loadFromDive(dive *d);
void emitDataChanged();
void setRebreatherMode(int mode);
+ void setReserveGas(int reserve);
signals:
void planCreated();
diff --git a/qt-ui/plannerSettings.ui b/qt-ui/plannerSettings.ui
index 961dce914..02d829c42 100644
--- a/qt-ui/plannerSettings.ui
+++ b/qt-ui/plannerSettings.ui
@@ -262,21 +262,21 @@
<property name="spacing">
<number>2</number>
</property>
- <item row="3" column="1">
+ <item row="6" column="1">
<widget class="QLabel" name="label_16">
<property name="text">
<string>GF high</string>
</property>
</widget>
</item>
- <item row="6" column="1" colspan="2">
+ <item row="9" column="1" colspan="2">
<widget class="QCheckBox" name="backgasBreaks">
<property name="text">
<string>Plan backgas breaks</string>
</property>
</widget>
</item>
- <item row="3" column="2">
+ <item row="6" column="2">
<widget class="QSpinBox" name="gfhigh">
<property name="suffix">
<string>%</string>
@@ -289,14 +289,14 @@
</property>
</widget>
</item>
- <item row="5" column="1" colspan="2">
+ <item row="8" column="1" colspan="2">
<widget class="QCheckBox" name="lastStop">
<property name="text">
<string>Last stop at 6m</string>
</property>
</widget>
</item>
- <item row="7" column="1">
+ <item row="10" column="1">
<widget class="QComboBox" name="rebreathermode">
<property name="currentText">
<string/>
@@ -306,7 +306,7 @@
</property>
</widget>
</item>
- <item row="2" column="2">
+ <item row="5" column="2">
<widget class="QSpinBox" name="gflow">
<property name="suffix">
<string>%</string>
@@ -319,14 +319,14 @@
</property>
</widget>
</item>
- <item row="4" column="1" colspan="2">
+ <item row="7" column="1" colspan="2">
<widget class="QCheckBox" name="drop_stone_mode">
<property name="text">
<string>Drop to first depth</string>
</property>
</widget>
</item>
- <item row="8" column="1">
+ <item row="11" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@@ -339,7 +339,7 @@
</property>
</spacer>
</item>
- <item row="2" column="1">
+ <item row="5" column="1">
<widget class="QLabel" name="label_15">
<property name="text">
<string>GF low</string>
@@ -363,6 +363,32 @@
</property>
</widget>
</item>
+ <item row="2" column="1">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Reserve gas</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QSpinBox" name="reserve_gas">
+ <property name="suffix">
+ <string>bar</string>
+ </property>
+ <property name="prefix">
+ <string/>
+ </property>
+ <property name="minimum">
+ <number>10</number>
+ </property>
+ <property name="maximum">
+ <number>99</number>
+ </property>
+ <property name="value">
+ <number>40</number>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
diff --git a/subsurfacestartup.c b/subsurfacestartup.c
index a5415c7c0..d7a7ede4d 100644
--- a/subsurfacestartup.c
+++ b/subsurfacestartup.c
@@ -54,6 +54,7 @@ struct preferences default_prefs = {
.safetystop = true,
.bottomsac = 20000,
.decosac = 17000,
+ .reserve_gas=40000,
.o2consumption = 720,
.pscr_ratio = 100,
.show_pictures_in_profile = true,