mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-15 09:32:08 +00:00
Merge branch 'master' into RGBLED
This commit is contained in:
commit
2e13aeeacb
@ -106,20 +106,26 @@ static NimbleBluetoothFromRadioCallback *fromRadioCallbacks;
|
|||||||
|
|
||||||
void NimbleBluetooth::shutdown()
|
void NimbleBluetooth::shutdown()
|
||||||
{
|
{
|
||||||
|
// No measurable power saving for ESP32 during light-sleep(?)
|
||||||
|
#ifndef ARCH_ESP32
|
||||||
// Shutdown bluetooth for minimum power draw
|
// Shutdown bluetooth for minimum power draw
|
||||||
LOG_INFO("Disable bluetooth\n");
|
LOG_INFO("Disable bluetooth\n");
|
||||||
// Bluefruit.Advertising.stop();
|
|
||||||
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
|
NimBLEAdvertising *pAdvertising = NimBLEDevice::getAdvertising();
|
||||||
pAdvertising->reset();
|
pAdvertising->reset();
|
||||||
pAdvertising->stop();
|
pAdvertising->stop();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extra power-saving on some devices
|
// Proper shutdown for ESP32. Needs reboot to reverse.
|
||||||
void NimbleBluetooth::deinit()
|
void NimbleBluetooth::deinit()
|
||||||
{
|
{
|
||||||
|
#ifdef ARCH_ESP32
|
||||||
|
LOG_INFO("Disable bluetooth until reboot\n");
|
||||||
NimBLEDevice::deinit();
|
NimBLEDevice::deinit();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Has initial setup been completed
|
||||||
bool NimbleBluetooth::isActive()
|
bool NimbleBluetooth::isActive()
|
||||||
{
|
{
|
||||||
return bleServer;
|
return bleServer;
|
||||||
|
@ -30,9 +30,10 @@ void setBluetoothEnable(bool enable)
|
|||||||
}
|
}
|
||||||
if (enable && !nimbleBluetooth->isActive()) {
|
if (enable && !nimbleBluetooth->isActive()) {
|
||||||
nimbleBluetooth->setup();
|
nimbleBluetooth->setup();
|
||||||
} else if (!enable) {
|
|
||||||
nimbleBluetooth->shutdown();
|
|
||||||
}
|
}
|
||||||
|
// For ESP32, no way to recover from bluetooth shutdown without reboot
|
||||||
|
// BLE advertising automatically stops when MCU enters light-sleep(?)
|
||||||
|
// For deep-sleep, shutdown hardware with nimbleBluetooth->deinit(). Requires reboot to reverse
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -207,8 +207,8 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false)
|
|||||||
// esp_wifi_stop();
|
// esp_wifi_stop();
|
||||||
waitEnterSleep(skipPreflight);
|
waitEnterSleep(skipPreflight);
|
||||||
|
|
||||||
#ifdef NIMBLE_DEINIT_FOR_DEEPSLEEP
|
#ifdef ARCH_ESP32
|
||||||
// Extra power saving on some devices
|
// Full shutdown of bluetooth hardware
|
||||||
nimbleBluetooth->deinit();
|
nimbleBluetooth->deinit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -55,6 +55,3 @@
|
|||||||
|
|
||||||
#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
|
|
||||||
|
@ -55,6 +55,3 @@
|
|||||||
|
|
||||||
#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
|
|
||||||
|
Loading…
Reference in New Issue
Block a user