Skip to content

Commit

Permalink
Fix compilation error when USB CDC on Boot is enabled
Browse files Browse the repository at this point in the history
When USB CDC on Boot is enabled on ESP32-C3, an compilation error
occurs, because `Serial.begin()` takes only one (or zero) parameter.

Check `ARDUINO_USB_CDC_ON_BOOT` and call it with the correct parameter.
  • Loading branch information
k-takata committed Mar 17, 2024
1 parent d8aee22 commit f338d45
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/IRrecvDumpV2/IRrecvDumpV2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ decode_results results; // Somewhere to store the results
void setup() {
#if defined(ESP8266)
Serial.begin(kBaudRate, SERIAL_8N1, SERIAL_TX_ONLY);
#elif ARDUINO_USB_CDC_ON_BOOT
Serial.begin(kBaudRate);
#else // ESP8266
Serial.begin(kBaudRate, SERIAL_8N1);
#endif // ESP8266
Expand Down
2 changes: 2 additions & 0 deletions examples/IRrecvDumpV3/IRrecvDumpV3.ino
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ void setup() {
OTAwifi(); // start default wifi (previously saved on the ESP) for OTA
#if defined(ESP8266)
Serial.begin(kBaudRate, SERIAL_8N1, SERIAL_TX_ONLY);
#elif ARDUINO_USB_CDC_ON_BOOT
Serial.begin(kBaudRate);
#else // ESP8266
Serial.begin(kBaudRate, SERIAL_8N1);
#endif // ESP8266
Expand Down

0 comments on commit f338d45

Please sign in to comment.