File tree 1 file changed +2
-2
lines changed
libraries/ESP32/examples/Serial/onReceiveExample
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;
70
70
// task created when onReceive() is used
71
71
void UART0_RX_CB () {
72
72
// 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)) {
74
74
uint32_t now = millis (); // tracks timeout
75
75
while ((millis () - now) < communicationTimeout_ms) {
76
76
if (UART0.available ()) {
@@ -106,7 +106,7 @@ uint32_t counter = 0;
106
106
void loop () {
107
107
if (uart_buffer.length () > 0 ) {
108
108
// 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)) {
110
110
// process the received data from UART0 - example, just print it beside a counter
111
111
UART0.print (" [" );
112
112
UART0.print (counter++);
You can’t perform that action at this time.
0 commit comments