machine.wake_reason() #13314
Replies: 2 comments
-
I haven't used this particular feature but I believe the implementation is in modmachine.c:238. From what I can tell it appears to be converting the enumeration returned by the ESP-IDF call There is currently no mapping between the values returned and MicroPython constants. Until such a mapping is put in place, I think it would be best to trigger the various wake-up causes and check the integer values returned. Then you can use those integer values to check the wakeup reason. Be aware they may change between ESP-IDF updates! |
Beta Was this translation helpful? Give feedback.
-
Hi Mattytrentini, |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I have to detect the cause of a wake-up of the ESP32 from deep-sleep. In my case It could be from a timer or from an external pin.
For this reason I use the fuction machine.wake_reason() to detect it.
First of all some description tell that the return value of this function should be a tuple other a constant. What is right?
Second: from the constants listed in micropython.org (machine.WLAN_WAKE, machine.PIN_WAKE, machine.RTC_WAKE) only PIN.wake is recognized. The other constants during exection give me an error ('module' object has no attribute 'RTC_WAKE' .... )
Third: I get a retured value from a timer deepsleep of 4 (the cause listed in the doc are 3)
I'm a little bit confused how to use this function
Gian Carlo
Beta Was this translation helpful? Give feedback.
All reactions