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>
This commit is contained in:
Robert C. Helling 2014-07-17 11:00:06 +02:00 committed by Dirk Hohndel
parent 24472a3b23
commit 9bf6100aa7

View file

@ -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;
}