MicroPython_ESP32_psRAM_LoBo
MicroPython_ESP32_psRAM_LoBo copied to clipboard
Timer in extended mode and ONE_SHOT mode and timer_no > 4: reshoot() doesn't work.
If the timer is in extended mode and in ONE_SHOT mode and the timer_no is 4 or greater, then the reshoot() function does not work. The ValueError "Timer is not one_shot timer output" is shown.
01 import machine
02
03 tex = machine.Timer(0)
04 tex.init(mode=tex.EXTBASE)
05
06 tme1 = machine.Timer(4)
07
08 def tcb(t):
09 print(t)
10 tme1.reshoot()
11
12 tme1.init(period=700, mode=tme1.ONE_SHOT, callback=tcb)
>>> ping
Traceback (most recent call last):
File "<stdin>", line 10, in tcb
ValueError: Timer is not one_shot timer.
Sorry fo the late reply.
There was a small bug in reshot() function preventing extended timers (>=4) o reshot.
It is fixed now and will be available in the next week update.
Until the fix is commited, as a workaround you can use the following, it works:
import machine
tex = machine.Timer(0)
tex.init(mode=tex.EXTBASE)
tme1 = machine.Timer(4)
def tcb(t):
print(t)
#tme1.reshoot()
tme1.init(period=700, mode=tme1.ONE_SHOT, callback=tcb)
tme1.init(period=700, mode=tme1.ONE_SHOT, callback=tcb)