comparison 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
comparison
equal deleted inserted replaced
746:7e84ae1513b6 747:df0d43da1614
206 206
207 #ifdef ENABLE_CO2_SUPPORT 207 #ifdef ENABLE_CO2_SUPPORT
208 void UART_HandleCO2Data(void) 208 void UART_HandleCO2Data(void)
209 { 209 {
210 uint8_t localRX = rxReadIndex; 210 uint8_t localRX = rxReadIndex;
211 uint8_t dataType = 0; 211 static uint8_t dataType = 0;
212 uint32_t dataValue = 0; 212 static uint32_t dataValue = 0;
213 static receiveState_t rxState = RX_Ready; 213 static receiveState_t rxState = RX_Ready;
214 static uint32_t lastReceiveTick = 0; 214 static uint32_t lastReceiveTick = 0;
215 215
216 216
217 while((rxBuffer[localRX]!=0)) 217 while((rxBuffer[localRX]!=0))
264 break; 264 break;
265 case 'l': LED_ZeroOffset = dataValue; 265 case 'l': LED_ZeroOffset = dataValue;
266 break; 266 break;
267 case 'Z': externalInterface_SetCO2Value(dataValue); 267 case 'Z': externalInterface_SetCO2Value(dataValue);
268 break; 268 break;
269 default: break; 269 default: rxState = RX_Ready;
270 break;
270 } 271 }
271 } 272 }
272 if(rxState != RX_Data0) /* reset state machine because message in wrong format */ 273 if(rxState != RX_Data0) /* reset state machine because message in wrong format */
273 { 274 {
274 rxState = RX_Ready; 275 rxState = RX_Ready;