diff Small_CPU/Src/uartProtocol_Co2.c @ 842:c3dd461ca3f9 Evo_2_23

Migrated Sentinel protocol to new UART structure: The Sentinel protocol had not been migrated to the new UART structure which was introduced with the introduction of the UART MUX. The Sentinel is now supported by autodetection again (development version only)
author Ideenmodellierer
date Mon, 15 Jan 2024 21:44:18 +0100
parents 9602a7338f28
children
line wrap: on
line diff
--- a/Small_CPU/Src/uartProtocol_Co2.c	Sun Jan 07 21:25:34 2024 +0100
+++ b/Small_CPU/Src/uartProtocol_Co2.c	Mon Jan 15 21:44:18 2024 +0100
@@ -27,7 +27,7 @@
 
 #ifdef ENABLE_CO2_SUPPORT
 static uint8_t CO2Connected = 0;						/* Binary indicator if a sensor is connected or not */
-static receiveState_t rxState = RX_Ready;
+static receiveStateCO2_t rxState = CO2RX_Ready;
 
 
 
@@ -137,7 +137,7 @@
 	uint8_t activeSensor = externalInterface_GetActiveUartSensor();
 	uartCO2Status_t localComState = externalInterface_GetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET);
 
-	if(rxState == RX_Ready)		/* identify data content */
+	if(rxState == CO2RX_Ready)		/* identify data content */
 	{
 		switch(data)
 		{
@@ -146,7 +146,7 @@
 			case 'D':
 			case 'Z':
 			case '.':			dataType = data;
-								rxState = RX_Data0;
+								rxState = CO2RX_Data0;
 								dataValue = 0;
 				break;
 			case '?':			localComState = UART_CO2_ERROR;
@@ -157,26 +157,26 @@
 	}
 	else if((data >= '0') && (data <= '9'))
 	{
-		if((rxState >= RX_Data0) && (rxState <= RX_Data4))
+		if((rxState >= CO2RX_Data0) && (rxState <= CO2RX_Data4))
 		{
 			dataValue = dataValue * 10 + (data - '0');
 			rxState++;
-			if(rxState == RX_Data5)
+			if(rxState == CO2RX_Data5)
 			{
-				rxState = RX_DataComplete;
+				rxState = CO2RX_DataComplete;
 			}
 		}
 		else	/* protocol error data has max 5 digits */
 		{
-			if(rxState != RX_DataComplete)	/* commands will not answer with number values */
+			if(rxState != CO2RX_DataComplete)	/* commands will not answer with number values */
 			{
-				rxState = RX_Ready;
+				rxState = CO2RX_Ready;
 			}
 		}
 	}
 	if((data == ' ') || (data == '\n'))	/* Abort data detection */
 	{
-		if(rxState == RX_DataComplete)
+		if(rxState == CO2RX_DataComplete)
 		{
 			CO2Connected = 1;
 			if(localComState == UART_CO2_SETUP)
@@ -204,13 +204,13 @@
 					break;
 				case '.':			externalInterface_SetCO2Scale(dataValue);
 					break;
-				default:			rxState = RX_Ready;
+				default:			rxState = CO2RX_Ready;
 					break;
 			}
 		}
-		if(rxState != RX_Data0)	/* reset state machine because message in wrong format */
+		if(rxState != CO2RX_Data0)	/* reset state machine because message in wrong format */
 		{
-			rxState = RX_Ready;
+			rxState = CO2RX_Ready;
 		}
 	}
 	externalInterface_SetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET,localComState);