File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
libraries/ESP32/examples/Serial/onReceiveExample Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ SemaphoreHandle_t uart_buffer_Mutex = NULL;
7070// task created when onReceive() is used
7171void UART0_RX_CB () {
7272 // take the mutex, waits forever until loop() finishes its processing
73- if (uart_buffer_Mutex != NULL && xSemaphoreTake (uart_buffer_Mutex, portMAX_DELAY)) {
73+ if (xSemaphoreTake (uart_buffer_Mutex, portMAX_DELAY)) {
7474 uint32_t now = millis (); // tracks timeout
7575 while ((millis () - now) < communicationTimeout_ms) {
7676 if (UART0.available ()) {
@@ -106,7 +106,7 @@ uint32_t counter = 0;
106106void loop () {
107107 if (uart_buffer.length () > 0 ) {
108108 // signals that the onReceive function shall not change uart_buffer while processing
109- if (uart_buffer_Mutex != NULL && xSemaphoreTake (uart_buffer_Mutex, portMAX_DELAY)) {
109+ if (xSemaphoreTake (uart_buffer_Mutex, portMAX_DELAY)) {
110110 // process the received data from UART0 - example, just print it beside a counter
111111 UART0.print (" [" );
112112 UART0.print (counter++);
You can’t perform that action at this time.
0 commit comments