Merge branch 'tft-gui-work' of https://github.com/meshtastic/firmware into tft-gui-work

This commit is contained in:
mverch67 2024-04-18 15:36:55 +01:00
commit 684295cfc2
6 changed files with 13 additions and 13 deletions

View File

@ -7,7 +7,6 @@
"extra_flags": [
"-DBOARD_HAS_PSRAM",
"-DLILYGO_TBEAM_S3_CORE",
"-DARDUINO_USB_CDC_ON_BOOT=1",
"-DARDUINO_USB_MODE=1",
"-DARDUINO_RUNNING_CORE=1",
"-DARDUINO_EVENT_RUNNING_CORE=1"

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;

View File

@ -30,9 +30,10 @@ void setBluetoothEnable(bool enable)
}
if (enable && !nimbleBluetooth->isActive()) {
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

View File

@ -207,8 +207,8 @@ void doDeepSleep(uint32_t msecToWake, bool skipPreflight = false)
// esp_wifi_stop();
waitEnterSleep(skipPreflight);
#ifdef NIMBLE_DEINIT_FOR_DEEPSLEEP
// Extra power saving on some devices
#ifdef ARCH_ESP32
// Full shutdown of bluetooth hardware
nimbleBluetooth->deinit();
#endif

View File

@ -55,6 +55,3 @@
#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,6 +55,3 @@
#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