[Taranis] Overrun errors on S.PORT are now counted and it's possible to display the errors count in the CLI

This commit is contained in:
Bertrand Songis
2016-03-19 12:06:43 +01:00
parent f622d7cf6d
commit 4443ab22ee
3 changed files with 9 additions and 2 deletions
@@ -21,6 +21,7 @@
#include "opentx.h"
Fifo<uint8_t, 32> telemetryFifo;
uint32_t telemetryErrors = 0;
void telemetryPortInit(uint32_t baudrate)
{
@@ -125,7 +126,10 @@ extern "C" void TELEMETRY_USART_IRQHandler(void)
uint32_t status = TELEMETRY_USART->SR;
while (status & (USART_FLAG_RXNE | USART_FLAG_ERRORS)) {
uint8_t data = TELEMETRY_USART->DR;
if (!(status & USART_FLAG_ERRORS)) {
if (status & USART_FLAG_ERRORS) {
telemetryErrors++;
}
else {
telemetryFifo.push(data);
}
status = TELEMETRY_USART->SR;