mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
ToolTipItem: show gf line based on correct gradient factor preferences
Calculate gfline using the gradient factor that is set by the planner preferences when in the planner, and by the general prefs when not in the planner. This is achieved by doing the gradient factor calculation in dive.c, where buehlmann_config is defined. Previously, the gfline was calculated using the general preferences gfhigh and gflow, even when in the planner. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a2d6bcf23f
commit
ebddf95252
3 changed files with 17 additions and 4 deletions
14
core/deco.c
14
core/deco.c
|
|
@ -618,3 +618,17 @@ void set_vpmb_conservatism(short conservatism)
|
|||
else
|
||||
vpmb_config.conservatism = conservatism;
|
||||
}
|
||||
|
||||
double get_gf(double ambpressure_bar, const struct dive *dive)
|
||||
{
|
||||
double surface_pressure_bar = get_surface_pressure_in_mbar(dive, true) / 1000.0;
|
||||
double gf_low = buehlmann_config.gf_low;
|
||||
double gf_high = buehlmann_config.gf_high;
|
||||
double gf;
|
||||
if (gf_low_pressure_this_dive > surface_pressure_bar)
|
||||
gf = MAX((double)gf_low, (ambpressure_bar - surface_pressure_bar) /
|
||||
(gf_low_pressure_this_dive - surface_pressure_bar) * (gf_low - gf_high) + gf_high);
|
||||
else
|
||||
gf = gf_low;
|
||||
return gf;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue