Skip to content

Commit

Permalink
Workaround: Try to avoid Serial TX buffer full if it's not connected …
Browse files Browse the repository at this point in the history
…to a receiving device
  • Loading branch information
melkati committed Feb 29, 2024
1 parent 2507f91 commit 0acf5df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions CO2_Gadget_Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,7 @@ panelsList pList(panels, nodes, 1); // a list of panels and nodes
idx_t eSpiTops[MAX_DEPTH] = {0};
TFT_eSPIOut eSpiOut(tft, colors, eSpiTops, pList, fontW, fontH + 1);
menuOut *constMEM outputs[] MEMMODE = {&outSerial, &eSpiOut}; // list of output devices
menuOut *constMEM outputsNoSerial[] MEMMODE = {&eSpiOut}; // list of output devices
#endif // SUPPORT_TFT

#ifdef SUPPORT_OLED
Expand Down Expand Up @@ -1107,9 +1108,17 @@ void menuLoopOLED() {
}

void menuLoop() {
uint16_t timeToWaitForImprov = 5; // Time to wait for Improv-WiFi to connect on startup
if (Serial.available() && Serial.peek() == 0x2A) { // 0x2A is the '*' character.
nav.doInput(); // Do input, even if no display, as serial menu needs this
// Time to wait for Improv-WiFi to connect on startup. 0x2A is the '*' character.
uint16_t timeToWaitForImprov = 5;
if (Serial.available() && Serial.peek() == 0x2A) {
nav.doInput(); // Do input, even if no display, as serial menu needs this
}

// Workaround: Try to avoid Serial TX buffer full if it's not connected to a receiving device
if ((Serial.availableForWrite() < 150) || (!workingOnExternalPower)) {
Serial.end();
delay(10);
Serial.begin(115200);
}

if (activeWIFI) {
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ build_flags =

-D MQTT_BROKER_SERVER="\"192.168.1.145"\"
-D CO2_GADGET_VERSION="\"0.12."\"
-D CO2_GADGET_REV="\"005"\"
-D CO2_GADGET_REV="\"006"\"
-D CORE_DEBUG_LEVEL=0
-DCACHE_DIR=".pio/build"
-DBUZZER_PIN=2 ; ESP32 pin GPIO13 connected to piezo buzzer
Expand Down

0 comments on commit 0acf5df

Please sign in to comment.