fix: flush uart queue on parity and frame error

Signed-off-by: aleks <aleks@espressif.com>

Merges https://github.com/espressif/esp-modbus/pull/78
This commit is contained in:
Florian Kogler
2024-10-15 07:36:25 +02:00
committed by aleks
parent 4d15696f7f
commit aaee69ecfb

View File

@ -161,10 +161,14 @@ static void vUartTask(void *pvParameters)
//Event of UART parity check error //Event of UART parity check error
case UART_PARITY_ERR: case UART_PARITY_ERR:
ESP_LOGD(TAG, "uart parity error"); ESP_LOGD(TAG, "uart parity error");
xQueueReset(xMbUartQueue);
uart_flush_input(ucUartNumber);
break; break;
//Event of UART frame error //Event of UART frame error
case UART_FRAME_ERR: case UART_FRAME_ERR:
ESP_LOGD(TAG, "uart frame error"); ESP_LOGD(TAG, "uart frame error");
xQueueReset(xMbUartQueue);
uart_flush_input(ucUartNumber);
break; break;
default: default:
ESP_LOGD(TAG, "uart event type: %u", (unsigned)xEvent.type); ESP_LOGD(TAG, "uart event type: %u", (unsigned)xEvent.type);