Minor comment since this affected uf2loader:
Often in the BIOS tasks are run on a periodic timer. Those timers are currently implemented something like the following:
int last_process_time = 0;
if (uptime_ms() - last_process_time < period_ms) return;
last_process_time = uptime_ms();
This is fine, except on startup, where the task has to wait a full period_ms delay before executing for the first time. Guess why my bootloader (which asks for keypresses immediately on startup) wasn’t seeing anything ![]()
A slight modification flips the order around to “execute-delay-execute” instead of “delay-execute-delay”, removing the initial wait.
int next_process_time = 0;
if (uptime_ms() - next_process_time < 0) return;
next_process_time = uptime_ms() + period_ms;
But do put the update for next_process_time immediately after the check, because in the current keyboard task it’s at the end - which means the task runs slightly slower than the requested rate.