mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix logic for presaturation
There were two problems in the calculation of tissue pre- saturation from previous dives: We added the surface interval after the dive rather than before and when also took dives into accout that were in the future of the dive considerd. Reported-by: Timothy Massey Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7a77569019
commit
3870916ae2
1 changed files with 9 additions and 6 deletions
|
@ -400,6 +400,9 @@ double init_decompression(struct dive *dive)
|
|||
/* again skip dives from different trips */
|
||||
if (dive->divetrip && dive->divetrip != pdive->divetrip)
|
||||
continue;
|
||||
/* Don't add future dives */
|
||||
if (pdive->when > dive->when)
|
||||
continue; /* This could be break if the divelist is always sorted */
|
||||
surface_pressure = get_surface_pressure_in_mbar(pdive, true) / 1000.0;
|
||||
if (!deco_init) {
|
||||
clear_deco(surface_pressure);
|
||||
|
@ -408,12 +411,6 @@ double init_decompression(struct dive *dive)
|
|||
dump_tissues();
|
||||
#endif
|
||||
}
|
||||
add_dive_to_deco(pdive);
|
||||
laststart = pdive->when;
|
||||
#if DECO_CALC_DEBUG & 2
|
||||
printf("added dive #%d\n", pdive->number);
|
||||
dump_tissues();
|
||||
#endif
|
||||
if (pdive->when > lasttime) {
|
||||
surface_time = pdive->when - lasttime;
|
||||
lasttime = pdive->when + pdive->duration.seconds;
|
||||
|
@ -423,6 +420,12 @@ double init_decompression(struct dive *dive)
|
|||
dump_tissues();
|
||||
#endif
|
||||
}
|
||||
add_dive_to_deco(pdive);
|
||||
laststart = pdive->when;
|
||||
#if DECO_CALC_DEBUG & 2
|
||||
printf("added dive #%d\n", pdive->number);
|
||||
dump_tissues();
|
||||
#endif
|
||||
}
|
||||
/* add the final surface time */
|
||||
if (lasttime && dive->when > lasttime) {
|
||||
|
|
Loading…
Add table
Reference in a new issue