Repository navigation
Conversation
Both esp32.wake_on_ext1() and esp32.wake_on_gpio() now accept either a single Pin object or a tuple/list of Pin objects, making the common single-pin use case more ergonomic while maintaining backward compatibility. Documentation updated accordingly. Signed-off-by: Meir Armon <[email protected]>
|
@jkorte-dev can you see that this works for you? |
|
Sure, i will try later today. |
|
It took me some time to test because I made a stupid mistake (I used a resistor to pull up the wake up pin, just like in my test before but I accidentally picked up one with 100k Ω which apparently is too high to pull up in deep sleep mode), but finally I can confirm that wake up on gpio from deep sleep works with either a single pin or by setting the wake up pins with a tuple. Thanks for the improvement |
|
Thank you for taking the time to test this! I am happy that it worked for you
|
| size_t len = 0; | ||
| mp_obj_t *elem; | ||
| mp_obj_get_array(args[ARG_pins].u_obj, &len, &elem); | ||
| mp_obj_t pins_obj = args[ARG_pins].u_obj; |
There was a problem hiding this comment.
Instead of copying this block of code in two places, could you extract the common parts to a static helper function and call that?
i.e. get_pins_arg(args[ARG_pins].u_obj, &len, &elem) ?
Both esp32.wake_on_ext1() and esp32.wake_on_gpio() now accept
either
a single Pin object or a tuple/list of Pin objects, making the
common
single-pin use case more ergonomic while maintaining backward
compatibility.
Documentation updated accordingly.
Summary
As seen here it is useful to be able to set the board wake with a single pin, and not a tuple when not necessary.
Testing
I checkout on my esp32 that it works