/* It might delay handling of MAC interrupts which could compromise the Wifi handling, so keep any handlers as quick as possible.  */
static IRAM void mactimer_handler()
/* It might delay handling of MAC interrupts which could compromise the Wifi handling, so keep any handlers as quick as possible.  */
static IRAM void mactimer_handler()
{
    while (timer_list) {
        if (((int64_t)timer_list->trigger_usec - (int64_t)mactime_get_count()) > 0) {
            break;
        }
        mactimer_t *timer = timer_list;
        timer_list = timer->next;
        timer->next = NULL;
        timer->callback(timer->timer_arg);
    }
    if (timer_list) {
        mactime_set_trigger(timer_list->trigger_usec);
    }
}