diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-03-29 13:59:31 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-03-29 14:00:16 +0200 |
commit | 09b5f9b99c96cee3bdcdd6bf31003e6e91a023dc (patch) | |
tree | 8e80860f76ce6dc5daabc6f05672eb971e081123 /core | |
parent | 3b9c32a05036e24bce1c896a9de492619771f1ab (diff) | |
download | subsurface-09b5f9b99c96cee3bdcdd6bf31003e6e91a023dc.tar.gz |
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>
Diffstat (limited to 'core')
-rw-r--r-- | core/libdivecomputer.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); } |