From 9c8fbe494db231b59c2e072b54af85bc217c00d8 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Tue, 29 Oct 2019 17:57:34 +0100 Subject: Planner: Add option to treat O2 as narcotic When computing the best mix for a target depth, for helium, one can either require that the partial pressure of N2 is the same as at the target depth or the partial pressure of N2 plus O2. Signed-off-by: Robert C. Helling --- desktop-widgets/diveplanner.cpp | 9 ++ desktop-widgets/diveplanner.h | 1 + desktop-widgets/plannerSettings.ui | 168 ++++++++++++++++++++----------------- 3 files changed, 99 insertions(+), 79 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index 33caffd0d..663bb03fb 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -451,6 +451,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) ui.backgasBreaks->setChecked(prefs.doo2breaks); setBailout(false); setBailoutVisibility(false); + ui.o2narcotic->setChecked(prefs.o2narcotic); ui.drop_stone_mode->setChecked(prefs.drop_stone_mode); ui.switch_at_req_stop->setChecked(prefs.switch_at_req_stop); ui.min_switch_duration->setValue(prefs.min_switch_duration / 60); @@ -496,6 +497,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) connect(ui.vpmb_conservatism, SIGNAL(valueChanged(int)), plannerModel, SLOT(setVpmbConservatism(int))); connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool))); connect(ui.bailout, SIGNAL(toggled(bool)), this, SLOT(setBailout(bool))); + connect(ui.o2narcotic, SIGNAL(toggled(bool)), this, SLOT(setO2narcotic(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.surface_segment, SIGNAL(valueChanged(int)), plannerModel, SLOT(setSurfaceSegment(int))); @@ -504,6 +506,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) connect(ui.bottompo2, SIGNAL(valueChanged(double)), CylindersModel::instance(), SLOT(updateBestMixes())); connect(ui.bestmixEND, SIGNAL(valueChanged(int)), CylindersModel::instance(), SLOT(updateBestMixes())); + connect(ui.o2narcotic, SIGNAL(toggled(bool)), CylindersModel::instance(), SLOT(updateBestMixes())); connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(disableDecoElements(int))); connect(ui.ascRate75, SIGNAL(valueChanged(int)), this, SLOT(setAscrate75(int))); @@ -679,6 +682,12 @@ void PlannerSettingsWidget::setBailout(bool dobailout) plannerModel->emitDataChanged(); } +void PlannerSettingsWidget::setO2narcotic(bool o2narcotic) +{ + qPrefDivePlanner::instance()->set_o2narcotic(o2narcotic); + plannerModel->emitDataChanged(); +} + void PlannerSettingsWidget::setBailoutVisibility(int mode) { ui.bailout->setDisabled(!(mode == CCR || mode == PSCR)); diff --git a/desktop-widgets/diveplanner.h b/desktop-widgets/diveplanner.h index 6d17c956b..e9e7808b9 100644 --- a/desktop-widgets/diveplanner.h +++ b/desktop-widgets/diveplanner.h @@ -86,6 +86,7 @@ slots: void setBestmixEND(int depth); void setBackgasBreaks(bool dobreaks); void setBailout(bool dobailout); + void setO2narcotic(bool o2narcotic); void disableDecoElements(int mode); void disableBackgasBreaks(bool enabled); void setDiveMode(int mode); diff --git a/desktop-widgets/plannerSettings.ui b/desktop-widgets/plannerSettings.ui index f22d0db45..33e3d2456 100644 --- a/desktop-widgets/plannerSettings.ui +++ b/desktop-widgets/plannerSettings.ui @@ -561,6 +561,83 @@ 2 + + + + Notes + + + + 2 + + + 2 + + + 2 + + + 2 + + + 2 + + + + + Verbatim dive plan + + + + + + + In diveplan, list transitions or treat them as implicit + + + Display transitions in deco + + + + + + + In dive plan, show runtime (absolute time) of stops + + + Display runtime + + + + + + + true + + + In dive plan, show duration (relative time) of stops + + + Display segment duration + + + + + + + true + + + Compute variations of plan (performance cost) + + + Display plan variations + + + + + + @@ -581,7 +658,7 @@ - + Qt::Vertical @@ -594,7 +671,7 @@ - + Qt::Vertical @@ -692,83 +769,6 @@ - - - - Notes - - - - 2 - - - 2 - - - 2 - - - 2 - - - 2 - - - - - Verbatim dive plan - - - - - - - In diveplan, list transitions or treat them as implicit - - - Display transitions in deco - - - - - - - In dive plan, show runtime (absolute time) of stops - - - Display runtime - - - - - - - true - - - In dive plan, show duration (relative time) of stops - - - Display segment duration - - - - - - - true - - - Compute variations of plan (performance cost) - - - Display plan variations - - - - - - @@ -831,6 +831,16 @@ + + + + Treat oxygen as narcotic when computing best mix + + + O₂ narcotic + + + -- cgit v1.2.3-70-g09d2