From 09b5f9b99c96cee3bdcdd6bf31003e6e91a023dc Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Wed, 29 Mar 2017 13:59:31 +0200 Subject: 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 --- core/libdivecomputer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c index f8f9823c2..cac6143b8 100644 --- a/core/libdivecomputer.c +++ b/core/libdivecomputer.c @@ -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); } -- cgit v1.2.3-70-g09d2