Skip to content

Commit 635219e

Browse files
authored
Fix configuration for ESP32 UART pattern detection (#2153)
1 parent bfef579 commit 635219e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

targets/ESP32/_nanoCLR/System.IO.Ports/sys_io_ser_native_System_IO_Ports_SerialPort.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ void uart_event_task_sys(void *pvParameters)
128128
// Pattern detection used for the WatchChar
129129
watchCharPos = uart_pattern_get_pos(palUart->UartNum);
130130

131+
if (watchCharPos == 0)
132+
{
133+
// patter position has 0 index meaning that we are reading it now
134+
// pop it from the pattern queue
135+
uart_pattern_pop_pos(palUart->UartNum);
136+
}
137+
131138
// set flag
132139
readData = true;
133140
break;
@@ -1083,7 +1090,7 @@ HRESULT Library_sys_io_ser_native_System_IO_Ports_SerialPort::NativeSetWatchChar
10831090
watchChar = (uint8_t)pThis[FIELD___watchChar].NumericByRef().u1;
10841091

10851092
// Enable pattern detection for the serial device
1086-
uart_enable_pattern_det_baud_intr(uart_num, watchChar, 1, 10000, 10, 10);
1093+
uart_enable_pattern_det_baud_intr(uart_num, watchChar, 1, 9, 0, 00);
10871094
// Reset the pattern queue length to record at most 10 pattern positions.
10881095
uart_pattern_queue_reset(uart_num, 10);
10891096

0 commit comments

Comments
 (0)