summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/dive.c4
-rw-r--r--core/dive.h2
-rw-r--r--qt-models/cylindermodel.cpp8
3 files changed, 7 insertions, 7 deletions
diff --git a/core/dive.c b/core/dive.c
index 6ac70da71..5157afea0 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -3118,10 +3118,10 @@ void split_divecomputer(const struct dive *src, int num, struct dive **out1, str
}
//Calculate O2 in best mix
-fraction_t best_o2(depth_t depth, const struct dive *dive)
+fraction_t best_o2(depth_t depth, const struct dive *dive, bool in_planner)
{
fraction_t fo2;
- int po2 = in_planner() ? prefs.bottompo2 : prefs.modpO2 * 1000;
+ int po2 = in_planner ? prefs.bottompo2 : prefs.modpO2 * 1000;
fo2.permille = (po2 * 100 / depth_to_mbar(depth.mm, dive)) * 10; //use integer arithmetic to round down to nearest percent
// Don't permit >100% O2
diff --git a/core/dive.h b/core/dive.h
index 40298d85e..09ef61b42 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -95,7 +95,7 @@ struct dive_components {
extern bool has_gaschange_event(const struct dive *dive, const struct divecomputer *dc, int idx);
extern int explicit_first_cylinder(const struct dive *dive, const struct divecomputer *dc);
-extern fraction_t best_o2(depth_t depth, const struct dive *dive);
+extern fraction_t best_o2(depth_t depth, const struct dive *dive, bool in_planner);
extern fraction_t best_he(depth_t depth, const struct dive *dive, bool o2narcotic, fraction_t fo2);
extern int get_surface_pressure_in_mbar(const struct dive *dive, bool non_null);
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
index 61bb3b9f5..129fa865a 100644
--- a/qt-models/cylindermodel.cpp
+++ b/qt-models/cylindermodel.cpp
@@ -230,7 +230,7 @@ QVariant CylindersModel::data(const QModelIndex &index, int role) const
return QStringLiteral("*");
} else {
pressure_t modpO2;
- modpO2.mbar = in_planner() ? prefs.bottompo2 : prefs.modpO2 * 1000;
+ modpO2.mbar = inPlanner ? prefs.bottompo2 : prefs.modpO2 * 1000;
return get_depth_string(gas_mod(cyl->gasmix, modpO2, d, M_OR_FT(1,1)), true);
}
case MND:
@@ -429,11 +429,11 @@ bool CylindersModel::setData(const QModelIndex &index, const QVariant &value, in
if (QString::compare(qPrintable(vString), "*") == 0) {
cyl.bestmix_o2 = true;
// Calculate fO2 for max. depth
- cyl.gasmix.o2 = best_o2(d->maxdepth, d);
+ cyl.gasmix.o2 = best_o2(d->maxdepth, d, inPlanner);
} else {
cyl.bestmix_o2 = false;
// Calculate fO2 for input depth
- cyl.gasmix.o2 = best_o2(string_to_depth(qPrintable(vString)), d);
+ cyl.gasmix.o2 = best_o2(string_to_depth(qPrintable(vString)), d, inPlanner);
}
pressure_t modpO2;
modpO2.mbar = prefs.decopo2;
@@ -643,7 +643,7 @@ bool CylindersModel::updateBestMixes()
for (int i = 0; i < d->cylinders.nr; i++) {
cylinder_t *cyl = get_cylinder(d, i);
if (cyl->bestmix_o2) {
- cyl->gasmix.o2 = best_o2(d->maxdepth, d);
+ cyl->gasmix.o2 = best_o2(d->maxdepth, d, inPlanner);
// fO2 + fHe must not be greater than 1
if (get_o2(cyl->gasmix) + get_he(cyl->gasmix) > 1000)
cyl->gasmix.he.permille = 1000 - get_o2(cyl->gasmix);