Support multiple pins in deep_sleep component on ESP32 Cxx variants. #3577
Unanswered
dimarobert
asked this question in
Component enhancements
Replies: 1 comment
-
|
🏷️ I've automatically added the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Component name
deep_sleep
Link to component documentation on our website
https://esphome.io/components/deep_sleep/
Describe the enhancement
Currently, the component only supports one wakeup_pin for ESP32 C2, C3, C6, C61, while they also support multiple pins through a pin mask.
Use cases
This would increase the feature parity to some extent between the different variants. Any multi-pin deep_sleep use cases that make sense for the other variants would make sense for the ones specified above as well.
Anything else?
This all started with a custom 2 button remote that I built using an ESP32-C3 for which I wanted both buttons to wake it up from deep sleep. I created a custom component for myself, starting with the code from the core component, that I have in use for close to 1 year. To make it easier to keep it up to date with upstream changes I made my custom multiple pins support using completely separate configuration entries. You can see this version of the implementation in this commit.
When I noticed the recent changes to the core component to support a list of pins in the wakeup_pin for the BK72XX (and at the same time the refactoring that took place a while back that better separated code between esp32 variants) I thought it would be a good time to also bring up this feature improvement request and at the same time provide the implementation I have as a POC.
I've also kindly asked ClaudeCode to try to merge my changes to use the existing configuration entries and also ensure code parity with the core implementation. Here is the result after a few additional manual cleanup passes.
Few things to note:
esp_deep_sleep_enable_gpio_wakeup), a singleesp_deepsleep_gpio_wake_up_mode_tlevel is applied to all pins in the mask. If one pin needs its level inverted while another doesn't, there is no way to represent that, the API simply doesn't support per-pin levels. Even applying INVERT_WAKEUP globally (flip the shared level if any pin is active) would break the semantics for the pins that aren't currently in their wake state.gpio_set_direction(gpio_pin, GPIO_MODE_INPUT)on each one).Beta Was this translation helpful? Give feedback.
All reactions