mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
a1c51256b2
commit
fbaeeec807
1 changed files with 13 additions and 1 deletions
|
@ -825,12 +825,24 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
|
||||||
diveplan->surface_pressure,
|
diveplan->surface_pressure,
|
||||||
altitude,
|
altitude,
|
||||||
depth_unit);
|
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.*/
|
/* Print the gas consumption next.*/
|
||||||
if (dive->dc.divemode == CCR)
|
if (dive->dc.divemode == CCR)
|
||||||
snprintf(temp, sz_temp, "%s", translate("gettextFromC", "Gas consumption (CCR legs excluded):"));
|
snprintf(temp, sz_temp, "%s", translate("gettextFromC", "Gas consumption (CCR legs excluded):"));
|
||||||
else
|
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);
|
len += snprintf(buffer + len, sz_buffer - len, "<div><br>%s<br>", temp);
|
||||||
for (int gasidx = 0; gasidx < MAX_CYLINDERS; gasidx++) {
|
for (int gasidx = 0; gasidx < MAX_CYLINDERS; gasidx++) {
|
||||||
double volume, pressure, deco_volume, deco_pressure;
|
double volume, pressure, deco_volume, deco_pressure;
|
||||||
|
|
Loading…
Add table
Reference in a new issue