From 33e49637ec6a99c50ad56bfbfc88b4e925d01e7d Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Thu, 28 Nov 2019 10:37:44 +0100 Subject: [PATCH] Add current GF to infobox As per request from users on scubaforum.com, this adds the current gradient factor to the deco information of the infobox. Up to now, this information was only graphically represented in the pressure bar graph and the heatmap. This gives a numerical value. Signed-off-by: Robert C. Helling --- CHANGELOG.md | 1 + Documentation/user-manual.txt | 7 +++++-- core/profile.c | 10 ++++++++-- core/profile.h | 1 + 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17d14e1b3..e48ac146d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +Profile: Add current GF to infobox Mobile: (desktop only) new switch --testqml, allows to use qml files instead of resources. Desktop: increase speed of multi-trip selection Mobile: ensure that all BT/BLE flavors of the OSTC are recognized as dive computers [#2358] diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index 98fa5622f..0981153e2 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -2290,8 +2290,11 @@ TTS longer than 2 hours is not accurately calculated and Subsurface only indicat [icon="images/icons/GFLow.jpg"] [NOTE] -Show *Deco information*. When enabled, the information box shows the surface GF and the momentary -ceilings for the individual tissue compartments. The surface GF is an indication of to what degree +Show *Deco information*. When enabled, the information box shows the current gradient factor (GF), +the surface GF and the momentary +ceilings for the individual tissue compartments. The gradient factor is in indication of how +much of the allowed pressure gradient between tissues (normalized with a 100/100 Bühlmann model) +the diver is currently using. The surface GF is an indication of to what degree the partial pressure of nitrogen in the blood exceeds the partial pressure required for safely reaching the surface. Surface GF > 100% means that it is unsafe to surface. diff --git a/core/profile.c b/core/profile.c index 1d3453a80..b79236151 100644 --- a/core/profile.c +++ b/core/profile.c @@ -1126,13 +1126,17 @@ void calculate_deco_information(struct deco_state *ds, const struct deco_state * } } entry->surface_gf = 0.0; + entry->current_gf = 0.0; for (j = 0; j < 16; j++) { double m_value = ds->buehlmann_inertgas_a[j] + entry->ambpressure / ds->buehlmann_inertgas_b[j]; double surface_m_value = ds->buehlmann_inertgas_a[j] + surface_pressure / ds->buehlmann_inertgas_b[j]; entry->ceilings[j] = deco_allowed_depth(ds->tolerated_by_tissue[j], surface_pressure, dive, 1); + double current_gf = (ds->tissue_inertgas_saturation[j] - entry->ambpressure) / (m_value - entry->ambpressure); entry->percentages[j] = ds->tissue_inertgas_saturation[j] < entry->ambpressure ? lrint(ds->tissue_inertgas_saturation[j] / entry->ambpressure * AMB_PERCENTAGE) : - lrint(AMB_PERCENTAGE + (ds->tissue_inertgas_saturation[j] - entry->ambpressure) / (m_value - entry->ambpressure) * (100.0 - AMB_PERCENTAGE)); + lrint(AMB_PERCENTAGE + current_gf * (100.0 - AMB_PERCENTAGE)); + if (current_gf > entry->current_gf) + entry->current_gf = current_gf; double surface_gf = 100.0 * (ds->tissue_inertgas_saturation[j] - surface_pressure) / (surface_m_value - surface_pressure); if (surface_gf > entry->surface_gf) entry->surface_gf = surface_gf; @@ -1552,7 +1556,9 @@ static void plot_string(struct plot_info *pi, int idx, struct membuffer *b) if (entry->rbt) put_format_loc(b, translate("gettextFromC", "RBT: %umin\n"), DIV_UP(entry->rbt, 60)); if (prefs.decoinfo) { - if (entry->surface_gf > 0) + if (entry->current_gf > 0.0) + put_format(b, translate("gettextFromC", "GF %d%%\n"), (int)(100.0 * entry->current_gf)); + if (entry->surface_gf > 0.0) put_format(b, translate("gettextFromC", "Surface GF %.0f%%\n"), entry->surface_gf); if (entry->ceiling) { depthvalue = get_depth_units(entry->ceiling, NULL, &depth_unit); diff --git a/core/profile.h b/core/profile.h index 953cfdcc8..c4f42fd24 100644 --- a/core/profile.h +++ b/core/profile.h @@ -75,6 +75,7 @@ struct plot_data { double ambpressure; double gfline; double surface_gf; + double current_gf; double density; bool icd_warning; };