From 321c8d92dcfef88bd8afeb3c477074cd210bacf6 Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Fri, 20 Jan 2023 13:41:06 +1300 Subject: [PATCH] Improvement: Show gases as diluent by default for CCR dives. Instead of adding all gases read from a dive computer as part of a dive log as 'OC-gas', add gases as 'diluent' if the dive has a dive mode of 'CCR'. This creates consistency with the ppO2 for CCR dives being tracked as sensor readings or a fixed setpoint, and not as the ppO2 of the current gas ad depth. A follow up question from this is whether gas use in the cylinders list on the Equipment tab should be user editable. This seems to be inconsistent at the moment, with gas constituent percentages downloaded from the dive computer being editable, but gas use not. Signed-off-by: Michael Keller --- CHANGELOG.md | 1 + core/libdivecomputer.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 600ab2e11..3f921c904 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +equipment: Use 'diluent' as default gas use type if the dive mode is 'CCR' htmlexport: fix search in HTML export statistics: fix value axis for degenerate value ranges profile: Show correct gas density when in CCR mode diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c index fbb1696fd..a8912bb66 100644 --- a/core/libdivecomputer.c +++ b/core/libdivecomputer.c @@ -150,6 +150,11 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t cyl.gasmix.he.permille = he; } + if (dive->dc.divemode == CCR) + cyl.cylinder_use = DILUENT; + else + cyl.cylinder_use = OC_GAS; + if (i < ntanks) { dc_tank_t tank = { 0 }; rc = dc_parser_get_field(parser, DC_FIELD_TANK, i, &tank); @@ -157,11 +162,11 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t cyl.type.size.mliter = lrint(tank.volume * 1000); cyl.type.workingpressure.mbar = lrint(tank.workpressure * 1000); - cyl.cylinder_use = OC_GAS; - if (tank.type & DC_TANKINFO_CC_O2) - cyl.cylinder_use = OXYGEN; + // libdivecomputer treats these as independent, but a tank cannot be used for diluent and O2 at the same time if (tank.type & DC_TANKINFO_CC_DILUENT) cyl.cylinder_use = DILUENT; + else if (tank.type & DC_TANKINFO_CC_O2) + cyl.cylinder_use = OXYGEN; if (tank.type & DC_TANKINFO_IMPERIAL) { if (same_string(devdata->model, "Suunto EON Steel")) {