From 448c50368c8ce1f644cf34e5303d14172982f81e Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Fri, 16 Jan 2015 13:02:26 +0100 Subject: [PATCH 1/3] Minor PSCR fixes Update O2 metabolsim rate and adopt default gas switch depths to pSCR oxygen drop. Signed-off-by: Robert C. Helling --- qt-ui/diveplanner.cpp | 6 +++++- qt-ui/maintab.cpp | 1 + qt-ui/models.cpp | 6 +++++- subsurfacestartup.c | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 1b389af..cd3206c 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -905,7 +905,11 @@ bool DivePlannerPointsModel::addGas(struct gasmix mix) /* The depth to change to that gas is given by the depth where its pO₂ is 1.6 bar. * The user should be able to change this depth manually. */ pressure_t modpO2; - modpO2.mbar = prefs.decopo2; + if (displayed_dive.dc.divemode == PSCR) + modpO2.mbar = prefs.decopo2 + (1000 - get_o2(&mix)) * SURFACE_PRESSURE * + prefs.o2consumption / prefs.decosac / prefs.pscr_ratio; + else + modpO2.mbar = prefs.decopo2; cyl->depth = gas_mod(&mix, modpO2, M_OR_FT(3,10)); diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 89208b5..492753d 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -1022,6 +1022,7 @@ void MainTab::divetype_Changed(int index) displayed_dive.dc.divemode = (enum dive_comp_type) index; update_setpoint_events(&displayed_dive.dc); markChangedWidget(ui.DiveType); + MainWindow::instance()->graphics()->replot(); } void MainTab::on_watertemp_textChanged(const QString &text) diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp index 9246a0b..8a5b823 100644 --- a/qt-ui/models.cpp +++ b/qt-ui/models.cpp @@ -284,7 +284,11 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in if (CHANGED()) { cyl->gasmix.o2 = string_to_fraction(vString.toUtf8().data()); pressure_t modpO2; - modpO2.mbar = prefs.decopo2; + if (displayed_dive.dc.divemode == PSCR) + modpO2.mbar = prefs.decopo2 + (1000 - get_o2(&cyl->gasmix)) * SURFACE_PRESSURE * + prefs.o2consumption / prefs.decosac / prefs.pscr_ratio; + else + modpO2.mbar = prefs.decopo2; cyl->depth = gas_mod(&cyl->gasmix, modpO2, M_OR_FT(3, 10)); changed = true; } diff --git a/subsurfacestartup.c b/subsurfacestartup.c index 4b8428e..2671dbc 100644 --- a/subsurfacestartup.c +++ b/subsurfacestartup.c @@ -46,7 +46,7 @@ struct preferences default_prefs = { .drop_stone_mode = false, .bottomsac = 20000, .decosac = 17000, - .o2consumption = 1000, + .o2consumption = 720, .pscr_ratio = 100, .show_pictures_in_profile = true, .tankbar = false, -- 1.9.3 (Apple Git-50)