Page 3 of 3

Re: ESP32: get which EXT1 pin caused wake

Posted: Sun Oct 17, 2021 7:23 am
by karfas
@roberthh: This is great!
I propose to wait a week or so to collect some more opinions and then create a PR from your code.
For me, a tuple of pin numbers looks sufficient.

@sergei.nz: I don't care about convenience. A few lines of more user code to decode the bitmap is better than not having this information at all. My arguments were about consistency of the interface. The current micropython docs mention the term "bitmap" exactly twice (for memory management and some framebuffer function), so it just felt ugly/wrong for me to return the bitmap to users.

Re: ESP32: get which EXT1 pin caused wake

Posted: Sat Nov 06, 2021 9:38 am
by karfas
karfas wrote:
Sun Oct 17, 2021 7:23 am
I propose to wait a week or so to collect some more opinions and then create a PR from your code.
@roberthh: is it OK for you when I create the PR and documentation change ?

Re: ESP32: get which EXT1 pin caused wake

Posted: Sat Nov 06, 2021 10:37 am
by Roberthh
Sure.

Re: ESP32: get which EXT1 pin caused wake

Posted: Sun Nov 14, 2021 10:43 am
by karfas

Re: ESP32: get which EXT1 pin caused wake

Posted: Sun Feb 27, 2022 6:14 pm
by karfas
karfas wrote:
Sun Nov 14, 2021 10:43 am
New PR is in https://github.com/micropython/micropython/pull/7990
The PR is ready, tested and works (both GPIOs 2+4 connected to the same button):

Code: Select all

>>> import main1
Reset: Wakeup from deep sleep
wakeup_reason(): (2, 4)
Going to sleep
My test program:

Code: Select all

import machine
from machine import Pin, TouchPad
import time
import esp32
import esp

if machine.reset_cause() == machine.DEEPSLEEP_RESET:
    print("Reset: Wakeup from deep sleep")
else:
    print("Reset: Other reason")

print("wakeup_reason(): {}".format(machine.wake_ext1_pins()))

pin4 = Pin(4, mode = Pin.IN, pull = Pin.PULL_DOWN)
wake = Pin(2, mode = Pin.IN, pull = Pin.PULL_DOWN)
esp32.wake_on_ext1(pins = [wake,pin4], level = Pin.WAKE_HIGH)

time.sleep(2)
print('Going to sleep')
machine.deepsleep()

Re: ESP32: get which EXT1 pin caused wake

Posted: Tue Sep 05, 2023 2:40 pm
by bwyld
Just wondered if anyone had tested this with lightsleep() and/or on an ESP32S3?
I am having some difficulty using gpios to wake from light sleep and call the irq() callback associated with the pin.