Separate VPM-B conservatism preference for planner and profile

Separate the VPM-B conservatism preference into diveplan.vpmb_conservatism for
planning dives and prefs.vpmb_conservatism for profile ceiling display of
saved dives.

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Rick Walsh 2016-09-24 18:02:08 +10:00 committed by Dirk Hohndel
parent 7b891904e7
commit 7e09a6c7bc
11 changed files with 92 additions and 49 deletions

View file

@ -10,6 +10,7 @@
* add_segment() - add <seconds> at the given pressure, breathing gasmix * add_segment() - add <seconds> at the given pressure, breathing gasmix
* deco_allowed_depth() - ceiling based on lead tissue, surface pressure, 3m increments or smooth * deco_allowed_depth() - ceiling based on lead tissue, surface pressure, 3m increments or smooth
* set_gf() - set Buehlmann gradient factors * set_gf() - set Buehlmann gradient factors
* set_vpmb_conservatism() - set VPM-B conservatism value
* clear_deco() * clear_deco()
* cache_deco_state() * cache_deco_state()
* restore_deco_state() * restore_deco_state()
@ -63,6 +64,7 @@ struct vpmb_config {
double skin_compression_gammaC; //! Skin compression gammaC (N / bar = m2). double skin_compression_gammaC; //! Skin compression gammaC (N / bar = m2).
double regeneration_time; //! Time needed for the bubble to regenerate to the start radius (min). double regeneration_time; //! Time needed for the bubble to regenerate to the start radius (min).
double other_gases_pressure; //! Always present pressure of other gasses in tissues (bar). double other_gases_pressure; //! Always present pressure of other gasses in tissues (bar).
short conservatism; //! VPM-B conservatism level (0-4)
}; };
struct vpmb_config vpmb_config = { struct vpmb_config vpmb_config = {
@ -73,7 +75,8 @@ struct vpmb_config vpmb_config = {
.surface_tension_gamma = 0.18137175, // = 0.0179 N/msw .surface_tension_gamma = 0.18137175, // = 0.0179 N/msw
.skin_compression_gammaC = 2.6040525, // = 0.257 N/msw .skin_compression_gammaC = 2.6040525, // = 0.257 N/msw
.regeneration_time = 20160.0, .regeneration_time = 20160.0,
.other_gases_pressure = 0.1359888 .other_gases_pressure = 0.1359888,
.conservatism = 3
}; };
const double buehlmann_N2_a[] = { 1.1696, 1.0, 0.8618, 0.7562, const double buehlmann_N2_a[] = { 1.1696, 1.0, 0.8618, 0.7562,
@ -121,7 +124,7 @@ const double buehlmann_He_factor_expositon_one_second[] = {
1.00198406028040E-004, 7.83611475491108E-005, 6.13689891868496E-005, 4.81280465299827E-005 1.00198406028040E-004, 7.83611475491108E-005, 6.13689891868496E-005, 4.81280465299827E-005
}; };
const double conservatism_lvls[] = { 1.0, 1.05, 1.12, 1.22, 1.35 }; const double vpmb_conservatism_lvls[] = { 1.0, 1.05, 1.12, 1.22, 1.35 };
/* Inspired gas loading equations depend on the partial pressure of inert gas in the alveolar. /* Inspired gas loading equations depend on the partial pressure of inert gas in the alveolar.
* P_alv = (P_amb - P_H2O + (1 - Rq) / Rq * P_CO2) * f * P_alv = (P_amb - P_H2O + (1 - Rq) / Rq * P_CO2) * f
@ -174,15 +177,15 @@ double initial_he_gradient[16];
double get_crit_radius_He() double get_crit_radius_He()
{ {
if (prefs.vpmb_conservatism <= 4) if (vpmb_config.conservatism <= 4)
return vpmb_config.crit_radius_He * conservatism_lvls[prefs.vpmb_conservatism] * subsurface_conservatism_factor; return vpmb_config.crit_radius_He * vpmb_conservatism_lvls[vpmb_config.conservatism] * subsurface_conservatism_factor;
return vpmb_config.crit_radius_He; return vpmb_config.crit_radius_He;
} }
double get_crit_radius_N2() double get_crit_radius_N2()
{ {
if (prefs.vpmb_conservatism <= 4) if (vpmb_config.conservatism <= 4)
return vpmb_config.crit_radius_N2 * conservatism_lvls[prefs.vpmb_conservatism] * subsurface_conservatism_factor; return vpmb_config.crit_radius_N2 * vpmb_conservatism_lvls[vpmb_config.conservatism] * subsurface_conservatism_factor;
return vpmb_config.crit_radius_N2; return vpmb_config.crit_radius_N2;
} }
@ -603,3 +606,13 @@ void set_gf(short gflow, short gfhigh, bool gf_low_at_maxdepth)
buehlmann_config.gf_high = (double)gfhigh / 100.0; buehlmann_config.gf_high = (double)gfhigh / 100.0;
buehlmann_config.gf_low_at_maxdepth = gf_low_at_maxdepth; buehlmann_config.gf_low_at_maxdepth = gf_low_at_maxdepth;
} }
void set_vpmb_conservatism(short conservatism)
{
if (conservatism < 0)
vpmb_config.conservatism = 0;
else if (conservatism > 4)
vpmb_config.conservatism = 4;
else
vpmb_config.conservatism = conservatism;
}

View file

@ -831,6 +831,7 @@ extern void add_segment(double pressure, const struct gasmix *gasmix, int period
extern void clear_deco(double surface_pressure); extern void clear_deco(double surface_pressure);
extern void dump_tissues(void); 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, bool gf_low_at_maxdepth);
extern void set_vpmb_conservatism(short conservatism);
extern void cache_deco_state(char **datap); extern void cache_deco_state(char **datap);
extern void restore_deco_state(char *data); extern void restore_deco_state(char *data);
extern void nuclear_regeneration(double time); extern void nuclear_regeneration(double time);
@ -856,6 +857,7 @@ struct diveplan {
int salinity; int salinity;
short gflow; short gflow;
short gfhigh; short gfhigh;
short vpmb_conservatism;
struct divedatapoint *dp; struct divedatapoint *dp;
}; };

View file

@ -565,10 +565,10 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
snprintf(temp, sz_temp, translate("gettextFromC", "based on Bühlmann ZHL-16C with GFlow = %d and GFhigh = %d"), snprintf(temp, sz_temp, translate("gettextFromC", "based on Bühlmann ZHL-16C with GFlow = %d and GFhigh = %d"),
diveplan->gflow, diveplan->gfhigh); diveplan->gflow, diveplan->gfhigh);
} else if (prefs.deco_mode == VPMB){ } else if (prefs.deco_mode == VPMB){
if (prefs.vpmb_conservatism == 0) if (diveplan->vpmb_conservatism == 0)
snprintf(temp, sz_temp, "%s", translate("gettextFromC", "based on VPM-B at nominal conservatism")); snprintf(temp, sz_temp, "%s", translate("gettextFromC", "based on VPM-B at nominal conservatism"));
else else
snprintf(temp, sz_temp, translate("gettextFromC", "based on VPM-B at +%d conservatism"), prefs.vpmb_conservatism); snprintf(temp, sz_temp, translate("gettextFromC", "based on VPM-B at +%d conservatism"), diveplan->vpmb_conservatism);
} else if (prefs.deco_mode == RECREATIONAL){ } else if (prefs.deco_mode == RECREATIONAL){
snprintf(temp, sz_temp, translate("gettextFromC", "recreational mode based on Bühlmann ZHL-16B with GFlow = %d and GFhigh = %d"), snprintf(temp, sz_temp, translate("gettextFromC", "recreational mode based on Bühlmann ZHL-16B with GFlow = %d and GFhigh = %d"),
diveplan->gflow, diveplan->gfhigh); diveplan->gflow, diveplan->gfhigh);
@ -984,6 +984,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
bool decodive = false; bool decodive = false;
set_gf(diveplan->gflow, diveplan->gfhigh, prefs.gf_low_at_maxdepth); set_gf(diveplan->gflow, diveplan->gfhigh, prefs.gf_low_at_maxdepth);
set_vpmb_conservatism(diveplan->vpmb_conservatism);
if (!diveplan->surface_pressure) if (!diveplan->surface_pressure)
diveplan->surface_pressure = SURFACE_PRESSURE; diveplan->surface_pressure = SURFACE_PRESSURE;
displayed_dive.surface_pressure.mbar = diveplan->surface_pressure; displayed_dive.surface_pressure.mbar = diveplan->surface_pressure;

View file

@ -311,6 +311,11 @@ int TechnicalDetailsSettings::gfhigh() const
return prefs.gfhigh; return prefs.gfhigh;
} }
short TechnicalDetailsSettings::vpmbConservatism() const
{
return prefs.vpmb_conservatism;
}
bool TechnicalDetailsSettings::hrgraph() const bool TechnicalDetailsSettings::hrgraph() const
{ {
return prefs.hrgraph; return prefs.hrgraph;
@ -522,6 +527,19 @@ void TechnicalDetailsSettings::setGfhigh(int value)
emit gfhighChanged(value); emit gfhighChanged(value);
} }
void TechnicalDetailsSettings::setVpmbConservatism(short value)
{
if (value == prefs.vpmb_conservatism)
return;
QSettings s;
s.beginGroup(tecDetails);
s.setValue("vpmb_conservatism", value);
prefs.vpmb_conservatism = value;
set_vpmb_conservatism(value);
emit vpmbConservatismChanged(value);
}
void TechnicalDetailsSettings::setHRgraph(bool value) void TechnicalDetailsSettings::setHRgraph(bool value)
{ {
if (value == prefs.hrgraph) if (value == prefs.hrgraph)
@ -1229,11 +1247,6 @@ int DivePlannerSettings::decoSac() const
return prefs.decosac; return prefs.decosac;
} }
short DivePlannerSettings::vpmbConservatism() const
{
return prefs.vpmb_conservatism;
}
deco_mode DivePlannerSettings::decoMode() const deco_mode DivePlannerSettings::decoMode() const
{ {
return prefs.deco_mode; return prefs.deco_mode;
@ -1484,18 +1497,6 @@ void DivePlannerSettings::setSecoSac(int value)
emit decoSacChanged(value); emit decoSacChanged(value);
} }
void DivePlannerSettings::setVpmbConservatism(int value)
{
if (value == prefs.vpmb_conservatism)
return;
QSettings s;
s.beginGroup(group);
s.setValue("conservatism", value);
prefs.vpmb_conservatism = value;
emit vpmbConservatismChanged(value);
}
void DivePlannerSettings::setDecoMode(deco_mode value) void DivePlannerSettings::setDecoMode(deco_mode value)
{ {
if (value == prefs.deco_mode) if (value == prefs.deco_mode)
@ -2119,11 +2120,13 @@ void SettingsObjectWrapper::load()
GET_BOOL("percentagegraph", percentagegraph); GET_BOOL("percentagegraph", percentagegraph);
GET_INT("gflow", gflow); GET_INT("gflow", gflow);
GET_INT("gfhigh", gfhigh); GET_INT("gfhigh", gfhigh);
GET_INT("vpmb_conservatism", vpmb_conservatism);
GET_BOOL("gf_low_at_maxdepth", gf_low_at_maxdepth); GET_BOOL("gf_low_at_maxdepth", gf_low_at_maxdepth);
GET_BOOL("show_ccr_setpoint",show_ccr_setpoint); GET_BOOL("show_ccr_setpoint",show_ccr_setpoint);
GET_BOOL("show_ccr_sensors",show_ccr_sensors); GET_BOOL("show_ccr_sensors",show_ccr_sensors);
GET_BOOL("zoomed_plot", zoomed_plot); GET_BOOL("zoomed_plot", zoomed_plot);
set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth);
set_vpmb_conservatism(prefs.vpmb_conservatism);
GET_BOOL("show_sac", show_sac); GET_BOOL("show_sac", show_sac);
GET_BOOL("display_unused_tanks", display_unused_tanks); GET_BOOL("display_unused_tanks", display_unused_tanks);
GET_BOOL("show_average_depth", show_average_depth); GET_BOOL("show_average_depth", show_average_depth);
@ -2259,7 +2262,6 @@ void SettingsObjectWrapper::load()
prefs.drop_stone_mode = s.value("drop_stone_mode", prefs.drop_stone_mode).toBool(); prefs.drop_stone_mode = s.value("drop_stone_mode", prefs.drop_stone_mode).toBool();
prefs.bottomsac = s.value("bottomsac", prefs.bottomsac).toInt(); prefs.bottomsac = s.value("bottomsac", prefs.bottomsac).toInt();
prefs.decosac = s.value("decosac", prefs.decosac).toInt(); prefs.decosac = s.value("decosac", prefs.decosac).toInt();
prefs.vpmb_conservatism = s.value("conservatism", prefs.vpmb_conservatism).toInt();
s.endGroup(); s.endGroup();
s.beginGroup("UpdateManager"); s.beginGroup("UpdateManager");
@ -2296,7 +2298,6 @@ void SettingsObjectWrapper::sync()
s.setValue("bottomsac", prefs.bottomsac); s.setValue("bottomsac", prefs.bottomsac);
s.setValue("decosac", prefs.decosac); s.setValue("decosac", prefs.decosac);
s.setValue("deco_mode", int(prefs.deco_mode)); s.setValue("deco_mode", int(prefs.deco_mode));
s.setValue("conservatism", prefs.vpmb_conservatism);
s.endGroup(); s.endGroup();
} }

View file

@ -116,6 +116,7 @@ class TechnicalDetailsSettings : public QObject {
Q_PROPERTY(bool calcndltts READ calcndltts WRITE setCalcndltts NOTIFY calcndlttsChanged) Q_PROPERTY(bool calcndltts READ calcndltts WRITE setCalcndltts NOTIFY calcndlttsChanged)
Q_PROPERTY(int gflow READ gflow WRITE setGflow NOTIFY gflowChanged) Q_PROPERTY(int gflow READ gflow WRITE setGflow NOTIFY gflowChanged)
Q_PROPERTY(int gfhigh READ gfhigh WRITE setGfhigh NOTIFY gfhighChanged) Q_PROPERTY(int gfhigh READ gfhigh WRITE setGfhigh NOTIFY gfhighChanged)
Q_PROPERTY(short vpmb_conservatism READ vpmbConservatism WRITE setVpmbConservatism NOTIFY vpmbConservatismChanged)
Q_PROPERTY(bool hrgraph READ hrgraph WRITE setHRgraph NOTIFY hrgraphChanged) Q_PROPERTY(bool hrgraph READ hrgraph WRITE setHRgraph NOTIFY hrgraphChanged)
Q_PROPERTY(bool tankbar READ tankBar WRITE setTankBar NOTIFY tankBarChanged) Q_PROPERTY(bool tankbar READ tankBar WRITE setTankBar NOTIFY tankBarChanged)
Q_PROPERTY(bool percentagegraph READ percentageGraph WRITE setPercentageGraph NOTIFY percentageGraphChanged) Q_PROPERTY(bool percentagegraph READ percentageGraph WRITE setPercentageGraph NOTIFY percentageGraphChanged)
@ -142,6 +143,7 @@ public:
bool calcndltts() const; bool calcndltts() const;
int gflow() const; int gflow() const;
int gfhigh() const; int gfhigh() const;
short vpmbConservatism() const;
bool hrgraph() const; bool hrgraph() const;
bool tankBar() const; bool tankBar() const;
bool percentageGraph() const; bool percentageGraph() const;
@ -167,6 +169,7 @@ public slots:
void setCalcndltts(bool value); void setCalcndltts(bool value);
void setGflow(int value); void setGflow(int value);
void setGfhigh(int value); void setGfhigh(int value);
void setVpmbConservatism(short);
void setHRgraph(bool value); void setHRgraph(bool value);
void setTankBar(bool value); void setTankBar(bool value);
void setPercentageGraph(bool value); void setPercentageGraph(bool value);
@ -192,6 +195,7 @@ signals:
void calcndlttsChanged(bool value); void calcndlttsChanged(bool value);
void gflowChanged(int value); void gflowChanged(int value);
void gfhighChanged(int value); void gfhighChanged(int value);
void vpmbConservatismChanged(short value);
void hrgraphChanged(bool value); void hrgraphChanged(bool value);
void tankBarChanged(bool value); void tankBarChanged(bool value);
void percentageGraphChanged(bool value); void percentageGraphChanged(bool value);
@ -391,7 +395,6 @@ class DivePlannerSettings : public QObject {
Q_PROPERTY(int min_switch_duration READ minSwitchDuration WRITE setMinSwitchDuration NOTIFY minSwitchDurationChanged) Q_PROPERTY(int min_switch_duration READ minSwitchDuration WRITE setMinSwitchDuration NOTIFY minSwitchDurationChanged)
Q_PROPERTY(int bottomsac READ bottomSac WRITE setBottomSac NOTIFY bottomSacChanged) Q_PROPERTY(int bottomsac READ bottomSac WRITE setBottomSac NOTIFY bottomSacChanged)
Q_PROPERTY(int decosac READ decoSac WRITE setSecoSac NOTIFY decoSacChanged) Q_PROPERTY(int decosac READ decoSac WRITE setSecoSac NOTIFY decoSacChanged)
Q_PROPERTY(short vpmb_conservatism READ vpmbConservatism WRITE setVpmbConservatism NOTIFY vpmbConservatismChanged)
Q_PROPERTY(deco_mode decoMode READ decoMode WRITE setDecoMode NOTIFY decoModeChanged) Q_PROPERTY(deco_mode decoMode READ decoMode WRITE setDecoMode NOTIFY decoModeChanged)
public: public:
@ -417,7 +420,6 @@ public:
int minSwitchDuration() const; int minSwitchDuration() const;
int bottomSac() const; int bottomSac() const;
int decoSac() const; int decoSac() const;
short vpmbConservatism() const;
deco_mode decoMode() const; deco_mode decoMode() const;
public slots: public slots:
@ -442,7 +444,6 @@ public slots:
void setMinSwitchDuration(int value); void setMinSwitchDuration(int value);
void setBottomSac(int value); void setBottomSac(int value);
void setSecoSac(int value); void setSecoSac(int value);
void setVpmbConservatism(int value);
void setDecoMode(deco_mode value); void setDecoMode(deco_mode value);
signals: signals:
@ -467,7 +468,6 @@ signals:
void minSwitchDurationChanged(int value); void minSwitchDurationChanged(int value);
void bottomSacChanged(int value); void bottomSacChanged(int value);
void decoSacChanged(int value); void decoSacChanged(int value);
void vpmbConservatismChanged(int value);
void decoModeChanged(deco_mode value); void decoModeChanged(deco_mode value);
private: private:

View file

@ -237,7 +237,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.bottompo2->setDisabled(true); ui.bottompo2->setDisabled(true);
ui.decopo2->setDisabled(true); ui.decopo2->setDisabled(true);
ui.reserve_gas->setDisabled(false); ui.reserve_gas->setDisabled(false);
ui.conservatism_lvl->setDisabled(true); ui.vpmb_conservatism->setDisabled(true);
ui.switch_at_req_stop->setDisabled(true); ui.switch_at_req_stop->setDisabled(true);
ui.min_switch_duration->setDisabled(true); ui.min_switch_duration->setDisabled(true);
} }
@ -249,7 +249,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.bottompo2->setDisabled(false); ui.bottompo2->setDisabled(false);
ui.decopo2->setDisabled(false); ui.decopo2->setDisabled(false);
ui.reserve_gas->setDisabled(true); ui.reserve_gas->setDisabled(true);
ui.conservatism_lvl->setDisabled(false); ui.vpmb_conservatism->setDisabled(false);
ui.switch_at_req_stop->setDisabled(false); ui.switch_at_req_stop->setDisabled(false);
ui.min_switch_duration->setDisabled(false); ui.min_switch_duration->setDisabled(false);
} }
@ -261,7 +261,7 @@ void PlannerSettingsWidget::disableDecoElements(int mode)
ui.bottompo2->setDisabled(false); ui.bottompo2->setDisabled(false);
ui.decopo2->setDisabled(false); ui.decopo2->setDisabled(false);
ui.reserve_gas->setDisabled(true); ui.reserve_gas->setDisabled(true);
ui.conservatism_lvl->setDisabled(true); ui.vpmb_conservatism->setDisabled(true);
ui.switch_at_req_stop->setDisabled(false); ui.switch_at_req_stop->setDisabled(false);
ui.min_switch_duration->setDisabled(false); ui.min_switch_duration->setDisabled(false);
} }
@ -296,7 +296,6 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
ui.recreational_deco->setChecked(prefs.deco_mode == RECREATIONAL); ui.recreational_deco->setChecked(prefs.deco_mode == RECREATIONAL);
ui.buehlmann_deco->setChecked(prefs.deco_mode == BUEHLMANN); ui.buehlmann_deco->setChecked(prefs.deco_mode == BUEHLMANN);
ui.vpmb_deco->setChecked(prefs.deco_mode == VPMB); ui.vpmb_deco->setChecked(prefs.deco_mode == VPMB);
ui.conservatism_lvl->setValue(prefs.vpmb_conservatism);
disableDecoElements((int) prefs.deco_mode); disableDecoElements((int) prefs.deco_mode);
// should be the same order as in dive_comp_type! // should be the same order as in dive_comp_type!
@ -330,7 +329,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int))); connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
connect(ui.gfhigh, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFHigh())); connect(ui.gfhigh, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFHigh()));
connect(ui.gflow, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFLow())); connect(ui.gflow, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFLow()));
connect(ui.conservatism_lvl, SIGNAL(valueChanged(int)), plannerModel, SLOT(setVpmbConservatism(int))); connect(ui.vpmb_conservatism, SIGNAL(valueChanged(int)), plannerModel, SLOT(setVpmbConservatism(int)));
connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool))); connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool)));
connect(ui.switch_at_req_stop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSwitchAtReqStop(bool))); connect(ui.switch_at_req_stop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSwitchAtReqStop(bool)));
connect(ui.min_switch_duration, SIGNAL(valueChanged(int)), plannerModel, SLOT(setMinSwitchDuration(int))); connect(ui.min_switch_duration, SIGNAL(valueChanged(int)), plannerModel, SLOT(setMinSwitchDuration(int)));
@ -354,6 +353,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
settingsChanged(); settingsChanged();
ui.gflow->setValue(prefs.gflow); ui.gflow->setValue(prefs.gflow);
ui.gfhigh->setValue(prefs.gfhigh); ui.gfhigh->setValue(prefs.gfhigh);
ui.vpmb_conservatism->setValue(prefs.vpmb_conservatism);
setMinimumWidth(0); setMinimumWidth(0);
setMinimumHeight(0); setMinimumHeight(0);

View file

@ -500,7 +500,7 @@
</widget> </widget>
</item> </item>
<item row="12" column="2"> <item row="12" column="2">
<widget class="QSpinBox" name="conservatism_lvl"> <widget class="QSpinBox" name="vpmb_conservatism">
<property name="maximum"> <property name="maximum">
<number>4</number> <number>4</number>
</property> </property>

View file

@ -27,6 +27,7 @@ void PreferencesGraph::refreshSettings()
ui->gflow->setValue(prefs.gflow); ui->gflow->setValue(prefs.gflow);
ui->gfhigh->setValue(prefs.gfhigh); ui->gfhigh->setValue(prefs.gfhigh);
ui->vpmb_conservatism->setValue(prefs.vpmb_conservatism);
ui->gf_low_at_maxdepth->setChecked(prefs.gf_low_at_maxdepth); ui->gf_low_at_maxdepth->setChecked(prefs.gf_low_at_maxdepth);
ui->show_ccr_setpoint->setChecked(prefs.show_ccr_setpoint); ui->show_ccr_setpoint->setChecked(prefs.show_ccr_setpoint);
ui->show_ccr_sensors->setChecked(prefs.show_ccr_sensors); ui->show_ccr_sensors->setChecked(prefs.show_ccr_sensors);
@ -55,6 +56,7 @@ void PreferencesGraph::syncSettings()
tech->setRedceiling(ui->red_ceiling->isChecked()); tech->setRedceiling(ui->red_ceiling->isChecked());
tech->setGflow(ui->gflow->value()); tech->setGflow(ui->gflow->value());
tech->setGfhigh(ui->gfhigh->value()); tech->setGfhigh(ui->gfhigh->value());
tech->setVpmbConservatism(ui->vpmb_conservatism->value());
tech->setGfLowAtMaxDepth(ui->gf_low_at_maxdepth->isChecked()); tech->setGfLowAtMaxDepth(ui->gf_low_at_maxdepth->isChecked());
tech->setShowCCRSetpoint(ui->show_ccr_setpoint->isChecked()); tech->setShowCCRSetpoint(ui->show_ccr_setpoint->isChecked());
tech->setShowCCRSensors(ui->show_ccr_sensors->isChecked()); tech->setShowCCRSensors(ui->show_ccr_sensors->isChecked());

View file

@ -168,13 +168,33 @@
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_21">
<property name="text">
<string>VPM-B Conservatism</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="vpmb_conservatism">
<property name="prefix">
<string>+</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>4</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_26"> <widget class="QLabel" name="label_26">
<property name="text"> <property name="text">
<string>Default CCR set-point for dive planning</string> <string>Default CCR set-point for dive planning</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="3" column="1">
<widget class="QDoubleSpinBox" name="defaultSetpoint"> <widget class="QDoubleSpinBox" name="defaultSetpoint">
<property name="suffix"> <property name="suffix">
<string>bar</string> <string>bar</string>
@ -190,14 +210,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="0">
<widget class="QLabel" name="pSCR"> <widget class="QLabel" name="pSCR">
<property name="text"> <property name="text">
<string>pSCR O₂ metabolism rate</string> <string>pSCR O₂ metabolism rate</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<widget class="QDoubleSpinBox" name="psro2rate"> <widget class="QDoubleSpinBox" name="psro2rate">
<property name="suffix"> <property name="suffix">
<string>/min</string> <string>/min</string>
@ -207,14 +227,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="5" column="0">
<widget class="QLabel" name="label_28"> <widget class="QLabel" name="label_28">
<property name="text"> <property name="text">
<string>pSCR ratio</string> <string>pSCR ratio</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="5" column="1">
<widget class="QSpinBox" name="pscrfactor"> <widget class="QSpinBox" name="pscrfactor">
<property name="suffix"> <property name="suffix">
<string/> <string/>
@ -224,21 +244,21 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="2"> <item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="gf_low_at_maxdepth"> <widget class="QCheckBox" name="gf_low_at_maxdepth">
<property name="text"> <property name="text">
<string>GFLow at max depth</string> <string>GFLow at max depth</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="0" colspan="2"> <item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="show_ccr_setpoint"> <widget class="QCheckBox" name="show_ccr_setpoint">
<property name="text"> <property name="text">
<string>CCR: show setpoints when viewing pO₂</string> <string>CCR: show setpoints when viewing pO₂</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="0" colspan="2"> <item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="show_ccr_sensors"> <widget class="QCheckBox" name="show_ccr_sensors">
<property name="text"> <property name="text">
<string>CCR: show individual O₂ sensor values when viewing pO₂</string> <string>CCR: show individual O₂ sensor values when viewing pO₂</string>

View file

@ -571,7 +571,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
return; return;
} }
if (prefs.deco_mode == VPMB) if (prefs.deco_mode == VPMB)
decoModelParameters->setText(QString("VPM-B +%1").arg(prefs.vpmb_conservatism)); decoModelParameters->setText(QString("VPM-B +%1").arg(diveplan.vpmb_conservatism));
else else
decoModelParameters->setText(QString("GF %1/%2").arg(diveplan.gflow).arg(diveplan.gfhigh)); decoModelParameters->setText(QString("GF %1/%2").arg(diveplan.gflow).arg(diveplan.gfhigh));
#endif #endif

View file

@ -185,8 +185,10 @@ void DivePlannerPointsModel::setPlanMode(Mode m)
mode = m; mode = m;
// the planner may reset our GF settings that are used to show deco // the planner may reset our GF settings that are used to show deco
// reset them to what's in the preferences // reset them to what's in the preferences
if (m != PLAN) if (m != PLAN) {
set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth);
set_vpmb_conservatism(prefs.vpmb_conservatism);
}
} }
bool DivePlannerPointsModel::isPlanner() bool DivePlannerPointsModel::isPlanner()
@ -423,8 +425,10 @@ void DivePlannerPointsModel::triggerGFLow()
void DivePlannerPointsModel::setVpmbConservatism(int level) void DivePlannerPointsModel::setVpmbConservatism(int level)
{ {
prefs.vpmb_conservatism = level; if (diveplan.vpmb_conservatism != level) {
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1)); diveplan.vpmb_conservatism = level;
emitDataChanged();
}
} }
void DivePlannerPointsModel::setSurfacePressure(int pressure) void DivePlannerPointsModel::setSurfacePressure(int pressure)