Mercurial > public > ostc4
diff Discovery/Src/check_warning.c @ 864:fa431d42b5fb
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.
author | heinrichsweikamp |
---|---|
date | Mon, 22 Jul 2024 16:38:36 +0200 |
parents | 4abfb8a2a435 |
children | e373e90a48db |
line wrap: on
line diff
--- 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); }