I am using light sleep on an ESP32. I have a button with a pullup attached to pin 34, which pulls pin 34 to ground when pressed.I use
Code: Select all
gpio_wakeup_enable(34, GPIO_INTR_LOW_LEVEL)
This works fine, except for when the button is pressed for longer than about 250ms, at which point the WDT resets the CPU. This is happening because the interrupt that apparently runs to awaken the ESP runs continuously while pin 34 is low - because it's a level interrupt.
How can I resolve this such that holding the button down won't cause the ESP to reset? Surely immediately prior to sleeping the IDF should hook the interrupt to this pin, and then immediately upon waking it should be unhooked from the pin? With automatic light sleep enabled, I don't have control over when sleep is entered, nor do I know when the ESP has awoken, so I can't do this myself.
Thanks.