Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0d5d50e

Browse filesBrowse files
authored
feat(uart): eliminates nonexistent functions (#10428)
loop() calls Serial Events functions when those are declared. The way it was declared was forcing to alway call avalable() to then call an empty function. This commit fixes it.
1 parent 630377f commit 0d5d50e
Copy full SHA for 0d5d50e

File tree

1 file changed

+5
-10
lines changed
Filter options

1 file changed

+5
-10
lines changed

‎cores/esp32/HardwareSerial.cpp

Copy file name to clipboardExpand all lines: cores/esp32/HardwareSerial.cpp
+5-10Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,13 @@
2424
#endif
2525

2626
void serialEvent(void) __attribute__((weak));
27-
void serialEvent(void) {}
2827

2928
#if SOC_UART_NUM > 1
3029
void serialEvent1(void) __attribute__((weak));
31-
void serialEvent1(void) {}
3230
#endif /* SOC_UART_NUM > 1 */
3331

3432
#if SOC_UART_NUM > 2
3533
void serialEvent2(void) __attribute__((weak));
36-
void serialEvent2(void) {}
3734
#endif /* SOC_UART_NUM > 2 */
3835

3936
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
@@ -48,37 +45,35 @@ HardwareSerial Serial2(2);
4845

4946
#if HWCDC_SERIAL_IS_DEFINED == 1 // Hardware JTAG CDC Event
5047
extern void HWCDCSerialEvent(void) __attribute__((weak));
51-
void HWCDCSerialEvent(void) {}
5248
#endif
5349

5450
#if USB_SERIAL_IS_DEFINED == 1 // Native USB CDC Event
5551
// Used by Hardware Serial for USB CDC events
5652
extern void USBSerialEvent(void) __attribute__((weak));
57-
void USBSerialEvent(void) {}
5853
#endif
5954

6055
void serialEventRun(void) {
6156
#if HWCDC_SERIAL_IS_DEFINED == 1 // Hardware JTAG CDC Event
62-
if (HWCDCSerial.available()) {
57+
if (HWCDCSerialEvent && HWCDCSerial.available()) {
6358
HWCDCSerialEvent();
6459
}
6560
#endif
6661
#if USB_SERIAL_IS_DEFINED == 1 // Native USB CDC Event
67-
if (USBSerial.available()) {
62+
if (USBSerialEvent && USBSerial.available()) {
6863
USBSerialEvent();
6964
}
7065
#endif
7166
// UART0 is default serialEvent()
72-
if (Serial0.available()) {
67+
if (serialEvent && Serial0.available()) {
7368
serialEvent();
7469
}
7570
#if SOC_UART_NUM > 1
76-
if (Serial1.available()) {
71+
if (serialEvent1 && Serial1.available()) {
7772
serialEvent1();
7873
}
7974
#endif
8075
#if SOC_UART_NUM > 2
81-
if (Serial2.available()) {
76+
if (serialEvent2 && Serial2.available()) {
8277
serialEvent2();
8378
}
8479
#endif

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.