Long Timer Never Gets Called
On a Raspberry Pico a timer with a period of 300000 (5 minutes) gets called reliably while another timer with a period of 900000 (15 minutes) never gets called. Changing the period of task3 to 300000 gets it working again.
task1 = Timer()
task2 = Timer()
task3 = Timer()
task1.init(period=60000, mode=Timer.PERIODIC, callback=get_gnss)
task2.init(period=300000, mode=Timer.PERIODIC, callback=get_temperature)
task3.init(period=900000, mode=Timer.PERIODIC, callback=put_data)
TypeError: can't convert float to int
Port, board and/or hardware
rp2, Pico W
MicroPython version
Version: MicroPython v1.23.0 on 2024-06-02; Raspberry Pi Pico W with RP2040
This works:
Timer(-1, mode=Timer.PERIODIC, period=1000, callback=lambda _: led.toggle())
But this doesn't:
Timer(-1, mode=Timer.PERIODIC, period=1000.0, callback=lambda _: led.toggle())
Error:
TypeError: can't convert float to int
Surprised me a lot, is this intended behaviour?
Cheers
Reproduction
from machine import *
led = Pin("LED", Pin.OUT)
# Some arguments are only accepted as integers! That's surprising
timer = Timer(-1, mode=Timer.PERIODIC, period=1000.0, callback=lambda _: led.toggle())
Expected behaviour
No response
Observed behaviour
Fails with: TypeError: can't convert float to int
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree