[LPM] - Fix reboot loop when low power is used (#1444)

By not deinitializing BLE at the start, if it has not been initialized. Setting the time between waking up from the macro rather than the config interval.
This one does not have a value at the start.
This commit is contained in:
Florian authored and GitHub committed 2023-02-09 15:19:09 -06:00
1 parent 53e4473810
commit 26c0cca614
2 files changed
+5 -3

No files matched your search

+3 -3
View File
@@ -760,8 +760,8 @@ void coreTask(void* pvParameters) {
}
void lowPowerESP32() { // low power mode
Log.trace(F("Going to deep sleep for: %l s" CR), (BTConfig.BLEinterval / 1000));
deepSleep(BTConfig.BLEinterval * 1000);
Log.trace(F("Going to deep sleep for: %l s" CR), (TimeBtwRead / 1000));
deepSleep(TimeBtwRead * 1000);
}
void deepSleep(uint64_t time_in_us) {
@@ -771,7 +771,7 @@ void deepSleep(uint64_t time_in_us) {
# endif
Log.trace(F("Deactivating ESP32 components" CR));
BLEDevice::deinit(true);
if (BLEDevice::getInitialized()) BLEDevice::deinit(true);
esp_bt_mem_release(ESP_BT_MODE_BTDM);
// Ignore the deprecated warning, this call is necessary here.
# pragma GCC diagnostic push