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>
This commit is contained in:
Dirk Hohndel 2015-07-02 06:12:56 -07:00
parent 4059f5d995
commit 1d59b028c9

View file

@ -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