Skip to content

Commit

Permalink
SUKU uart error alert added
Browse files Browse the repository at this point in the history
  • Loading branch information
SukuWc committed Jan 26, 2024
1 parent 6547a51 commit 5b18da5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Firmware/components/knot_midi_uart/knot_midi_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ void knot_midi_uart_rx_task(void* arg) {
break;
// Event of HW FIFO overflow detected
case UART_FIFO_OVF:

grid_alert_one_set(&grid_led_state, 1, 200, 0, 0, 30); // ERROR
ESP_LOGI(TAG, "hw fifo overflow");
// If fifo overflow happened, you should consider adding flow control for your application.
// The ISR has already reset the rx FIFO,
Expand All @@ -159,6 +161,8 @@ void knot_midi_uart_rx_task(void* arg) {
break;
// Event of UART ring buffer full
case UART_BUFFER_FULL:

grid_alert_one_set(&grid_led_state, 2, 200, 0, 0, 30); // ERROR
ESP_LOGI(TAG, "ring buffer full");
// If buffer full happened, you should consider encreasing your buffer size
// As an example, we directly flush the rx buffer here in order to read more data.
Expand All @@ -167,18 +171,22 @@ void knot_midi_uart_rx_task(void* arg) {
break;
// Event of UART RX break detected
case UART_BREAK:
grid_alert_one_set(&grid_led_state, 0, 200, 0, 0, 30); // ERROR
ESP_LOGI(TAG, "uart rx break");
break;
// Event of UART parity check error
case UART_PARITY_ERR:
grid_alert_one_set(&grid_led_state, 0, 200, 0, 0, 30); // ERROR
ESP_LOGI(TAG, "uart parity error");
break;
// Event of UART frame error
case UART_FRAME_ERR:
grid_alert_one_set(&grid_led_state, 0, 200, 0, 0, 30); // ERROR
ESP_LOGI(TAG, "uart frame error");
break;
// UART_PATTERN_DET
case UART_PATTERN_DET:
grid_alert_one_set(&grid_led_state, 0, 200, 0, 0, 30); // ERROR
uart_get_buffered_data_len(EX_UART_NUM, &buffered_size);
int pos = uart_pattern_pop_pos(EX_UART_NUM);
ESP_LOGI(TAG, "[UART PATTERN DETECTED] pos: %d, buffered size: %d", pos, buffered_size);
Expand All @@ -198,6 +206,7 @@ void knot_midi_uart_rx_task(void* arg) {
break;
// Others
default:
grid_alert_one_set(&grid_led_state, 0, 0, 0, 200, 30); // ERROR
ESP_LOGI(TAG, "uart event type: %d", event.type);
break;
}
Expand Down

0 comments on commit 5b18da5

Please sign in to comment.