Hi,
i have tried searching on the interwebs and on the forum but no luck. New account, no bbcode yet.
When i try to use timer and rtc.irq with rtc.alarm0 at the same time, the board is never woken up. If instead of timer i use time.sleep, all is ok. Is this some limitation of the timer? The docs say it is "executing in an interrupt context"
The idea is to run timer and have it to trigger deepsleep. The main reason i do this is to have some sleep time to be able to remotely get to the board and update the software. I tried different combinations of times, but to no avail. DTR - XPD are connected and deepsleep wake up actually works if no timer is used.
This doesn't work, board never wakes up:
..init, connect to wifi...
rtc = machine.RTC()
rtc.irq(trigger=rtc.ALARM0, wake=machine.DEEPSLEEP)
rtc.alarm(rtc.ALARM0, 1000*10)
tim = Timer(-1)
tim.init(period=8000, mode=Timer.ONE_SHOT, callback=lambda t:machine.deepsleep())
This code below works as expected (full proof of concept code)
import webrepl
import network
import machine
webrepl.start()
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect('ESSID', 'keep_looking')
import time
time.sleep(5) #wait for connection to be ready
import fan
fan.run() #do some networking stuff here, not related. uses import urequests
time.sleep(20) # do not go to deepsleep right away, to be able to connect and change the script at some time later

#todo: add check if this is hard reset and do not waste battery on deepsleep wake ups
rtc = machine.RTC()
rtc.irq(trigger=rtc.ALARM0, wake=machine.DEEPSLEEP)
rtc.alarm(rtc.ALARM0, 1000*10)
machine.deepsleep()
Any idea what is going on? MP esp8266-20170108-v1.8.7.bin on ESP-01 ESP8266, DTR - XPD connected.
Thank you