changeset 797:acf6614dc396

Use mirror sensortype for visualization: The visualization of O2 sensor data is still based on the three slots. To make the usage of these slots more transparent and easy "mirror" sensortypes have been introduced. These types may be used within the refresh to switch the source. E.g. if only one or two slots are used for O2 values the the third may be used for CO2 data. By using the mirror the datastream does no longer need to be manipulated (copying Co2data in variables named O2xyz).
author Ideenmodellierer
date Mon, 31 Jul 2023 20:10:27 +0200
parents 75ace7af8212
children e9eba334b942
files Discovery/Src/tCCR.c Discovery/Src/tMenuEditHardware.c
diffstat 2 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Discovery/Src/tCCR.c	Mon Jul 31 20:00:06 2023 +0200
+++ b/Discovery/Src/tCCR.c	Mon Jul 31 20:10:27 2023 +0200
@@ -180,8 +180,8 @@
 
         if(sensorActive[index])
         {
-        	if(((stateUsed->lifeData.extIf_sensor_map[index] == SENSOR_DIGO2) && (((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status & DVO2_FATAL_ERROR))
-        			|| ((stateUsed->lifeData.extIf_sensor_map[index] != SENSOR_DIGO2)
+        	if(((stateUsed->lifeData.extIf_sensor_map[index] == SENSOR_DIGO2M) && (((SSensorDataDiveO2*)(stateUsed->lifeData.extIf_sensor_data[index]))->status & DVO2_FATAL_ERROR))
+        			|| ((stateUsed->lifeData.extIf_sensor_map[index] != SENSOR_DIGO2M)
         					&& (((stateUsed->lifeData.sensorVoltage_mV[index] < MIN_SENSOR_VOLTAGE_MV) || (stateUsed->lifeData.sensorVoltage_mV[index] > MAX_SENSOR_VOLTAGE_MV)))))
 			{
 				sensorActive[index] = 0;
--- a/Discovery/Src/tMenuEditHardware.c	Mon Jul 31 20:00:06 2023 +0200
+++ b/Discovery/Src/tMenuEditHardware.c	Mon Jul 31 20:10:27 2023 +0200
@@ -385,9 +385,9 @@
     const SDiveState *pStateReal = stateRealGetPointer();
     SSettings *pSettings = settingsGetPointer();
 
-	if(memcmp(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, 5) != 0)
+	if(memcmp(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, EXT_INTERFACE_SENSOR_CNT) != 0)
 	{
-		memcpy(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, 5);
+		memcpy(pSettings->ext_sensor_map, pStateReal->lifeData.extIf_sensor_map, EXT_INTERFACE_SENSOR_CNT);
 		pSettings->ppo2sensors_deactivated = 0x0;	/* deactivation will be done by openEditO2Sensor if need */
 
 		pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_OPTIC;
@@ -406,7 +406,7 @@
 											pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_ANALOG;
 										}
 									break;
-					case SENSOR_DIGO2:	if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG)
+					case SENSOR_DIGO2M:	if(pSettings->ppo2sensors_source == O2_SENSOR_SOURCE_ANALOG)
 										{
 											pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_ANADIG;
 										}
@@ -454,7 +454,8 @@
 								break;
 				case SENSOR_ANALOG:	strSensorId[4] = TXT2BYTE_O2IFAnalog;
 								break;
-				case SENSOR_DIGO2: strSensorId[4] = TXT2BYTE_O2IFDigital;
+				case SENSOR_DIGO2:
+				case SENSOR_DIGO2M: strSensorId[4] = TXT2BYTE_O2IFDigital;
 								break;
 				case SENSOR_CO2: strSensorId[3] = 'C';
 								 strSensorId[4] = 'O';
@@ -655,7 +656,7 @@
 {
 	const SDiveState *pStateReal = stateRealGetPointer();
 
-	if(pStateReal->lifeData.extIf_sensor_map[0] == SENSOR_DIGO2)
+	if(pStateReal->lifeData.extIf_sensor_map[0] == SENSOR_DIGO2M)
 	{
 		return EXIT_TO_INFO_SENSOR;
 	}
@@ -681,7 +682,7 @@
 {
 	const SDiveState *pStateReal = stateRealGetPointer();
 
-	if(pStateReal->lifeData.extIf_sensor_map[1] == SENSOR_DIGO2)
+	if(pStateReal->lifeData.extIf_sensor_map[1] == SENSOR_DIGO2M)
 	{
 		return EXIT_TO_INFO_SENSOR;
 	}
@@ -706,7 +707,7 @@
 {
 	const SDiveState *pStateReal = stateRealGetPointer();
 
-	if(pStateReal->lifeData.extIf_sensor_map[2] == SENSOR_DIGO2)
+	if(pStateReal->lifeData.extIf_sensor_map[2] == SENSOR_DIGO2M)
 	{
 		return EXIT_TO_INFO_SENSOR;
 	}