diff Discovery/Src/check_warning.c @ 563:d97f0e395058

Refine o2 sensor diagnostic functions: Changed implementation to ignore connection errors if analog interface is selected. Because the HUD is using cBars, the code has been modified to be compatible with the Bar units provided by the analog interface. Behavior (outofbounds) should be identical to the previous implementation.
author Ideenmodellierer
date Sun, 15 Nov 2020 20:01:56 +0100
parents 58200d756365
children 64bf41faab83
line wrap: on
line diff
--- a/Discovery/Src/check_warning.c	Sun Nov 15 19:58:14 2020 +0100
+++ b/Discovery/Src/check_warning.c	Sun Nov 15 20:01:56 2020 +0100
@@ -177,13 +177,15 @@
 	pDiveState->warnings.sensorOutOfBounds[2] = 0;
 
 	if((pDiveState->diveSettings.diveMode == DIVEMODE_CCR) && (pDiveState->diveSettings.CCR_Mode == CCRMODE_Sensors))
-	{
-		if(!get_HUD_battery_voltage_V())
-			pDiveState->warnings.sensorLinkLost = 1;
-		
-		test_HUD_sensor_values_outOfBounds(&pDiveState->warnings.sensorOutOfBounds[0], &pDiveState->warnings.sensorOutOfBounds[1], &pDiveState->warnings.sensorOutOfBounds[2]);
-		
-	}
+
+		if(settingsGetPointer()->ppo2sensors_source == O2_SENSOR_SOURCE_OPTIC)
+		{
+			{
+				if(!get_HUD_battery_voltage_V())
+					pDiveState->warnings.sensorLinkLost = 1;
+			}
+			test_O2_sensor_values_outOfBounds(&pDiveState->warnings.sensorOutOfBounds[0], &pDiveState->warnings.sensorOutOfBounds[1], &pDiveState->warnings.sensorOutOfBounds[2]);
+		}
 	return 		pDiveState->warnings.sensorLinkLost
 					+ pDiveState->warnings.sensorOutOfBounds[0]
 					+ pDiveState->warnings.sensorOutOfBounds[1]