Skip to content

Commit baad42e

Browse files
authored
fix(uart): applies #10428 to 2.0.x core
1 parent 8ff2da7 commit baad42e

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

cores/esp32/HardwareSerial.cpp

+5-8
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,13 @@
2323
#endif
2424

2525
void serialEvent(void) __attribute__((weak));
26-
void serialEvent(void) {}
2726

2827
#if SOC_UART_NUM > 1
2928
void serialEvent1(void) __attribute__((weak));
30-
void serialEvent1(void) {}
3129
#endif /* SOC_UART_NUM > 1 */
3230

3331
#if SOC_UART_NUM > 2
3432
void serialEvent2(void) __attribute__((weak));
35-
void serialEvent2(void) {}
3633
#endif /* SOC_UART_NUM > 2 */
3734

3835
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
@@ -51,18 +48,18 @@ HardwareSerial Serial2(2);
5148
void serialEventRun(void)
5249
{
5350
#if HWCDC_SERIAL_IS_DEFINED == 1 // Hardware JTAG CDC Event
54-
if(HWCDCSerial.available()) HWCDCSerialEvent();
51+
if(HWCDCSerialEvent && HWCDCSerial.available()) HWCDCSerialEvent();
5552
#endif
5653
#if USB_SERIAL_IS_DEFINED == 1 // Native USB CDC Event
57-
if(USBSerial.available()) USBSerialEvent();
54+
if(USBSerialEvent && USBSerial.available()) USBSerialEvent();
5855
#endif
5956
// UART0 is default serialEvent()
60-
if(Serial.available()) serialEvent();
57+
if(serialEvent && Serial.available()) serialEvent();
6158
#if SOC_UART_NUM > 1
62-
if(Serial1.available()) serialEvent1();
59+
if(serialEvent1 && Serial1.available()) serialEvent1();
6360
#endif
6461
#if SOC_UART_NUM > 2
65-
if(Serial2.available()) serialEvent2();
62+
if(serialEvent2 && Serial2.available()) serialEvent2();
6663
#endif
6764
}
6865
#endif

0 commit comments

Comments
 (0)