diff options
author | Robert C. Helling <helling@atdotde.de> | 2017-09-19 14:38:38 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-09-20 08:54:41 -0700 |
commit | 5b080beddef3e08b86eb53448e737b4867a50c1a (patch) | |
tree | d858d5d68a0b52b30f88d74f2bdf494418265bff | |
parent | a6f186279fcce9631623b94bfdc00fa3fd071b4c (diff) | |
download | subsurface-5b080beddef3e08b86eb53448e737b4867a50c1a.tar.gz |
Remove option to apply GFlow at maxdepth
This option should have never been there. This is not how
gradient factors are supposed to work. It would only trick
users to use the wrong value..
Signed-off-by: Robert C. Helling <helling@atdotde.de>
-rw-r--r-- | core/deco.c | 15 | ||||
-rw-r--r-- | core/dive.h | 2 | ||||
-rw-r--r-- | core/planner.c | 2 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.cpp | 23 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.h | 3 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_graph.cpp | 3 | ||||
-rw-r--r-- | desktop-widgets/preferences/preferences_graph.ui | 112 | ||||
-rw-r--r-- | qt-models/diveplannermodel.cpp | 2 | ||||
-rw-r--r-- | tests/testpreferences.cpp | 4 |
9 files changed, 61 insertions, 105 deletions
diff --git a/core/deco.c b/core/deco.c index d58e6dc0a..4871bfd75 100644 --- a/core/deco.c +++ b/core/deco.c @@ -45,7 +45,6 @@ struct buehlmann_config { double gf_high; //! gradient factor high (at surface). double gf_low; //! gradient factor low (at bottom/start of deco calculation). double gf_low_position_min; //! gf_low_position below surface_min_shallow. - bool gf_low_at_maxdepth; //! if true, gf_low applies at max. depth instead of at deepest ceiling. }; struct buehlmann_config buehlmann_config = { @@ -55,7 +54,6 @@ struct buehlmann_config buehlmann_config = { .gf_high = 0.75, .gf_low = 0.35, .gf_low_position_min = 1.0, - .gf_low_at_maxdepth = false }; //! Option structure for VPM-B decompression. @@ -252,10 +250,8 @@ double tissue_tolerance_calc(const struct dive *dive, double pressure) ((1.0 - deco_state->buehlmann_inertgas_b[ci]) * gf_low + deco_state->buehlmann_inertgas_b[ci]); if (tissue_lowest_ceiling[ci] > lowest_ceiling) lowest_ceiling = tissue_lowest_ceiling[ci]; - if (!buehlmann_config.gf_low_at_maxdepth) { - if (lowest_ceiling > deco_state->gf_low_pressure_this_dive) - deco_state->gf_low_pressure_this_dive = lowest_ceiling; - } + if (lowest_ceiling > deco_state->gf_low_pressure_this_dive) + deco_state->gf_low_pressure_this_dive = lowest_ceiling; } for (ci = 0; ci < 16; ci++) { double tolerated; @@ -498,9 +494,6 @@ void add_segment(double pressure, const struct gasmix *gasmix, int period_in_sec fill_pressures(&pressures, pressure - ((in_planner() && (decoMode() == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE), gasmix, (double) ccpo2 / 1000.0, dive->dc.divemode); - if (buehlmann_config.gf_low_at_maxdepth && pressure > deco_state->gf_low_pressure_this_dive) - deco_state->gf_low_pressure_this_dive = pressure; - for (ci = 0; ci < 16; ci++) { double pn2_oversat = pressures.n2 - deco_state->tissue_n2_sat[ci]; double phe_oversat = pressures.he - deco_state->tissue_he_sat[ci]; @@ -553,7 +546,6 @@ void clear_deco(double surface_pressure) deco_state->he_regen_radius[ci] = get_crit_radius_He(); } deco_state->gf_low_pressure_this_dive = surface_pressure; - if (!buehlmann_config.gf_low_at_maxdepth) deco_state->gf_low_pressure_this_dive += buehlmann_config.gf_low_position_min; deco_state->max_ambient_pressure = 0.0; } @@ -603,13 +595,12 @@ int deco_allowed_depth(double tissues_tolerance, double surface_pressure, struct return depth; } -void set_gf(short gflow, short gfhigh, bool gf_low_at_maxdepth) +void set_gf(short gflow, short gfhigh) { if (gflow != -1) buehlmann_config.gf_low = (double)gflow / 100.0; if (gfhigh != -1) buehlmann_config.gf_high = (double)gfhigh / 100.0; - buehlmann_config.gf_low_at_maxdepth = gf_low_at_maxdepth; } void set_vpmb_conservatism(short conservatism) diff --git a/core/dive.h b/core/dive.h index 43464118f..c5cc7cc4b 100644 --- a/core/dive.h +++ b/core/dive.h @@ -866,7 +866,7 @@ struct deco_state { extern void add_segment(double pressure, const struct gasmix *gasmix, int period_in_seconds, int setpoint, const struct dive *dive, int sac); extern void clear_deco(double surface_pressure); extern void dump_tissues(void); -extern void set_gf(short gflow, short gfhigh, bool gf_low_at_maxdepth); +extern void set_gf(short gflow, short gfhigh); extern void set_vpmb_conservatism(short conservatism); extern void cache_deco_state(struct deco_state **datap); extern void restore_deco_state(struct deco_state *data, bool keep_vpmb_state); diff --git a/core/planner.c b/core/planner.c index da6ed7d73..3ea829ba4 100644 --- a/core/planner.c +++ b/core/planner.c @@ -685,7 +685,7 @@ bool plan(struct diveplan *diveplan, struct dive *dive, int timestep, struct dec bool o2breaking = false; int decostopcounter = 0; - set_gf(diveplan->gflow, diveplan->gfhigh, prefs.gf_low_at_maxdepth); + set_gf(diveplan->gflow, diveplan->gfhigh); set_vpmb_conservatism(diveplan->vpmb_conservatism); if (!diveplan->surface_pressure) diveplan->surface_pressure = SURFACE_PRESSURE; diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp index 720a887d6..4fcb96580 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/core/subsurface-qt/SettingsObjectWrapper.cpp @@ -396,11 +396,6 @@ bool TechnicalDetailsSettings::showSac() const return prefs.show_sac; } -bool TechnicalDetailsSettings::gfLowAtMaxDepth() const -{ - return prefs.gf_low_at_maxdepth; -} - bool TechnicalDetailsSettings::displayUnusedTanks() const { return prefs.display_unused_tanks; @@ -561,7 +556,7 @@ void TechnicalDetailsSettings::setGflow(int value) s.beginGroup(group); s.setValue("gflow", value); prefs.gflow = value; - set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); + set_gf(prefs.gflow, prefs.gfhigh); emit gflowChanged(value); } @@ -574,7 +569,7 @@ void TechnicalDetailsSettings::setGfhigh(int value) s.beginGroup(group); s.setValue("gfhigh", value); prefs.gfhigh = value; - set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); + set_gf(prefs.gflow, prefs.gfhigh); emit gfhighChanged(value); } @@ -684,18 +679,6 @@ void TechnicalDetailsSettings::setShowSac(bool value) emit showSacChanged(value); } -void TechnicalDetailsSettings::setGfLowAtMaxDepth(bool value) -{ - if (value == prefs.gf_low_at_maxdepth) - return; - QSettings s; - s.beginGroup(group); - s.setValue("gf_low_at_maxdepth", value); - prefs.gf_low_at_maxdepth = value; - set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); - emit gfLowAtMaxDepthChanged(value); -} - void TechnicalDetailsSettings::setDisplayUnusedTanks(bool value) { if (value == prefs.display_unused_tanks) @@ -2244,7 +2227,7 @@ void SettingsObjectWrapper::load() GET_BOOL("show_ccr_setpoint",show_ccr_setpoint); GET_BOOL("show_ccr_sensors",show_ccr_sensors); GET_BOOL("zoomed_plot", zoomed_plot); - set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); + set_gf(prefs.gflow, prefs.gfhigh); set_vpmb_conservatism(prefs.vpmb_conservatism); GET_BOOL("show_sac", show_sac); GET_BOOL("display_unused_tanks", display_unused_tanks); diff --git a/core/subsurface-qt/SettingsObjectWrapper.h b/core/subsurface-qt/SettingsObjectWrapper.h index 824d1023d..bbc762e28 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.h +++ b/core/subsurface-qt/SettingsObjectWrapper.h @@ -133,7 +133,6 @@ class TechnicalDetailsSettings : public QObject { Q_PROPERTY(bool show_ccr_sensors READ showCCRSensors WRITE setShowCCRSensors NOTIFY showCCRSensorsChanged) Q_PROPERTY(bool zoomed_plot READ zoomedPlot WRITE setZoomedPlot NOTIFY zoomedPlotChanged) Q_PROPERTY(bool show_sac READ showSac WRITE setShowSac NOTIFY showSacChanged) - Q_PROPERTY(bool gf_low_at_maxdepth READ gfLowAtMaxDepth WRITE setGfLowAtMaxDepth NOTIFY gfLowAtMaxDepthChanged) Q_PROPERTY(bool display_unused_tanks READ displayUnusedTanks WRITE setDisplayUnusedTanks NOTIFY displayUnusedTanksChanged) Q_PROPERTY(bool show_average_depth READ showAverageDepth WRITE setShowAverageDepth NOTIFY showAverageDepthChanged) Q_PROPERTY(bool show_pictures_in_profile READ showPicturesInProfile WRITE setShowPicturesInProfile NOTIFY showPicturesInProfileChanged) @@ -163,7 +162,6 @@ public: bool showCCRSensors() const; bool zoomedPlot() const; bool showSac() const; - bool gfLowAtMaxDepth() const; bool displayUnusedTanks() const; bool showAverageDepth() const; bool showPicturesInProfile() const; @@ -191,7 +189,6 @@ public slots: void setShowCCRSensors(bool value); void setZoomedPlot(bool value); void setShowSac(bool value); - void setGfLowAtMaxDepth(bool value); void setDisplayUnusedTanks(bool value); void setShowAverageDepth(bool value); void setShowPicturesInProfile(bool value); diff --git a/desktop-widgets/preferences/preferences_graph.cpp b/desktop-widgets/preferences/preferences_graph.cpp index 703868cb8..f0bd408e1 100644 --- a/desktop-widgets/preferences/preferences_graph.cpp +++ b/desktop-widgets/preferences/preferences_graph.cpp @@ -38,7 +38,6 @@ void PreferencesGraph::refreshSettings() ui->gflow->setValue(prefs.gflow); ui->gfhigh->setValue(prefs.gfhigh); ui->vpmb_conservatism->setValue(prefs.vpmb_conservatism); - ui->gf_low_at_maxdepth->setChecked(prefs.gf_low_at_maxdepth); ui->show_ccr_setpoint->setChecked(prefs.show_ccr_setpoint); ui->show_ccr_sensors->setChecked(prefs.show_ccr_sensors); ui->defaultSetpoint->setValue((double)prefs.defaultsetpoint / 1000.0); @@ -69,7 +68,6 @@ void PreferencesGraph::syncSettings() tech->setGflow(ui->gflow->value()); tech->setGfhigh(ui->gfhigh->value()); tech->setVpmbConservatism(ui->vpmb_conservatism->value()); - tech->setGfLowAtMaxDepth(ui->gf_low_at_maxdepth->isChecked()); tech->setShowCCRSetpoint(ui->show_ccr_setpoint->isChecked()); tech->setShowCCRSensors(ui->show_ccr_sensors->isChecked()); tech->setDisplayUnusedTanks(ui->display_unused_tanks->isChecked()); @@ -93,7 +91,6 @@ void PreferencesGraph::on_buehlmann_toggled(bool buehlmann) ui->gflow->setEnabled(buehlmann); ui->label_GFhigh->setEnabled(buehlmann); ui->label_GFlow->setEnabled(buehlmann); - ui->gf_low_at_maxdepth->setEnabled(buehlmann); ui->vpmb_conservatism->setEnabled(!buehlmann); ui->label_VPMB->setEnabled(!buehlmann); } diff --git a/desktop-widgets/preferences/preferences_graph.ui b/desktop-widgets/preferences/preferences_graph.ui index c3920609f..6e037698b 100644 --- a/desktop-widgets/preferences/preferences_graph.ui +++ b/desktop-widgets/preferences/preferences_graph.ui @@ -6,7 +6,7 @@ <rect> <x>0</x> <y>0</y> - <width>650</width> + <width>655</width> <height>634</height> </rect> </property> @@ -178,23 +178,23 @@ <string>Ceiling display setup</string> </property> <layout class="QGridLayout" name="gridLayout_3"> - <item row="2" column="1"> - <widget class="QLabel" name="label_VPMB"> + <item row="3" column="3"> + <widget class="QLabel" name="label_GFhigh"> <property name="text"> - <string>Conservatism level</string> + <string>GFHigh</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_22"> - <property name="enabled"> - <bool>true</bool> + <item row="4" column="4"> + <widget class="QSpinBox" name="pscrfactor"> + <property name="suffix"> + <string/> </property> - <property name="text"> - <string>Algorithm for calculated ceiling:</string> + <property name="prefix"> + <string>1:</string> </property> </widget> </item> @@ -208,46 +208,26 @@ </property> </widget> </item> - <item row="0" column="0" colspan="2"> - <widget class="QCheckBox" name="red_ceiling"> + <item row="1" column="0"> + <widget class="QLabel" name="label_22"> <property name="enabled"> <bool>true</bool> </property> <property name="text"> - <string>Draw dive computer reported ceiling red</string> - </property> - </widget> - </item> - <item row="5" column="4"> - <widget class="QSpinBox" name="pscrfactor"> - <property name="suffix"> - <string/> - </property> - <property name="prefix"> - <string>1:</string> + <string>Algorithm for calculated ceiling:</string> </property> </widget> </item> - <item row="3" column="3"> - <widget class="QLabel" name="label_GFhigh"> + <item row="4" column="3"> + <widget class="QLabel" name="label_28"> <property name="text"> - <string>GFHigh</string> + <string>Dilution ratio</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> </item> - <item row="5" column="2"> - <widget class="QDoubleSpinBox" name="psro2rate"> - <property name="suffix"> - <string>ℓ/min</string> - </property> - <property name="decimals"> - <number>3</number> - </property> - </widget> - </item> <item row="3" column="2"> <widget class="QSpinBox" name="gflow"> <property name="suffix"> @@ -261,33 +241,16 @@ </property> </widget> </item> - <item row="5" column="1"> - <widget class="QLabel" name="MetabolicRate"> - <property name="text"> - <string>Metabolic rate O₂</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - </item> - <item row="5" column="3"> - <widget class="QLabel" name="label_28"> + <item row="2" column="1"> + <widget class="QLabel" name="label_VPMB"> <property name="text"> - <string>Dilution ratio</string> + <string>Conservatism level</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> </item> - <item row="4" column="2" colspan="2"> - <widget class="QCheckBox" name="gf_low_at_maxdepth"> - <property name="text"> - <string>GFLow at max. depth</string> - </property> - </widget> - </item> <item row="2" column="2"> <widget class="QSpinBox" name="vpmb_conservatism"> <property name="prefix"> @@ -301,10 +264,33 @@ </property> </widget> </item> - <item row="5" column="0"> - <widget class="QLabel" name="pSCR"> + <item row="4" column="1"> + <widget class="QLabel" name="MetabolicRate"> <property name="text"> - <string>pSCR options:</string> + <string>Metabolic rate O₂</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item row="0" column="0" colspan="2"> + <widget class="QCheckBox" name="red_ceiling"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>Draw dive computer reported ceiling red</string> + </property> + </widget> + </item> + <item row="4" column="2"> + <widget class="QDoubleSpinBox" name="psro2rate"> + <property name="suffix"> + <string>ℓ/min</string> + </property> + <property name="decimals"> + <number>3</number> </property> </widget> </item> @@ -328,6 +314,13 @@ </property> </widget> </item> + <item row="4" column="0"> + <widget class="QLabel" name="pSCR"> + <property name="text"> + <string>pSCR options:</string> + </property> + </widget> + </item> <item row="3" column="1"> <widget class="QLabel" name="label_GFlow"> <property name="text"> @@ -394,7 +387,6 @@ <tabstop>buehlmann</tabstop> <tabstop>gflow</tabstop> <tabstop>gfhigh</tabstop> - <tabstop>gf_low_at_maxdepth</tabstop> <tabstop>psro2rate</tabstop> <tabstop>pscrfactor</tabstop> <tabstop>display_unused_tanks</tabstop> diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index e65bb01eb..ca84fd597 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -208,7 +208,7 @@ void DivePlannerPointsModel::setPlanMode(Mode m) // the planner may reset our GF settings that are used to show deco // reset them to what's in the preferences if (m != PLAN) { - set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); + set_gf(prefs.gflow, prefs.gfhigh); set_vpmb_conservatism(prefs.vpmb_conservatism); } } diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp index db50aff5d..a80ade89f 100644 --- a/tests/testpreferences.cpp +++ b/tests/testpreferences.cpp @@ -132,8 +132,6 @@ void TestPreferences::testPreferences() TEST(tecDetails->zoomedPlot(), true); tecDetails->setShowSac(true); TEST(tecDetails->showSac(), true); - tecDetails->setGfLowAtMaxDepth(true); - TEST(tecDetails->gfLowAtMaxDepth(), true); tecDetails->setDisplayUnusedTanks(true); TEST(tecDetails->displayUnusedTanks(), true); tecDetails->setShowAverageDepth(true); @@ -175,8 +173,6 @@ void TestPreferences::testPreferences() TEST(tecDetails->zoomedPlot(), false); tecDetails->setShowSac(false); TEST(tecDetails->showSac(), false); - tecDetails->setGfLowAtMaxDepth(false); - TEST(tecDetails->gfLowAtMaxDepth(), false); tecDetails->setDisplayUnusedTanks(false); TEST(tecDetails->displayUnusedTanks(), false); tecDetails->setShowAverageDepth(false); |