summaryrefslogtreecommitdiffstats
path: root/deco.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-09 07:49:12 +1100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-09 08:01:59 +1100
commit61861d2611779449b3a4ab6dd2096f50e50399b0 (patch)
tree898a7718d21b968a3cb97e85ca1da54f8ee4b374 /deco.c
parent54ff04c61b8e781ab3333ddd82178dc669286cae (diff)
downloadsubsurface-61861d2611779449b3a4ab6dd2096f50e50399b0.tar.gz
Clean up the handling of surface pressure
There are two ways to look at surface pressure. One is to say "what was the surface pressure during that dive?" - in that case we now return an average over the pressure reported by the different divecomputers (or the standard 1013mbar if none reported any). Or you want to do specific calculations for a specific divecomputer - in which case we access only the pressure reported by THAT divecomputer, if present (and fall back to the previous case, otherwise). We still have lots of places in Subsurface that only act on the first divecomputer. As a side effect of this change we now make this more obvious as we in those cases pass a pointer to the first divecomputer explicitly to the calculations. Either way, this commit should prevent us from ever mistakenly basing our calculations on a surface pressure of 0 (which is the initial bug in deco.c that triggered all this). Similar changes need to be made for other elements that we currently only use from the first divecomputer, i.e., salinity. Reported-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'deco.c')
-rw-r--r--deco.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/deco.c b/deco.c
index 4bddad576..87899b5ee 100644
--- a/deco.c
+++ b/deco.c
@@ -90,7 +90,7 @@ static double tissue_tolerance_calc(const struct dive *dive)
double ret_tolerance_limit_ambient_pressure = 0.0;
double gf_high = buehlmann_config.gf_high;
double gf_low = buehlmann_config.gf_low;
- double surface = dive->dc.surface_pressure.mbar / 1000.0;
+ double surface = get_surface_pressure_in_mbar(dive, TRUE) / 1000.0;
double lowest_ceiling;
for (ci = 0; ci < 16; ci++)