Mercurial > public > ostc4
diff Small_CPU/Src/uart.c @ 809:9602a7338f28
DevBugfix CO2 sensor in streaming mode:
In standalone mode (no multiplexer) the CO2 sensor is working in streaming mode => it could happen that the OSTC received data before the scaling factor was requested. As result the CO2 values were calculated with a zero value. This problem has been fixed.
In addition some code cleanup has been done. Unifying usage of changeBaudrate function instead of old baud selection based on protocol request of Discovery firmware.
author | Ideenmodellierer |
---|---|
date | Sun, 27 Aug 2023 20:51:13 +0200 |
parents | 96ffad0a4e57 |
children | c3dd461ca3f9 |
line wrap: on
line diff
--- a/Small_CPU/Src/uart.c Sat Aug 26 13:38:13 2023 +0200 +++ b/Small_CPU/Src/uart.c Sun Aug 27 20:51:13 2023 +0200 @@ -202,7 +202,7 @@ void UART_ChangeBaudrate(uint32_t newBaudrate) { - + uint8_t dmaWasActive = dmaActive; // HAL_DMA_Abort(&hdma_usart1_rx); MX_USART1_UART_DeInit(); //HAL_UART_Abort(&huart1); @@ -213,8 +213,9 @@ huart1.Init.BaudRate = newBaudrate; HAL_UART_Init(&huart1); MX_USART1_DMA_Init(); - if(dmaActive) + if(dmaWasActive) { + memset(rxBuffer,BUFFER_NODATA,sizeof(rxBuffer)); rxReadIndex = 0; rxWriteIndex = 0; dmaActive = 0; @@ -392,10 +393,7 @@ } if((rxWriteIndex / CHUNK_SIZE) != (rxReadIndex / CHUNK_SIZE) || (rxWriteIndex == rxReadIndex)) /* start next transfer if we did not catch up with read index */ { - if(externalInterface_GetUARTProtocol() != 0) - { - UART_StartDMA_Receiption(); - } + UART_StartDMA_Receiption(); } } } @@ -441,7 +439,8 @@ rxReadIndex = 0; } } - } + + /************************ (C) COPYRIGHT heinrichs weikamp *****END OF FILE****/