(ESP32) Fix bluetooth after light-sleep; de-init for deep sleep (#3655)

This commit is contained in:
todd-herbert
2024-04-19 00:27:18 +12:00
committed by GitHub
parent 2e14234b77
commit 747c713ba9
5 changed files with 13 additions and 12 deletions

View File

@@ -106,20 +106,26 @@ static NimbleBluetoothFromRadioCallback *fromRadioCallbacks;
void NimbleBluetooth::shutdown()
{
// No measurable power saving for ESP32 during light-sleep(?)
#ifndef ARCH_ESP32
// Shutdown bluetooth for minimum power draw
LOG_INFO("Disable bluetooth\n");
// Bluefruit.Advertising.stop();
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
pAdvertising->reset();
pAdvertising->stop();
#endif
}
// Extra power-saving on some devices
// Proper shutdown for ESP32. Needs reboot to reverse.
void NimbleBluetooth::deinit()
{
#ifdef ARCH_ESP32
LOG_INFO("Disable bluetooth until reboot\n");
NimBLEDevice::deinit();
#endif
}
// Has initial setup been completed
bool NimbleBluetooth::isActive()
{
return bleServer;