Please include the following information when submitting a bug report:
PyCom board: LoPy
firmware version: 1.9.0.b2
Steps to reproduce the bug:
from machine import Timer
import utime
ALARM_1 = None
ALARM_2 = None
ALARM_3 = None
TICKS = None
def cb1(_):
'''
first callback: cancel alarm_2
'''
ALARM_2.cancel()
def cb2(_):
'''
second callback: will not be called
'''
print('I won\'t be called')
def cb3(_):
'''
third callback: will be called at the wrong time
'''
print(
'[cb3] BUG: called {0}ms after being scheduled instead of 3000ms'
.format(utime.ticks_diff(TICKS, utime.ticks_ms()))
)
TICKS = utime.ticks_ms()
ALARM_1 = Timer.Alarm(cb1, ms=1000, periodic=False)
ALARM_2 = Timer.Alarm(cb2, ms=2000, periodic=False)
ALARM_3 = Timer.Alarm(cb3, ms=3000, periodic=False)
Expected result:
cb3 is called ~3000ms after ALARM_3 is initialised.
Actual result:
cb3 is called ~2000ms after ALARM_3 is initialised, i.e. when cb2 was expected prior to cancellation.
Wild guess:
The hardware timer is not reset when removing the alarm heap head when heap size > 2.
Please include the following information when submitting a bug report:
PyCom board: LoPy firmware version: 1.9.0.b2
Steps to reproduce the bug:
Expected result:
cb3
is called ~3000ms after ALARM_3 is initialised.Actual result:
cb3
is called ~2000ms after ALARM_3 is initialised, i.e. whencb2
was expected prior to cancellation.Wild guess:
The hardware timer is not reset when removing the alarm heap head when heap size > 2.