diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2017-03-30 11:30:23 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-03-30 11:44:45 +0200 |
commit | 34a42d7f04319973cbecfcc3b21c6bf8b29f2a22 (patch) | |
tree | 506ec92ba9521766557696e63a7bcb70fc723fef /core/libdivecomputer.c | |
parent | 09b5f9b99c96cee3bdcdd6bf31003e6e91a023dc (diff) | |
download | subsurface-34a42d7f04319973cbecfcc3b21c6bf8b29f2a22.tar.gz |
Shift fake tank pressures up by 30bar
This is a rather arbitrary value, intended to create actually valid
pressure values for Uwatec Memomouse users - since we treat 0bar as
invalid pressure value, this simply creates an arbitrary '30bar + delta'
to '30bar' consumption graph (since all the Memomouse devices give us is
the pressure delta that was used during the dive).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/libdivecomputer.c')
-rw-r--r-- | core/libdivecomputer.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c index cac6143b8..28fa90948 100644 --- a/core/libdivecomputer.c +++ b/core/libdivecomputer.c @@ -208,9 +208,16 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t // 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); + // In order to make this work, we arbitrary shift this up by 30bar so the + // rest of the code treats this as if they were valid values + if (!IS_FP_SAME(tank.beginpressure, 0.0)) { + if (!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); + } else if (same_string(devdata->vendor, "Uwatec")) { + dive->cylinder[i].start.mbar = lrint(tank.beginpressure * 1000 + 30000); + dive->cylinder[i].end.mbar = 30000; + } } } #endif |