changeset 744:dd5db6e2c9a4

Added DiveO2 fatal error detection: The digital sensor provides status information which are now considered in the sanity check for sensor values. The behavior in case of an error is the same as if an analog sensor would provide a out of bounce voltage.
author Ideenmodellierer
date Sun, 19 Feb 2023 21:51:19 +0100
parents 6871d4b586ff
children b392524753fb
files Discovery/Src/tCCR.c
diffstat 1 files changed, 20 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/tCCR.c	Sun Feb 19 21:48:47 2023 +0100
+++ b/Discovery/Src/tCCR.c	Sun Feb 19 21:51:19 2023 +0100
@@ -174,29 +174,29 @@
     }
 
     // test2: mV of remaining sensors
-    for(int i=0;i<3;i++)
+    for(index=0; index<3; index++)
     {
-    	sensorState[i] = sensorOK;
+    	sensorState[index] = sensorOK;
 
-        if(sensorActive[i])
+        if(sensorActive[index])
         {
-            if(	(stateUsed->lifeData.sensorVoltage_mV[i] < MIN_SENSOR_VOLTAGE_MV) ||
-                    (stateUsed->lifeData.sensorVoltage_mV[i] > MAX_SENSOR_VOLTAGE_MV))
-            {
-                sensorActive[i] = 0;
-                switch(i)
-                {
-                    case 0:
-                        sensorNotActiveBinary |= 1;
-                    break;
-                    case 1:
-                        sensorNotActiveBinary |= 2;
-                    break;
-                    case 2:
-                        sensorNotActiveBinary |= 4;
-                    break;
-                }
-            }
+        	if(((stateUsed->lifeData.extIf_sensor_map[index] == SENSOR_DIGO2) && (((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data))->status & DVO2_FATAL_ERROR))
+        			|| ((stateUsed->lifeData.sensorVoltage_mV[index] < MIN_SENSOR_VOLTAGE_MV) ||	(stateUsed->lifeData.sensorVoltage_mV[index] > MAX_SENSOR_VOLTAGE_MV)))
+			{
+				sensorActive[index] = 0;
+				switch(index)
+				{
+						case 0:
+							sensorNotActiveBinary |= 1;
+						break;
+						case 1:
+							sensorNotActiveBinary |= 2;
+						break;
+						case 2:
+							sensorNotActiveBinary |= 4;
+						break;
+				}
+        	}
         }
     }