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

View File

@ -6,6 +6,7 @@ class NimbleBluetooth : BluetoothApi
public: public:
void setup(); void setup();
void shutdown(); void shutdown();
void deinit();
void clearBonds(); void clearBonds();
bool isActive(); bool isActive();
bool isConnected(); 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 // not using wifi yet, but once we are this is needed to shutoff the radio hw
// esp_wifi_stop(); // esp_wifi_stop();
waitEnterSleep(skipPreflight); waitEnterSleep(skipPreflight);
#ifdef NIMBLE_DEINIT_FOR_DEEPSLEEP
// Extra power saving on some devices
nimbleBluetooth->deinit();
#endif
#ifdef ARCH_ESP32 #ifdef ARCH_ESP32
if (shouldLoraWake(msecToWake)) { if (shouldLoraWake(msecToWake)) {
notifySleep.notifyObservers(NULL); notifySleep.notifyObservers(NULL);

View File

@ -55,3 +55,6 @@
#define SX126X_DIO2_AS_RF_SWITCH #define SX126X_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8 #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_DIO2_AS_RF_SWITCH
#define SX126X_DIO3_TCXO_VOLTAGE 1.8 #define SX126X_DIO3_TCXO_VOLTAGE 1.8
// Power management
#define NIMBLE_DEINIT_FOR_DEEPSLEEP // Required to reach manufacturers claim of 18uA