Skip to content

Commit ca9ac20

Browse files
authored
This change assures us that the event task is always re-created when begin() is called.
1 parent def319a commit ca9ac20

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cores/esp32/HardwareSerial.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,8 @@ void HardwareSerial::begin(unsigned long baud, uint32_t config, int8_t rxPin, in
369369
}
370370
// create a task to deal with Serial Events when, for example, calling begin() twice to change the baudrate,
371371
// or when setting the callback before calling begin()
372-
if (_uart != NULL && (_onReceiveCB != NULL || _onReceiveErrorCB != NULL) && _eventTask == NULL) {
372+
if (_uart != NULL && (_onReceiveCB != NULL || _onReceiveErrorCB != NULL)) {
373+
_destroyEventTask();
373374
_createEventTask(this);
374375
}
375376

0 commit comments

Comments
 (0)