diff Small_CPU/Src/externalInterface.c @ 742:e23fe82cbf8c

Update Sentinel protocol: The Sentinel protocol is now supported by autodetection. Added Autodetection indicator: In the previous version no indicator showed that an auto detection is running. A new pseudo sensor type has been introduced which now causes the auto detection string to be displayed while the detection is running in the background.
author Ideenmodellierer
date Sun, 19 Feb 2023 21:43:24 +0100
parents 30717de00f3a
children 7e84ae1513b6
line wrap: on
line diff
--- a/Small_CPU/Src/externalInterface.c	Thu Feb 02 17:35:54 2023 +0100
+++ b/Small_CPU/Src/externalInterface.c	Sun Feb 19 21:43:24 2023 +0100
@@ -313,8 +313,10 @@
 		case 0:
 		case (EXT_INTERFACE_UART_CO2 >> 8):
 		case (EXT_INTERFACE_UART_O2 >> 8):
+		case (EXT_INTERFACE_UART_SENTINEL >> 8):
 				if((externalAutoDetect <= DETECTION_START) || ((protocol == EXT_INTERFACE_UART_CO2 >> 8) && (externalAutoDetect == DETECTION_CO2))
-														   || ((protocol == EXT_INTERFACE_UART_O2 >> 8) && (externalAutoDetect == DETECTION_DIGO2)))
+														   || ((protocol == EXT_INTERFACE_UART_O2 >> 8) && (externalAutoDetect == DETECTION_DIGO2))
+														   || ((protocol == EXT_INTERFACE_UART_SENTINEL >> 8) && (externalAutoDetect == DETECTION_SENTINEL)))
 				{
 					sensorDataId = 0;
 					externalUART_Protocol = protocol;
@@ -486,7 +488,8 @@
 										UART_setTargetChannel(index);
 										/* tmpSensorMap[sensorIndex++] = SENSOR_DIGO2; */
 									}
-									externalAutoDetect = DETECTION_CO2;
+									externalAutoDetect++;
+#ifdef ENABLE_CO2_SUPPORT
 									externalInterface_SwitchUART(EXT_INTERFACE_UART_CO2 >> 8);
 				break;
 			case DETECTION_CO2:		if(UART_isCO2Connected())
@@ -508,7 +511,25 @@
 										}
 
 									}
-									externalAutoDetect = DETECTION_DONE;
+									externalAutoDetect++;
+#endif
+#ifdef ENABLE_SENTINEL_MODE
+									externalInterface_SwitchUART(EXT_INTERFACE_UART_SENTINEL >> 8);
+									UART_StartDMA_Receiption();
+				break;
+
+			case DETECTION_SENTINEL:
+			case DETECTION_SENTINEL2:
+									if(UART_isSentinelConnected())
+									{
+										for(index = 0; index < 3; index++)	/* Sentinel is occupiing all sensor slots */
+										{
+											tmpSensorMap[index] = SENSOR_SENTINEL;
+										}
+										sensorIndex = 3;
+									}
+									externalAutoDetect++;
+#endif
 				break;
 			case DETECTION_DONE:	for(index = 0; index < EXT_INTERFACE_SENSOR_CNT; index++)
 									{
@@ -550,6 +571,10 @@
 	switch(Cmd & 0x00FF)		/* lower byte is reserved for commands */
 	{
 		case EXT_INTERFACE_AUTODETECT:	externalAutoDetect = DETECTION_INIT;
+										for(index = 0; index < 3; index++)
+										{
+											SensorMap[index] = SENSOR_SEARCH;
+										}
 			break;
 		case EXT_INTERFACE_CO2_CALIB:	cmdLength = snprintf(cmdString, 10, "G\r\n");
 			break;