Every time a button is pressed, the light turns on, or a sound is playing, Movement enters a 128 Hz fast tick mode.
The cb_fast_tick() function is called 128 times per second. In this function we do among other things some checks on the time a button is held down or the amount of time left on an alarm playback.
With this PR I propose to lower the frequency of the fast tick mode to 8 Hz (the frequency is adjustable by changing FAST_TICK_FREQUENCY). This way we will reduce the invocation of cb_fast_tick() by over an order of magnitude.
We potentially lose a little bit of accuracy (up to 0.125s at 8 Hz) in the amount of time needed for a button longpress (0.5s +/- 0.125), or the light duration (1s +/- 0.125), but I think this inaccuracies are not noticeable.
Another consequence of this PR is that the 128 Hz mode is no longer reserved by Movement, and any face can now request this tick frequency.
Every time a button is pressed, the light turns on, or a sound is playing, Movement enters a 128 Hz fast tick mode.
The
cb_fast_tick()
function is called 128 times per second. In this function we do among other things some checks on the time a button is held down or the amount of time left on an alarm playback.With this PR I propose to lower the frequency of the fast tick mode to 8 Hz (the frequency is adjustable by changing
FAST_TICK_FREQUENCY
). This way we will reduce the invocation ofcb_fast_tick()
by over an order of magnitude.We potentially lose a little bit of accuracy (up to 0.125s at 8 Hz) in the amount of time needed for a button longpress (0.5s +/- 0.125), or the light duration (1s +/- 0.125), but I think this inaccuracies are not noticeable.
Another consequence of this PR is that the 128 Hz mode is no longer reserved by Movement, and any face can now request this tick frequency.