Mercurial > public > ostc4
comparison 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 |
comparison
equal
deleted
inserted
replaced
822:dff26bf4b542 | 864:fa431d42b5fb |
---|---|
229 gasIdOffset = NUM_OFFSET_DILUENT; | 229 gasIdOffset = NUM_OFFSET_DILUENT; |
230 } else { | 230 } else { |
231 gasIdOffset = 0; | 231 gasIdOffset = 0; |
232 } | 232 } |
233 | 233 |
234 if (betterGasIdLocal == NO_GAS_ID) { | |
235 for (unsigned i = gasIdOffset + 1; i <= gasIdOffset + 5; i++) { | |
236 if (diveSettings.gas[i].note.ub.active && diveSettings.gas[i].note.ub.first) { | |
237 betterGasIdLocal = i; | |
238 } | |
239 } | |
240 } | |
241 | |
234 /* life data is float, gas data is uint8 */ | 242 /* life data is float, gas data is uint8 */ |
235 if (actualLeftMaxDepth(diveState)) { /* deco gases */ | 243 if (actualLeftMaxDepth(diveState)) { /* deco gases */ |
236 for (int i=1+gasIdOffset; i<= 5+gasIdOffset; i++) { | 244 for (int i=1+gasIdOffset; i<= 5+gasIdOffset; i++) { |
237 if ((diveSettings.gas[i].note.ub.active) | 245 if ((diveSettings.gas[i].note.ub.active) |
238 && (diveSettings.gas[i].note.ub.deco) | 246 && (diveSettings.gas[i].note.ub.deco) |
243 bestGasDepth = diveSettings.gas[i].depth_meter; | 251 bestGasDepth = diveSettings.gas[i].depth_meter; |
244 } | 252 } |
245 } | 253 } |
246 } else { /* travel gases */ | 254 } else { /* travel gases */ |
247 bestGasDepth = 0; | 255 bestGasDepth = 0; |
248 //check for travalgas | 256 //check for travelgas |
249 for (int i = 1 + gasIdOffset; i <= 5 + gasIdOffset; i++) { | 257 for (int i = 1 + gasIdOffset; i <= 5 + gasIdOffset; i++) { |
250 if ((diveSettings.gas[i].note.ub.active) | 258 if ((diveSettings.gas[i].note.ub.active) |
251 && (diveSettings.gas[i].note.ub.travel) | 259 && (diveSettings.gas[i].note.ub.travel) |
252 && (diveSettings.gas[i].depth_meter_travel) | 260 && (diveSettings.gas[i].depth_meter_travel) |
253 && (diveSettings.gas[i].depth_meter_travel <= (diveState->lifeData.depth_meter + 0.01f )) | 261 && (diveSettings.gas[i].depth_meter_travel <= (diveState->lifeData.depth_meter + 0.01f )) |
275 SDiveSettings diveSettings = diveState->diveSettings; | 283 SDiveSettings diveSettings = diveState->diveSettings; |
276 SLifeData lifeData = diveState->lifeData; | 284 SLifeData lifeData = diveState->lifeData; |
277 | 285 |
278 if (isLoopMode(diveSettings.diveMode)) { | 286 if (isLoopMode(diveSettings.diveMode)) { |
279 betterGasId = getBetterGasId(true, lifeData.actualGas.GasIdInSettings, diveState); | 287 betterGasId = getBetterGasId(true, lifeData.actualGas.GasIdInSettings, diveState); |
280 betterBailoutGasId = getBetterGasId(false, lifeData.lastDiluent_GasIdInSettings, diveState); | 288 betterBailoutGasId = getBetterGasId(false, NO_GAS_ID, diveState); |
281 } else { | 289 } else { |
282 betterGasId = getBetterGasId(false, lifeData.actualGas.GasIdInSettings, diveState); | 290 betterGasId = getBetterGasId(false, lifeData.actualGas.GasIdInSettings, diveState); |
283 } | 291 } |
284 | 292 |
285 if (betterGasId != lifeData.actualGas.GasIdInSettings && !check_helper_same_oxygen_and_helium_content(&diveSettings.gas[betterGasId], &diveSettings.gas[lifeData.actualGas.GasIdInSettings])) { | 293 if (betterGasId != lifeData.actualGas.GasIdInSettings && !check_helper_same_oxygen_and_helium_content(&diveSettings.gas[betterGasId], &diveSettings.gas[lifeData.actualGas.GasIdInSettings])) { |