diff Small_CPU/Src/uart.c @ 747:df0d43da1614

Added pressure compensation to CO2 detection: A pressure compensation is needed if the ExplorIR shall be used under extended pressure conditions. The procedure recommended by the application note has been integrated. To keep things simple the focus of the CO2 measurement is not the precision, as it is needed for the decompression calculation, but the indication of a critical increase of CO2 in the breathing loop. That's why only a lookup table with 1000ppm steps has been implemented instead of calculating the polynom for every measurement.
author Ideenmodellierer
date Sun, 05 Mar 2023 22:06:47 +0100
parents e23fe82cbf8c
children 0b5f45448eb6
line wrap: on
line diff
--- a/Small_CPU/Src/uart.c	Tue Feb 21 21:19:31 2023 +0100
+++ b/Small_CPU/Src/uart.c	Sun Mar 05 22:06:47 2023 +0100
@@ -208,8 +208,8 @@
 void UART_HandleCO2Data(void)
 {
 	uint8_t localRX = rxReadIndex;
-	uint8_t dataType = 0;
-	uint32_t dataValue = 0;
+	static uint8_t dataType = 0;
+	static uint32_t dataValue = 0;
 	static receiveState_t rxState = RX_Ready;
 	static uint32_t lastReceiveTick = 0;
 
@@ -266,7 +266,8 @@
 						break;
 					case 'Z':			externalInterface_SetCO2Value(dataValue);
 						break;
-					default: break;
+					default:			rxState = RX_Ready;
+						break;
 				}
 			}
 			if(rxState != RX_Data0)	/* reset state machine because message in wrong format */