Accept 0 as valid endpressure for Uwatec devices

Instead of delivering the actual start and end pressure, memomouse
gives you a start pressure that matches the delta between actual
start and end pressure, and an end pressure of zero. Who the heck
knows why it does that, but the information is better than nothing,
so we should accept it.

Fixes #286

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2017-03-29 13:59:31 +02:00
parent 3b9c32a050
commit 09b5f9b99c

View file

@ -205,7 +205,10 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
no_volume = false;
// this new API also gives us the beginning and end pressure for the tank
if (!IS_FP_SAME(tank.beginpressure, 0.0) && !IS_FP_SAME(tank.endpressure, 0.0)) {
// normally 0 is not a valid pressure, but for some Uwatec dive computers we
// don't get the actual start and end pressure, but instead a start pressure
// that matches the consumption and an end pressure of always 0
if (!IS_FP_SAME(tank.beginpressure, 0.0) && (same_string(devdata->vendor, "Uwatec") || !IS_FP_SAME(tank.endpressure, 0.0))) {
dive->cylinder[i].start.mbar = lrint(tank.beginpressure * 1000);
dive->cylinder[i].end.mbar = lrint(tank.endpressure * 1000);
}