Wireless Paper: Fix BLE after Lightsleep (#3629)

* NimBLE deinit for deep-sleep only

* Optionally disable blink during light-sleep

* Advised to revert "blink disable"
This reverts commit 66347ce19b.
This commit is contained in:
todd-herbert 2024-04-15 23:50:42 +12:00 committed by GitHub
parent 5b52c31a76
commit 1d97544041
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 17 additions and 4 deletions

View File

@ -112,12 +112,12 @@ void NimbleBluetooth::shutdown()
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
pAdvertising->reset();
pAdvertising->stop();
}
#if defined(HELTEC_WIRELESS_PAPER) || defined(HELTEC_WIRELESS_PAPER_V1_0)
// Saving of ~1mA
// Probably applicable to other ESP32 boards - unverified
// Extra power-saving on some devices
void NimbleBluetooth::deinit()
{
NimBLEDevice::deinit();
#endif
}
bool NimbleBluetooth::isActive()

View File

@ -6,6 +6,7 @@ class NimbleBluetooth : BluetoothApi
public:
void setup();
void shutdown();
void deinit();
void clearBonds();
bool isActive();
bool isConnected();

View File

@ -206,6 +206,12 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false)
// not using wifi yet, but once we are this is needed to shutoff the radio hw
// esp_wifi_stop();
waitEnterSleep(skipPreflight);
#ifdef NIMBLE_DEINIT_FOR_DEEPSLEEP
// Extra power saving on some devices
nimbleBluetooth->deinit();
#endif
#ifdef ARCH_ESP32
if (shouldLoraWake(msecToWake)) {
notifySleep.notifyObservers(NULL);

View File

@ -55,3 +55,6 @@
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// Power management
#define NIMBLE_DEINIT_FOR_DEEPSLEEP // Required to reach manufacturers claim of 18uA

View File

@ -55,3 +55,6 @@
#define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8
// Power management
#define NIMBLE_DEINIT_FOR_DEEPSLEEP // Required to reach manufacturers claim of 18uA