Mercurial > public > ostc4
diff Small_CPU/Src/uartProtocol_O2.c @ 981:c6c781a2e85b default
Merge into default
| author | heinrichsweikamp |
|---|---|
| date | Tue, 11 Feb 2025 18:12:00 +0100 |
| parents | 0b81ac558e89 |
| children |
line wrap: on
line diff
--- a/Small_CPU/Src/uartProtocol_O2.c Tue Aug 13 13:24:54 2024 +0200 +++ b/Small_CPU/Src/uartProtocol_O2.c Tue Feb 11 18:12:00 2025 +0100 @@ -75,6 +75,7 @@ static uint8_t lastComState = 0; static uint8_t lastActiveSensor = 0xFF; + uint8_t *pmap = externalInterface_GetSensorMapPointer(0); uint8_t activeSensor = externalInterface_GetActiveUartSensor(); uartO2Status_t localComState = externalInterface_GetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET); @@ -96,7 +97,7 @@ { localComState = UART_O2_IDLE; } - UART_FlushRxBuffer(); + UART_ReadData(SENSOR_DIGO2, 1); /* flush buffer */ } if(localComState == UART_O2_INIT) @@ -106,13 +107,16 @@ localComState = UART_O2_CHECK; lastComState = UART_O2_CHECK; + UART_ReadData(SENSOR_DIGO2, 1); /* flush buffer */ uartO2_SetupCmd(localComState,cmdString,&cmdLength); - + UART_SendCmdString(cmdString); + if(pmap[EXT_INTERFACE_SENSOR_CNT-1] != SENSOR_MUX) /* stand alone mode => add some time for sensor com setup */ + { + HAL_Delay(80); + } rxState = O2RX_CONFIRM; respondErrorDetected = 0; digO2Connected = 0; - - UART_StartDMA_Receiption(); } else { @@ -135,6 +139,10 @@ rxState = O2RX_CONFIRM; uartO2_SetupCmd(localComState,cmdString,&cmdLength); UART_SendCmdString(cmdString); + if(localComState == UART_O2_CHECK) + { + localComState = UART_O2_IDLE; /* confirmation seems to be send after blinking => the response could be longer as the channel switch time => ignore */ + } } externalInterface_SetSensorState(activeSensor + EXT_INTERFACE_MUX_OFFSET,localComState); }
