Code: Select all
>>> Timer(-1)==Timer(-1)
True
Code: Select all
>>> Timer(-1)==Timer(-1)
True
Code: Select all
>>> import os
>>> os.uname()
(sysname='esp32', nodename='esp32', release='1.12.0',
version='v1.12-452-g801f7dca7 on 2020-05-14', machine='TinyPICO with ESP32-PICO-D4')
Code: Select all
from machine import Timer
tim = Timer(-1)
tim.init(period=5000, mode=Timer.ONE_SHOT, callback=lambda t:print(1))
Code: Select all
>>> os.uname()
(sysname='esp32', nodename='esp32', release='1.12.0', version='v1.12-35-g10709846f on 2019-12-29', machine='ESP32 module with ESP32')
Code: Select all
=== tim = Timer(-1)
=== tim.init(period=5000, mode=Timer.ONE_SHOT, callback=lambda t:print(1))
=== tim.init(period=2000, mode=Timer.PERIODIC, callback=lambda t:print(2))
>>> 2
2
2
2
2
2
2
2
2
2
...
Code: Select all
>>> Timer(-1) == Timer(0)
False
>>> Timer(-1) == Timer(3)
True
Currently that's not correct on the ESP32; virtual timers are not implemented.shaoziyang wrote: ↑Mon Jul 20, 2020 12:46 amYou may use Timer(-1), Timer(-2)... for different virtual timer.
Thanks for the tipmattyt wrote: ↑Mon Jul 20, 2020 4:17 amCurrently that's not correct on the ESP32; virtual timers are not implemented.shaoziyang wrote: ↑Mon Jul 20, 2020 12:46 amYou may use Timer(-1), Timer(-2)... for different virtual timer.
See Josh's PR #6258 for more details. In short there are four hardware timers and using -1 (and -2) actually maps to one of those timers due to a defect.
Thanks for the tipmattyt wrote: ↑Mon Jul 20, 2020 4:17 amCurrently that's not correct on the ESP32; virtual timers are not implemented.shaoziyang wrote: ↑Mon Jul 20, 2020 12:46 amYou may use Timer(-1), Timer(-2)... for different virtual timer.
See Josh's PR #6258 for more details. In short there are four hardware timers and using -1 (and -2) actually maps to one of those timers due to a defect.