mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't compute SAC if total gas use is unknown
If we breathe from a cylinder with invalid start or end pressures, we cannot reliably compute the total gas use and thus the SAC. So we should not pretend to do so. A better fix would compute the total SAC for only those segements that have valid start and end pressures. Reported-by: Stefan Fuchs <sfuchs@gmx.de> Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
eb52f36cb6
commit
fb09784060
1 changed files with 10 additions and 2 deletions
|
@ -374,8 +374,16 @@ static double calculate_airuse(struct dive *dive)
|
||||||
|
|
||||||
start = cyl->start.mbar ? cyl->start : cyl->sample_start;
|
start = cyl->start.mbar ? cyl->start : cyl->sample_start;
|
||||||
end = cyl->end.mbar ? cyl->end : cyl->sample_end;
|
end = cyl->end.mbar ? cyl->end : cyl->sample_end;
|
||||||
if (!end.mbar || start.mbar <= end.mbar)
|
if (!end.mbar || start.mbar <= end.mbar) {
|
||||||
continue;
|
// If a cylinder is used but we do not have info on amout of gas used
|
||||||
|
// better not pretend we know the total gas use.
|
||||||
|
// Eventually, logic should be fixed to compute average depth and total time
|
||||||
|
// for those segments where cylinders with known pressure drop are breathed from.
|
||||||
|
if (is_cylinder_used(dive, i))
|
||||||
|
return 0.0;
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
airuse += gas_volume(cyl, start) - gas_volume(cyl, end);
|
airuse += gas_volume(cyl, start) - gas_volume(cyl, end);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue