summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-07-17 11:00:06 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-17 08:10:42 -0700
commit9bf6100aa766ea3e2ab7fc5615a2e7ff7ceac71a (patch)
treec4977014826bcde6ae5d8feb1598ff862952f0ed
parent24472a3b232f49765fd5e5455a3c8c8fd4a7bac3 (diff)
downloadsubsurface-9bf6100aa766ea3e2ab7fc5615a2e7ff7ceac71a.tar.gz
Accept negative pressure readings
Sometimes the planner can produce negative pressures (i.e. when the cylinders are not properly configured) or when the usser ignored gas management (for whatever reason). When such a dive gets saved and reread we should not display a further "Strange pressure reading" warning on the command line. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--parse-xml.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/parse-xml.c b/parse-xml.c
index 20eafc31d..8e0099d3e 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -298,14 +298,14 @@ static void pressure(char *buffer, pressure_t *pressure)
case BAR:
/* Assume mbar, but if it's really small, it's bar */
mbar = val.fp;
- if (mbar < 5000)
+ if (fabs(mbar) < 5000)
mbar = mbar * 1000;
break;
case PSI:
mbar = psi_to_mbar(val.fp);
break;
}
- if (mbar > 5 && mbar < 500000) {
+ if (fabs(mbar) > 5 && fabs(mbar) < 5000000) {
pressure->mbar = rint(mbar);
break;
}