summaryrefslogtreecommitdiffstats
path: root/core/profile.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2017-05-12 15:36:24 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-05-26 15:52:04 -0700
commitbb6ceba4ac0310c504f931674a71e9e77c0afa1c (patch)
tree2a060b136d32e7ecdfd5b8b0314415595e675cbe /core/profile.c
parente6d884cf26161df65c2b4b8c39d6b4133760537b (diff)
downloadsubsurface-bb6ceba4ac0310c504f931674a71e9e77c0afa1c.tar.gz
Compute and display gas density
This appears to be critical for work of breathing so it might be worthwhile to compute. So far only in infobox. For background, see https://www.youtube.com/watch?v=QBajM3xmOtc Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core/profile.c')
-rw-r--r--core/profile.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/profile.c b/core/profile.c
index 86bc974b8..d46904cbe 100644
--- a/core/profile.c
+++ b/core/profile.c
@@ -1151,6 +1151,7 @@ static void calculate_gas_information_new(struct dive *dive, struct plot_info *p
entry->pressures.n2 / amb_pressure * N2_DENSITY +
entry->pressures.he / amb_pressure * HE_DENSITY) /
(O2_IN_AIR * O2_DENSITY + N2_IN_AIR * N2_DENSITY) * 1000 - 10000;
+ entry->density = gas_density(&dive->cylinder[cylinderindex].gasmix, depth_to_mbar(entry->depth, dive));
if (entry->mod < 0)
entry->mod = 0;
if (entry->ead < 0)
@@ -1292,7 +1293,7 @@ static void plot_string(struct plot_info *pi, struct plot_data *entry, struct me
{
int pressurevalue, mod, ead, end, eadd;
const char *depth_unit, *pressure_unit, *temp_unit, *vertical_speed_unit;
- double depthvalue, tempvalue, speedvalue, sacvalue;
+ double depthvalue, tempvalue, speedvalue, sacvalue, density;
int decimals;
const char *unit;
@@ -1327,15 +1328,18 @@ static void plot_string(struct plot_info *pi, struct plot_data *entry, struct me
put_format(b, translate("gettextFromC", "MOD: %d%s\n"), mod, depth_unit);
}
eadd = lrint(get_depth_units(lrint(entry->eadd), NULL, &depth_unit));
+
if (prefs.ead) {
switch (pi->dive_type) {
case NITROX:
ead = lrint(get_depth_units(lrint(entry->ead), NULL, &depth_unit));
put_format(b, translate("gettextFromC", "EAD: %d%s\nEADD: %d%s\n"), ead, depth_unit, eadd, depth_unit);
+ put_format(b, translate("gettextFromC", "density: %.1fg/l\n"), entry->density);
break;
case TRIMIX:
end = lrint(get_depth_units(lrint(entry->end), NULL, &depth_unit));
put_format(b, translate("gettextFromC", "END: %d%s\nEADD: %d%s\n"), end, depth_unit, eadd, depth_unit);
+ put_format(b, translate("gettextFromC", "density: %.1fg/l\n"), entry->density);
break;
case AIR:
case FREEDIVING: