From baad42e4a27655d227a8a41a47fd4f546acdb286 Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Mon, 7 Oct 2024 00:19:18 -0300 Subject: [PATCH 1/2] fix(uart): applies #10428 to 2.0.x core --- cores/esp32/HardwareSerial.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/cores/esp32/HardwareSerial.cpp b/cores/esp32/HardwareSerial.cpp index 178f69ca9bb..61de843392c 100644 --- a/cores/esp32/HardwareSerial.cpp +++ b/cores/esp32/HardwareSerial.cpp @@ -23,16 +23,13 @@ #endif void serialEvent(void) __attribute__((weak)); -void serialEvent(void) {} #if SOC_UART_NUM > 1 void serialEvent1(void) __attribute__((weak)); -void serialEvent1(void) {} #endif /* SOC_UART_NUM > 1 */ #if SOC_UART_NUM > 2 void serialEvent2(void) __attribute__((weak)); -void serialEvent2(void) {} #endif /* SOC_UART_NUM > 2 */ #if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL) @@ -51,18 +48,18 @@ HardwareSerial Serial2(2); void serialEventRun(void) { #if HWCDC_SERIAL_IS_DEFINED == 1 // Hardware JTAG CDC Event - if(HWCDCSerial.available()) HWCDCSerialEvent(); + if(HWCDCSerialEvent && HWCDCSerial.available()) HWCDCSerialEvent(); #endif #if USB_SERIAL_IS_DEFINED == 1 // Native USB CDC Event - if(USBSerial.available()) USBSerialEvent(); + if(USBSerialEvent && USBSerial.available()) USBSerialEvent(); #endif // UART0 is default serialEvent() - if(Serial.available()) serialEvent(); + if(serialEvent && Serial.available()) serialEvent(); #if SOC_UART_NUM > 1 - if(Serial1.available()) serialEvent1(); + if(serialEvent1 && Serial1.available()) serialEvent1(); #endif #if SOC_UART_NUM > 2 - if(Serial2.available()) serialEvent2(); + if(serialEvent2 && Serial2.available()) serialEvent2(); #endif } #endif From 3d57815a1ae1b8f5d078e75fbda914f3ddb3794c Mon Sep 17 00:00:00 2001 From: Rodrigo Garcia Date: Mon, 7 Oct 2024 00:29:59 -0300 Subject: [PATCH 2/2] fix(uart): there is no usb serial event in 2.0.x --- cores/esp32/HardwareSerial.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cores/esp32/HardwareSerial.cpp b/cores/esp32/HardwareSerial.cpp index 61de843392c..28061d5f6b5 100644 --- a/cores/esp32/HardwareSerial.cpp +++ b/cores/esp32/HardwareSerial.cpp @@ -47,12 +47,6 @@ HardwareSerial Serial2(2); void serialEventRun(void) { -#if HWCDC_SERIAL_IS_DEFINED == 1 // Hardware JTAG CDC Event - if(HWCDCSerialEvent && HWCDCSerial.available()) HWCDCSerialEvent(); -#endif -#if USB_SERIAL_IS_DEFINED == 1 // Native USB CDC Event - if(USBSerialEvent && USBSerial.available()) USBSerialEvent(); -#endif // UART0 is default serialEvent() if(serialEvent && Serial.available()) serialEvent(); #if SOC_UART_NUM > 1