You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey all! I'm trying to figure out if it's possible to put my ESP32S3 into a sleep state and have it wake up automatically on a BLE connection. I have migrated from BlueDroid to NimBLE and I see that I have access to the "esp_bt_sleep_enable()" now. My question is if this is possible, and then if anyone know of some small sample code that I can use for inspiration. This is the logic I have:
// Start up BLE stuff
esp_bt_sleep_enable();
esp_pm_config_esp32s3_t config = {};
config.max_freq_mhz = 240;
config.min_freq_mhz = 80;
config.light_sleep_enable = true;
esp_pm_configure(&config);
BleServer::getInstance().startBleServer(); // custom class that just starts a ble server with a single characteristic exposed
}
void loop() {
delay(10);
}
I'm fairly new to this hobby, but my understanding is that while the server is advertising, as long as the bt sleep and config are set, the modem should automatically enter a light sleep mode on its own. When I manually trigger a light sleep mode via "esp_light_sleep_start()" at the end, my ble server seems to disappear. Am I misunderstanding how things work here?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hey all! I'm trying to figure out if it's possible to put my ESP32S3 into a sleep state and have it wake up automatically on a BLE connection. I have migrated from BlueDroid to NimBLE and I see that I have access to the "esp_bt_sleep_enable()" now. My question is if this is possible, and then if anyone know of some small sample code that I can use for inspiration. This is the logic I have:
#include <Arduino.h>
#include <esp_bt.h>
#include <esp_pm.h>
#ifndef LED_BUILTIN
#define LED_BUILTIN 2
#endif
void setup() {
Serial.begin(115200);
Serial.setDebugOutput(true);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
// Start up BLE stuff
esp_bt_sleep_enable();
esp_pm_config_esp32s3_t config = {};
config.max_freq_mhz = 240;
config.min_freq_mhz = 80;
config.light_sleep_enable = true;
esp_pm_configure(&config);
BleServer::getInstance().startBleServer(); // custom class that just starts a ble server with a single characteristic exposed
}
void loop() {
delay(10);
}
I'm fairly new to this hobby, but my understanding is that while the server is advertising, as long as the bt sleep and config are set, the modem should automatically enter a light sleep mode on its own. When I manually trigger a light sleep mode via "esp_light_sleep_start()" at the end, my ble server seems to disappear. Am I misunderstanding how things work here?
Beta Was this translation helpful? Give feedback.
All reactions