@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.
ESP32: get which EXT1 pin caused wake
Re: ESP32: get which EXT1 pin caused wake
A few hours of debugging might save you from minutes of reading the documentation!
My repositories: https://github.com/karfas

My repositories: https://github.com/karfas
Re: ESP32: get which EXT1 pin caused wake
@roberthh: is it OK for you when I create the PR and documentation change ?
A few hours of debugging might save you from minutes of reading the documentation!
My repositories: https://github.com/karfas

My repositories: https://github.com/karfas
Re: ESP32: get which EXT1 pin caused wake
A few hours of debugging might save you from minutes of reading the documentation!
My repositories: https://github.com/karfas

My repositories: https://github.com/karfas
Re: ESP32: get which EXT1 pin caused wake
The PR is ready, tested and works (both GPIOs 2+4 connected to the same button):karfas wrote: ↑Sun Nov 14, 2021 10:43 amNew PR is in https://github.com/micropython/micropython/pull/7990
Code: Select all
>>> import main1
Reset: Wakeup from deep sleep
wakeup_reason(): (2, 4)
Going to sleep
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()
A few hours of debugging might save you from minutes of reading the documentation!
My repositories: https://github.com/karfas

My repositories: https://github.com/karfas
Re: ESP32: get which EXT1 pin caused wake
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.
I am having some difficulty using gpios to wake from light sleep and call the irq() callback associated with the pin.