From a969d1dd4518ce77e8fba920aec4a5d8cfd1f636 Mon Sep 17 00:00:00 2001 From: willemferguson Date: Wed, 15 May 2019 18:39:29 +0200 Subject: Implement height-to-pressure functions in planner The units.h file has two functions to convert atm pressure to mbar and also to convert mbar to atm pressure. Implement these two functions in the planner. Signed-off-by: willemferguson --- core/plannernotes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/plannernotes.c b/core/plannernotes.c index e7a09d96d..9353fa2ec 100644 --- a/core/plannernotes.c +++ b/core/plannernotes.c @@ -11,6 +11,7 @@ #include #include "dive.h" #include "deco.h" +#include "units.h" #include "divelist.h" #include "planner.h" #include "gettext.h" @@ -420,7 +421,7 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d put_string(&buf, "
"); const char *depth_unit; - int altitude = (int) get_depth_units((int) (log(1013.0 / diveplan->surface_pressure) * 7800000), NULL, &depth_unit); + int altitude = (int) get_depth_units((int) (pressure_to_altitude(diveplan->surface_pressure)), NULL, &depth_unit); put_format_loc(&buf, translate("gettextFromC", "ATM pressure: %dmbar (%d%s)
"), diveplan->surface_pressure, altitude, depth_unit); -- cgit v1.2.3-70-g09d2