Skip to content

Commit 5e472cb

Browse files
authored
feat(uart): only enable on_receive task if necessary
The onReceive Task was created by default when Serial.begin() is executed. This creates a additonal Task that degrades the performance of the whole arduino sketch. This will be done now only if onReceive() is called.
1 parent 8ce5f77 commit 5e472cb

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

cores/esp32/HardwareSerial.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,6 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
368368
_uart = NULL;
369369
}
370370
}
371-
// create a task to deal with Serial Events when, for example, calling begin() twice to change the baudrate,
372-
// or when setting the callback before calling begin()
373-
if (_uart != NULL && (_onReceiveCB != NULL || _onReceiveErrorCB != NULL) && _eventTask == NULL) {
374-
_createEventTask(this);
375-
}
376371

377372
// Set UART RX timeout
378373
uartSetRxTimeout(_uart, _rxTimeout);

0 commit comments

Comments
 (0)