diff --git a/CO2_Gadget.ino b/CO2_Gadget.ino index 118b6ecd..5ab64b12 100644 --- a/CO2_Gadget.ino +++ b/CO2_Gadget.ino @@ -35,6 +35,7 @@ uint8_t peerESPNowAddress[] = ESPNOW_PEER_MAC_ADDRESS; // BLE options bool activeBLE = true; +bool isDownloadingBLE = false; // WIFI options bool activeWIFI = true; diff --git a/CO2_Gadget_BLE.h b/CO2_Gadget_BLE.h index 1acff627..ae563325 100644 --- a/CO2_Gadget_BLE.h +++ b/CO2_Gadget_BLE.h @@ -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: "); diff --git a/CO2_Gadget_EINK.h b/CO2_Gadget_EINK.h index 7ba7a6e1..57ed7c98 100644 --- a/CO2_Gadget_EINK.h +++ b/CO2_Gadget_EINK.h @@ -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; diff --git a/CO2_Gadget_Menu.h b/CO2_Gadget_Menu.h index 060dcfa5..42241bac 100644 --- a/CO2_Gadget_Menu.h +++ b/CO2_Gadget_Menu.h @@ -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 diff --git a/platformio.ini b/platformio.ini index 479d3735..4ea7c34d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -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