Skip to content

Commit

Permalink
Fix Serial TX buffer full issue on ESP32 S3
Browse files Browse the repository at this point in the history
  • Loading branch information
melkati committed May 5, 2024
1 parent 9fd1f80 commit 9292082
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions CO2_Gadget_Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ bool menuEntryCharacterReceived() {

void menuLoop() {
if (isDownloadingBLE) return; // Do not run the menu if downloading BLE

if (mustInitMenu) {
initMenu();
#ifdef DEBUG_ARDUINOMENU
Expand Down Expand Up @@ -1223,13 +1223,15 @@ void menuLoop() {
}
#endif

// Workaround: Try to avoid Serial TX buffer full if it's not connected to a receiving device
#ifdef CONFIG_IDF_TARGET_ESP32S3
// Workaround: Try to avoid Serial TX buffer full if it's not connected to a receiving device. Looks like the issue is just with ESP32 S3
if ((Serial.availableForWrite() < 100) || (!workingOnExternalPower)) {
Serial.println("[MENU] Serial TX buffer full or not connected to a receiving device. Restarting Serial...");
Serial.end();
delay(10);
Serial.begin(115200);
}
#endif

if (activeWIFI) {
activeMQTTMenu[0].enable();
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ build_flags =
'-DWIFI_PW_CREDENTIALS=""'
-D MQTT_BROKER_SERVER="\"192.168.1.145"\"
-D CO2_GADGET_VERSION="\"0.12."\"
-D CO2_GADGET_REV="\"061-development"\"
-D CO2_GADGET_REV="\"062-development"\"
-DCACHE_DIR=".pio/build"
-DBUZZER_PIN=2 ; ESP32 pin GPIO13 connected to piezo buzzer
-DNEOPIXEL_PIN=26 ; Pinnumber for button for down/next and back / exit actions
Expand Down

0 comments on commit 9292082

Please sign in to comment.