QUERY · ISSUE
ESP8266 RTC.irq method rejects arguments. Missing RTC constants in machine module.
port-esp8266
Testing was done with a build using code of 27th Nov. I couldn't update because of https://github.com/micropython/micropython/issues/2700. Pasting the following:
import machine
import micropython
micropython.alloc_emergency_exception_buf(100)
def alarm_handler(rtc_o):
print("Hello from alarm_handler")
rtc = machine.RTC()
rtc.alarm(machine.RTC.ALARM0, 10000)
rtc_i = rtc.irq(trigger=machine.RTC.ALARM0, handler=alarm_handler, wake=machine.DEEPSLEEP)
produced (from rtc_i = rtc.irq(args))
Traceback (most recent call last):
File "<stdin>", line 10, in <module>
TypeError: extra keyword arguments given
>>>
[EDIT]Further testing indicates that it objects to the handler arg. Is this not yet implemented?
The constants IDLE and SLEEP are missing from the machine module.
CANDIDATE · ISSUE
ESP8266 crashes on wake from deepsleep
port-esp8266
This was reported on the forum.
If the following code is pasted at the REPL the board wakes after 10s but crashes: there is no response to the REPL or to pings, and the red LED on the reference board is lit.
import machine
rtc = machine.RTC()
rtc.irq(trigger=rtc.ALARM0, wake=machine.DEEPSLEEP)
rtc.alarm(machine.RTC.ALARM0, 10000)
machine.deepsleep()
machine.reset() # Crashes with or without this
A second issue is that the handler kwarg to rtc.irq is rejected:
rtc.irq(trigger=rtc.ALARM0, handler=lambda *_ : None, wake=machine.DEEPSLEEP)
produces TypeError: extra keyword arguments given.
Hardware: Adafruit Feather Huzzah, build:
MicroPython v1.9.4-227-gab02abe-dirty on 2018-07-19; ESP module with ESP8266