mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Fix effective GFs in notes
This patch fixes two bugs: 1) It first computes the effective gradient factors and then composes the notes with the diveplan rather than the other way around. 2) It does not try to fit a line through a single point. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4d0d37b690
commit
f03acb9e9a
2 changed files with 5 additions and 5 deletions
|
@ -657,7 +657,7 @@ double get_gf(double ambpressure_bar, const struct dive *dive)
|
|||
|
||||
double regressiona()
|
||||
{
|
||||
if (sum1) {
|
||||
if (sum1 > 1) {
|
||||
double avxy = sumxy / sum1;
|
||||
double avx = (double)sumx / sum1;
|
||||
double avy = sumy / sum1;
|
||||
|
|
|
@ -1362,15 +1362,15 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
|
|||
} while (!is_final_plan);
|
||||
|
||||
plan_add_segment(diveplan, clock - previous_point_time, 0, current_cylinder, po2, false);
|
||||
create_dive_from_plan(diveplan, is_planner);
|
||||
add_plan_to_notes(diveplan, &displayed_dive, show_disclaimer, error);
|
||||
fixup_dc_duration(&displayed_dive.dc);
|
||||
|
||||
if(prefs.deco_mode == VPMB) {
|
||||
diveplan->eff_gfhigh = rint(100.0 * regressionb());
|
||||
diveplan->eff_gflow = rint(100*(regressiona() * first_stop_depth + regressionb()));
|
||||
}
|
||||
|
||||
create_dive_from_plan(diveplan, is_planner);
|
||||
add_plan_to_notes(diveplan, &displayed_dive, show_disclaimer, error);
|
||||
fixup_dc_duration(&displayed_dive.dc);
|
||||
|
||||
free(stoplevels);
|
||||
free(gaschanges);
|
||||
free(bottom_cache);
|
||||
|
|
Loading…
Reference in a new issue