VPMB: time_clear_ceiling is only valid after time_deep_ceiling

Some messed up logic was producing negative deco_time values for some no-deco dives. The CVA wouldn't converge and unrealistic VPMB ceilings were displayed in the profile.  This fixes it.

See #762

Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
This commit is contained in:
Rick Walsh 2017-11-03 18:48:14 +11:00 committed by Robert C. Helling
parent 8e1ea8cd14
commit 05b4113609

View file

@ -1036,7 +1036,7 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru
// Use the point where the ceiling clears as the end of deco phase for CVA calculations
if (current_ceiling > 0)
time_clear_ceiling = 0;
else if (time_clear_ceiling == 0)
else if (time_clear_ceiling == 0 && t1 > time_deep_ceiling)
time_clear_ceiling = t1;
}
}