diff Discovery/Src/tMenuEditHardware.c @ 827:ffb1036c27c2 Evo_2_23

Moved CO2 Menu from Xtra to Hardware: The first CO2 sensor menu implementation was placed within the Xtra menu. In the new version the CO2 options may be accessed using the sensor overview menu of the Hardware page. With this change it is no longer necessary to take care for compile switches in the menus because the menu will only be shown if a CO2 sensor is detected.
author Ideenmodellierer
date Sun, 05 Nov 2023 20:19:08 +0100
parents 26ae9e8f24fd
children c3dd461ca3f9
line wrap: on
line diff
--- a/Discovery/Src/tMenuEditHardware.c	Wed Oct 11 17:49:19 2023 +0200
+++ b/Discovery/Src/tMenuEditHardware.c	Sun Nov 05 20:19:08 2023 +0100
@@ -389,9 +389,9 @@
 	{
 		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->co2_sensor_active = 0;
 		pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_OPTIC;
-		for(index = 0; index < 3; index++)
+		for(index = 0; index < EXT_INTERFACE_SENSOR_CNT - 1; index++)
 		{
 				switch(pSettings->ext_sensor_map[index])
 				{
@@ -415,6 +415,9 @@
 											pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_DIGITAL;
 										}
 									break;
+					case SENSOR_CO2:
+					case SENSOR_CO2M:	pSettings->co2_sensor_active = 1;
+						break;
 #ifdef ENABLE_SENTINEL_MODE
 					case SENSOR_SENTINEL:	pSettings->ppo2sensors_source = O2_SENSOR_SOURCE_SENTINEL;
 									break;
@@ -524,15 +527,15 @@
 		write_label_var(  30, 340, ME_Y_LINE6, &FontT48, strSensorId);
    	}
 
-	if((pSettings->ext_sensor_map[0] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[0] < SENSOR_TYPE_O2_END))
+	if((pSettings->ext_sensor_map[0] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[0] < SENSOR_MUX))
 	{
 		tMenuEdit_refresh_field(StMHARD3_O2_Sensor1);
 	}
-	if((pSettings->ext_sensor_map[1] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[1] < SENSOR_TYPE_O2_END))
+	if((pSettings->ext_sensor_map[1] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[1] < SENSOR_MUX))
 	{
 		tMenuEdit_refresh_field(StMHARD3_O2_Sensor2);
 	}
-	if((pSettings->ext_sensor_map[2] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[2] < SENSOR_TYPE_O2_END))
+	if((pSettings->ext_sensor_map[2] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[2] < SENSOR_MUX))
 	{
 		tMenuEdit_refresh_field(StMHARD3_O2_Sensor3);
 	}
@@ -570,7 +573,7 @@
 		}
 	}
 
-	if(((pSettings->ext_sensor_map[0] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[0] >= SENSOR_TYPE_O2_END)))
+	if(((pSettings->ext_sensor_map[0] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[0] >= SENSOR_MUX)))
 	{
 		pSettings->ppo2sensors_deactivated |= 1;
 	}
@@ -578,7 +581,7 @@
 	{
 		write_field_on_off(StMHARD3_O2_Sensor1,	 30, 95, ME_Y_LINE1,  &FontT48, "", sensorActive[0]);
 	}
-	if(((pSettings->ext_sensor_map[1] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[1] >= SENSOR_TYPE_O2_END)))
+	if(((pSettings->ext_sensor_map[1] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[1] >= SENSOR_MUX)))
 	{
 		pSettings->ppo2sensors_deactivated |= 2;
 	}
@@ -586,7 +589,7 @@
 	{
 		 write_field_on_off(StMHARD3_O2_Sensor2,	 30, 95, ME_Y_LINE2,  &FontT48, "", sensorActive[1]);
 	}
-	if(((pSettings->ext_sensor_map[2] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[2] >= SENSOR_TYPE_O2_END)))
+	if(((pSettings->ext_sensor_map[2] < SENSOR_OPTIC) || (pSettings->ext_sensor_map[2] >= SENSOR_MUX)))
 	{
 		pSettings->ppo2sensors_deactivated |= 4;
 	}
@@ -627,15 +630,15 @@
 		write_field_button(StMHARD3_Sensor_Detect,	 30, 800, ME_Y_LINE6,  &FontT48, text);
    	}
 
-    if((pSettings->ext_sensor_map[0] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[0] < SENSOR_TYPE_O2_END))
+    if((pSettings->ext_sensor_map[0] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[0] < SENSOR_MUX))
 	{
 			setEvent(StMHARD3_O2_Sensor1, (uint32_t)OnAction_Sensor1);
 	}
-    if((pSettings->ext_sensor_map[1] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[1] < SENSOR_TYPE_O2_END))
+    if((pSettings->ext_sensor_map[1] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[1] < SENSOR_MUX))
 	{
 			setEvent(StMHARD3_O2_Sensor2, (uint32_t)OnAction_Sensor2);
 	}
-    if((pSettings->ext_sensor_map[2] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[2] < SENSOR_TYPE_O2_END))
+    if((pSettings->ext_sensor_map[2] >= SENSOR_OPTIC) && (pSettings->ext_sensor_map[2] < SENSOR_MUX))
 	{
 			setEvent(StMHARD3_O2_Sensor3, (uint32_t)OnAction_Sensor3);
 	}
@@ -661,7 +664,7 @@
 {
 	const SDiveState *pStateReal = stateRealGetPointer();
 
-	if(pStateReal->lifeData.extIf_sensor_map[0] == SENSOR_DIGO2M)
+	if((pStateReal->lifeData.extIf_sensor_map[0] == SENSOR_DIGO2M) || (pStateReal->lifeData.extIf_sensor_map[0] == SENSOR_CO2M))
 	{
 		return EXIT_TO_INFO_SENSOR;
 	}
@@ -687,7 +690,7 @@
 {
 	const SDiveState *pStateReal = stateRealGetPointer();
 
-	if(pStateReal->lifeData.extIf_sensor_map[1] == SENSOR_DIGO2M)
+	if((pStateReal->lifeData.extIf_sensor_map[1] == SENSOR_DIGO2M) || (pStateReal->lifeData.extIf_sensor_map[1] == SENSOR_CO2M))
 	{
 		return EXIT_TO_INFO_SENSOR;
 	}
@@ -712,7 +715,7 @@
 {
 	const SDiveState *pStateReal = stateRealGetPointer();
 
-	if(pStateReal->lifeData.extIf_sensor_map[2] == SENSOR_DIGO2M)
+	if((pStateReal->lifeData.extIf_sensor_map[2] == SENSOR_DIGO2M) || (pStateReal->lifeData.extIf_sensor_map[2] == SENSOR_CO2M))
 	{
 		return EXIT_TO_INFO_SENSOR;
 	}