Skip to content

feat: Dynamic light sleep support for ESP32 platform #7121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

m1nl
Copy link

@m1nl m1nl commented Jun 24, 2025

fixes #6660

I've finally implemented the Feature Request I created a few months ago. Since then, I've been testing the dynamic light-sleep functionality and haven't encountered any issues.

In the initial version, legacy light-sleep support with the default Arduino framework could lead to problems after my changes. To address this, I had to rewrite and refactor parts of the code to ensure compatibility with builds compiled using the default PlatformIO Arduino framework.

I tested the updated implementation on a Heltec V3 board in the following scenarios:

  • default Arduino, bluetooth, light-sleep disabled
  • default Arduino, bluetooth, light-sleep enabled
  • default Arduino, bluetooth, light-sleep enabled, force disable support for EXT wake-up
  • customized Arduino, bluetooth, light-sleep disabled
  • customized Arduino, bluetooth, light-sleep enabled
  • customized Arduino, bluetooth, light-sleep enabled, force disable support for EXT wake-up
  • customized Arduino, bluetooth disabled, light-sleep enabled
  • customized Arduino, WiFi enabled, MQTT enabled, light-sleep enabled

There are a few topics that need discussion:

  1. Power Management (PM) Support for ESP32 requires a custom variant of the Arduino framework. I’ve forked it from Espressif’s GitHub repository and am currently hosting it under my personal GitHub account. If these changes are accepted, I’d like to move the repository under the meshtastic organization.
  2. In my opinion, re-enabling Bluetooth on the ESP32 without restarting is not possible, so NB PowerFSM state seems redundant. I'm open to restoring it if necessary, but I’d appreciate guidance on the intended logic behind this state.
  3. I updated the platformio.ini files for the hardware variants I was able to test. I shared customized builds with others, who confirmed they were working as expected.
  4. I updated the variant.h files for the hardware variants which do have 32kHz oscillator, according to Espressif docs, it helps with Bluetooth stability when dynamic light-sleep is enabled

Links to repositiories mentioned in 1) :

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)

@m1nl m1nl force-pushed the esp_light_sleep_release branch 2 times, most recently from 8a02438 to 30c91e1 Compare June 27, 2025 14:03
m1nl added 28 commits June 27, 2025 21:45
@m1nl m1nl force-pushed the esp_light_sleep_release branch from 78ac522 to 9526383 Compare June 27, 2025 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Dynamic light sleep support for ESP32 platform
1 participant