From 9bf6100aa766ea3e2ab7fc5615a2e7ff7ceac71a Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Thu, 17 Jul 2014 11:00:06 +0200 Subject: 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 Signed-off-by: Dirk Hohndel --- parse-xml.c | 4 ++-- 1 file 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; } -- cgit v1.2.3-70-g09d2