BLE low power mode and settings optimization (#902)

* BLE low power mode and settings optimization
-low power mode settings example
-take into account parameters following #891
-add esp32dev-ble-cont for door/window sensor listening

* Disable WDT during scan

* update esp32 arduino framework
This commit is contained in:
Florian authored and GitHub committed 2021-03-25 18:53:47 -05:00
1 parent 863a56b389
commit b9151bb6ac
3 files changed
+47 -7

No files matched your search

+6 -5
View File
@@ -617,19 +617,20 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks {
* BLEscan used to retrieve BLE advertized data from devices without connection
*/
void BLEscan() {
TIMERG0.wdt_wprotect = TIMG_WDT_WKEY_VALUE;
TIMERG0.wdt_feed = 1;
TIMERG0.wdt_wprotect = 0;
disableCore0WDT();
Log.notice(F("Scan begin" CR));
BLEDevice::init("");
BLEScan* pBLEScan = BLEDevice::getScan(); //create new scan
BLEScan* pBLEScan = BLEDevice::getScan();
MyAdvertisedDeviceCallbacks myCallbacks;
pBLEScan->setAdvertisedDeviceCallbacks(&myCallbacks);
pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster
pBLEScan->setActiveScan(ActiveBLEScan);
pBLEScan->setInterval(BLEScanInterval);
pBLEScan->setWindow(BLEScanWindow);
BLEScanResults foundDevices = pBLEScan->start(Scan_duration / 1000, false);
scanCount++;
Log.notice(F("Found %d devices, scan number %d end deinit controller" CR), foundDevices.getCount(), scanCount);
BLEDevice::deinit(true);
enableCore0WDT();
}
/**