Skip to content

Conversation

@meirarmon
Copy link
Contributor

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

  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]>
@meirarmon
Copy link
Contributor Author

@jkorte-dev can you see that this works for you?

@jkorte-dev
Copy link

Sure, i will try later today.

@jkorte-dev
Copy link

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
BTW I tested with esp32c3 and esp32c6

@meirarmon
Copy link
Contributor Author

Thank you for taking the time to test this! I am happy that it worked for you

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
BTW I tested with esp32c3 and esp32c6

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants