Skip to content

Commit cf4b268

Browse files
committed
Fix SerialEvent
Serial events weren't working entirely due to a parent board only having a single uart. Now it works as expected
1 parent bb0a194 commit cf4b268

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Diff for: cores/esp32/HardwareSerial.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ void HardwareSerial::flush(bool txOnly)
158158
{
159159
uartFlushTxOnly(_uart, txOnly);
160160
}
161+
void serialEventRun(void)
162+
{
163+
if (Serial1.available()) serialEvent1();
164+
if (Serial2.available()) serialEvent2();
165+
}
166+
void serialEvent1() { }
167+
void serialEvent2() { }
161168

162169
size_t HardwareSerial::write(uint8_t c)
163170
{

Diff for: cores/esp32/HardwareSerial.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ class HardwareSerial: public Stream
106106
uart_t* _uart;
107107
};
108108

109-
extern void serialEventRun(void) __attribute__((weak));
109+
void serialEventRun(void) __attribute__((weak));
110+
extern void serialEvent1() __attribute__((weak));
111+
extern void serialEvent2() __attribute__((weak));
110112

111113
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
112114
extern HardwareSerial Serial;

0 commit comments

Comments
 (0)