summaryrefslogtreecommitdiffstats
path: root/libdivecomputer.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-02 06:12:56 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-02 06:21:00 -0700
commit1d59b028c91ab7943cfece4a113948c61110dfc3 (patch)
treeea03abbc3cb62f7f265bbe2b773e211119ad5943 /libdivecomputer.c
parent4059f5d995ccbacf6e334bd80590942212799f4b (diff)
downloadsubsurface-1d59b028c91ab7943cfece4a113948c61110dfc3.tar.gz
Use tank pressure data from libdivecomputer's DC_FIELD_TANK
When libdivecomputer switched to the DC_FIELD_TANK API it apparently stopped creating fake pressure samples at the start and end of a dive for dive computers that don't have continuous pressure reporting but that instead only report those two values. This updates our code to take those values into account. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r--libdivecomputer.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c
index ef6e4f871..24f4d0ff5 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -137,6 +137,12 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
}
if (!IS_FP_SAME(tank.volume, 0.0))
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)) {
+ dive->cylinder[i].start.mbar = tank.beginpressure * 1000;
+ dive->cylinder[i].end.mbar = tank.endpressure * 1000;
+ }
#endif
if (no_volume) {
/* for the first tank, if there is no tanksize available from the