From 1d59b028c91ab7943cfece4a113948c61110dfc3 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 2 Jul 2015 06:12:56 -0700 Subject: 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 --- libdivecomputer.c | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- cgit v1.2.3-70-g09d2