diff Discovery/Src/data_central.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 dd7ce655db26
children e373e90a48db
line wrap: on
line diff
--- 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;