From fbaeeec8079bedb2d3f78bcb2057bfd3a4affe7d Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Fri, 3 Feb 2017 08:28:45 +0100 Subject: Print SAC values from prefs in diveplan Print the SAC values from preferences into the diveplan. These are the values used for calculation of gas consumption. Signed-off-by: Stefan Fuchs Signed-off-by: Dirk Hohndel --- core/planner.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'core/planner.c') diff --git a/core/planner.c b/core/planner.c index 68df6a4e1..7aea24120 100644 --- a/core/planner.c +++ b/core/planner.c @@ -825,12 +825,24 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool diveplan->surface_pressure, altitude, depth_unit); + + /* Get SAC values and units for printing it in gas consumption */ + float bottomsacvalue, decosacvalue; + int sacdecimals; + const char* sacunit; + + bottomsacvalue = get_volume_units(prefs.bottomsac, &sacdecimals, &sacunit); + decosacvalue = get_volume_units(prefs.decosac, NULL, NULL); + + /* Reduce number of decimals from 1 to 0 for bar/min, keep 2 for cuft/min */ + if (sacdecimals==1) sacdecimals--; /* Print the gas consumption next.*/ if (dive->dc.divemode == CCR) snprintf(temp, sz_temp, "%s", translate("gettextFromC", "Gas consumption (CCR legs excluded):")); else - snprintf(temp, sz_temp, "%s", translate("gettextFromC", "Gas consumption:")); + snprintf(temp, sz_temp, "%s %.*f|%.*f%s/min):", translate("gettextFromC", "Gas consumption (based on SAC"), + sacdecimals, bottomsacvalue, sacdecimals, decosacvalue, sacunit); len += snprintf(buffer + len, sz_buffer - len, "

%s
", temp); for (int gasidx = 0; gasidx < MAX_CYLINDERS; gasidx++) { double volume, pressure, deco_volume, deco_pressure; -- cgit v1.2.3-70-g09d2