# HG changeset patch # User heinrichsweikamp # Date 1721659116 -7200 # Node ID fa431d42b5fb97325428c7c06a2202cdcdcd14b9 # Parent dff26bf4b54206bc17a770601abb76e9969bd1c9 Fix incorrect logging of bailout to Open Circuit when using the best gas. This happened because the starting gas used for 'best gas' calculation was a diluent - in most cases not a problem as the same gas is also used as a bailout gas. Now use the 'first' open circuit gas configured as the starting point. Also fixes the problem of a custom bailout gas not being logged as such, and consequently not being shown as bailout in the on-device log. diff -r dff26bf4b542 -r fa431d42b5fb Common/Inc/settings.h --- a/Common/Inc/settings.h Mon Oct 09 11:23:27 2023 +0200 +++ b/Common/Inc/settings.h Mon Jul 22 16:38:36 2024 +0200 @@ -46,6 +46,7 @@ #define NUM_GASES 5 #define NUM_OFFSET_DILUENT 5 #define SPECIAL_GAS_ID 0 +#define NO_GAS_ID 255 #define ERROR_ 0xFF diff -r dff26bf4b542 -r fa431d42b5fb Discovery/Src/check_warning.c --- a/Discovery/Src/check_warning.c Mon Oct 09 11:23:27 2023 +0200 +++ b/Discovery/Src/check_warning.c Mon Jul 22 16:38:36 2024 +0200 @@ -231,6 +231,14 @@ gasIdOffset = 0; } + if (betterGasIdLocal == NO_GAS_ID) { + for (unsigned i = gasIdOffset + 1; i <= gasIdOffset + 5; i++) { + if (diveSettings.gas[i].note.ub.active && diveSettings.gas[i].note.ub.first) { + betterGasIdLocal = i; + } + } + } + /* life data is float, gas data is uint8 */ if (actualLeftMaxDepth(diveState)) { /* deco gases */ for (int i=1+gasIdOffset; i<= 5+gasIdOffset; i++) { @@ -245,7 +253,7 @@ } } else { /* travel gases */ bestGasDepth = 0; - //check for travalgas + //check for travelgas for (int i = 1 + gasIdOffset; i <= 5 + gasIdOffset; i++) { if ((diveSettings.gas[i].note.ub.active) && (diveSettings.gas[i].note.ub.travel) @@ -277,7 +285,7 @@ if (isLoopMode(diveSettings.diveMode)) { betterGasId = getBetterGasId(true, lifeData.actualGas.GasIdInSettings, diveState); - betterBailoutGasId = getBetterGasId(false, lifeData.lastDiluent_GasIdInSettings, diveState); + betterBailoutGasId = getBetterGasId(false, NO_GAS_ID, diveState); } else { betterGasId = getBetterGasId(false, lifeData.actualGas.GasIdInSettings, diveState); } diff -r dff26bf4b542 -r fa431d42b5fb Discovery/Src/data_central.c --- a/Discovery/Src/data_central.c Mon Oct 09 11:23:27 2023 +0200 +++ b/Discovery/Src/data_central.c Mon Jul 22 16:38:36 2024 +0200 @@ -547,12 +547,19 @@ nitrogen -= helium; - if((lifeData->actualGas.nitrogen_percentage != nitrogen) || (lifeData->actualGas.helium_percentage != helium) || (lifeData->actualGas.AppliedDiveMode != DIVEMODE_OC)) + if ((lifeData->actualGas.nitrogen_percentage != nitrogen) || (lifeData->actualGas.helium_percentage != helium) || lifeData->actualGas.AppliedDiveMode != DIVEMODE_OC) { - stateUsedWrite->events.manualGasSet = 1; - stateUsedWrite->events.info_manualGasSetHe = helium; - stateUsedWrite->events.info_manualGasSetO2 = oxygen; + if (stateUsed->diveSettings.ccrOption) { + stateUsedWrite->events.bailout = 1; + stateUsedWrite->events.info_bailoutHe = helium; + stateUsedWrite->events.info_bailoutO2 = oxygen; + } else { + stateUsedWrite->events.manualGasSet = 1; + stateUsedWrite->events.info_manualGasSetHe = helium; + stateUsedWrite->events.info_manualGasSetO2 = oxygen; + } } + if( lifeData->actualGas.setPoint_cbar != setpoint_cbar) { stateUsedWrite->events.setpointChange = 1;