summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-02-03 08:28:45 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-02-03 02:45:58 -0800
commitfbaeeec8079bedb2d3f78bcb2057bfd3a4affe7d (patch)
treeeb249cadddd7291e84fd74ade2e33c30bd5e371d /core
parenta1c51256b25b2ed55cfda638698e7f2e8909776c (diff)
downloadsubsurface-fbaeeec8079bedb2d3f78bcb2057bfd3a4affe7d.tar.gz
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 <sfuchs@gmx.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r--core/planner.c14
1 files changed, 13 insertions, 1 deletions
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, "<div><br>%s<br>", temp);
for (int gasidx = 0; gasidx < MAX_CYLINDERS; gasidx++) {
double volume, pressure, deco_volume, deco_pressure;