From b36178a00a37f3679decebb52fffe6e41e5c5704 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 27 Oct 2020 23:04:24 +0100 Subject: cylindermodel: remove in_planner() use in_planner() is problematic, since it is uses desktop-only application state. Since the cylinder-model already has an appropriate inPlanner flag, use this instead. Signed-off-by: Berthold Stoeger --- core/dive.c | 4 ++-- core/dive.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'core') 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); -- cgit v1.2.3-70-g09d2