changeset 577:9bb9a52d6ae5

Handle o2 voltage values < 0.5mV as invalid: Values < 0.5mv will now be handled as ppo2 = 0Bar to avaid problems (e.g. by negativ values) in the decompression calculation. In the custom display sensors with low voltage are show using '-'
author Ideenmodellierer
date Sun, 29 Nov 2020 22:58:11 +0100
parents 1105cf7bbf6f
children beb4d47542f1
files Discovery/Inc/t7.h Discovery/Src/data_exchange_main.c Discovery/Src/t3.c Discovery/Src/t7.c
diffstat 4 files changed, 27 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Inc/t7.h	Sun Nov 29 22:55:31 2020 +0100
+++ b/Discovery/Inc/t7.h	Sun Nov 29 22:58:11 2020 +0100
@@ -61,6 +61,7 @@
 
 void t7_change_field(void);
 void t7_change_customview(uint8_t action);
+void t7_select_customview(uint8_t selectedCustomview);
 
 void t7_set_field_to_primary(void);
 void t7_set_customview_to_primary(void);
--- a/Discovery/Src/data_exchange_main.c	Sun Nov 29 22:55:31 2020 +0100
+++ b/Discovery/Src/data_exchange_main.c	Sun Nov 29 22:58:11 2020 +0100
@@ -102,6 +102,8 @@
 #define UNKNOWN_DATE_MONTH		1
 #define UNKNOWN_DATE_YEAR		16
 
+#define IGNORE_O2_VOLTAGE_LEVEL_MV	(0.5f)
+
 /* Private function prototypes -----------------------------------------------*/
 static uint8_t DataEX_check_header_and_footer_ok(void);
 static uint8_t DataEX_check_header_and_footer_shifted(void);
@@ -774,7 +776,7 @@
 {
 	SDiveState *pStateReal = stateRealGetPointerWrite();
 	static uint16_t getDeviceDataAfterStartOfMainCPU = 20;
-	
+	uint8_t idx;
 	
 	// wireless - �ltere daten aufr�umen
 #if 0
@@ -880,12 +882,20 @@
 	{
 		if(pStateReal->data_old__lost_connection_to_slave == 0)
 		{
-			pStateReal->lifeData.sensorVoltage_mV[0] = dataIn.data[0].extADC_voltage[0];
-			pStateReal->lifeData.sensorVoltage_mV[1] = dataIn.data[0].extADC_voltage[1];
-			pStateReal->lifeData.sensorVoltage_mV[2] = dataIn.data[0].extADC_voltage[2];
-			pStateReal->lifeData.ppO2Sensor_bar[0] = pStateReal->lifeData.sensorVoltage_mV[0] * pSettings->ppo2sensors_calibCoeff[0];
-			pStateReal->lifeData.ppO2Sensor_bar[1] = pStateReal->lifeData.sensorVoltage_mV[1] * pSettings->ppo2sensors_calibCoeff[1];
-			pStateReal->lifeData.ppO2Sensor_bar[2] = pStateReal->lifeData.sensorVoltage_mV[2] * pSettings->ppo2sensors_calibCoeff[2];
+			for(idx = 0; idx < 3; idx++)
+			{
+				pStateReal->lifeData.sensorVoltage_mV[idx] = dataIn.data[0].extADC_voltage[idx];
+				if(pStateReal->lifeData.sensorVoltage_mV[idx] < IGNORE_O2_VOLTAGE_LEVEL_MV)
+				{
+					pStateReal->lifeData.sensorVoltage_mV[idx] = 0.0;
+					pStateReal->lifeData.ppO2Sensor_bar[idx] = 0;
+				}
+				else
+				{
+					pStateReal->lifeData.ppO2Sensor_bar[idx] = pStateReal->lifeData.sensorVoltage_mV[idx] * pSettings->ppo2sensors_calibCoeff[idx];
+				}
+
+			}
 		}
 	}
 
--- a/Discovery/Src/t3.c	Sun Nov 29 22:55:31 2020 +0100
+++ b/Discovery/Src/t3.c	Sun Nov 29 22:58:11 2020 +0100
@@ -1029,7 +1029,7 @@
             else if(i==2)
                 text[textpointer++] = '\002';		/* right  */
 
-            if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i))
+            if((stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) || (stateUsed->lifeData.ppO2Sensor_bar[i] == 0.0))
             {
                 text[textpointer++] = '\031';
                 text[textpointer++] = ' ';
--- a/Discovery/Src/t7.c	Sun Nov 29 22:55:31 2020 +0100
+++ b/Discovery/Src/t7.c	Sun Nov 29 22:58:11 2020 +0100
@@ -1662,6 +1662,13 @@
     selection_customview = *pViews;
 }
 
+void t7_select_customview(uint8_t selectedCustomview)
+{
+	if(selectedCustomview < CVIEW_END)
+	{
+		selection_customview = selectedCustomview;
+	}
+}
 
 uint8_t t7_get_length_of_customtext(void)
 {
@@ -1976,7 +1983,7 @@
         text[textpointer++] = '\030'; // main color
         for(int i=0;i<3;i++)
         {
-            if(stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i))
+            if((stateUsed->diveSettings.ppo2sensors_deactivated & (1<<i)) || (stateUsed->lifeData.ppO2Sensor_bar[i] == 0.0))
             {
                 text[textpointer++] = '\031'; // labelcolor
                 text[textpointer++] = '\001';