Skip to content

Commit

Permalink
Add isDownloadingBLE flag to CO2_Gadget.ino and use it in CO2_Gadget_…
Browse files Browse the repository at this point in the history
…BLE.h, CO2_Gadget_EINK.h, and CO2_Gadget_Menu.h
  • Loading branch information
melkati committed Apr 30, 2024
1 parent 9925291 commit b5979d7
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CO2_Gadget.ino
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ uint8_t peerESPNowAddress[] = ESPNOW_PEER_MAC_ADDRESS;

// BLE options
bool activeBLE = true;
bool isDownloadingBLE = false;

// WIFI options
bool activeWIFI = true;
Expand Down
3 changes: 2 additions & 1 deletion CO2_Gadget_BLE.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ void BLELoop() {
return;
}
provider.handleDownload();
delay(3);
isDownloadingBLE = provider.isDownloading();
// delay(3);
if (provider.wifiChanged()) handleBLEwifiChanged();
if (provider.historyIntervalChanged()) {
Serial.print("-->[BLE ] History interval changed to: ");
Expand Down
1 change: 1 addition & 0 deletions CO2_Gadget_EINK.h
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,7 @@ void testRedrawValues(bool randomNumbers = false) {

void displayShowValues(bool forceRedraw = false) {
static uint32_t lastDisplayUpdate = 0;
if (isDownloadingBLE) return; // Do not update display while downloading BLE data to MyAmbiance
// Return if last update less than 15 seconds ago
if (!forceRedraw && (millis() - lastDisplayUpdate < 15000)) {
return;
Expand Down
2 changes: 2 additions & 0 deletions CO2_Gadget_Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,8 @@ bool menuEntryCharacterReceived() {
}

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

if (mustInitMenu) {
initMenu();
#ifdef DEBUG_ARDUINOMENU
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ build_flags =
'-DWIFI_PW_CREDENTIALS=""'
-D MQTT_BROKER_SERVER="\"192.168.1.145"\"
-D CO2_GADGET_VERSION="\"0.12."\"
-D CO2_GADGET_REV="\"054-development"\"
-D CO2_GADGET_REV="\"058-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 b5979d7

Please sign in to comment.