shinyblink / sled

Satanic/Sexy/Stupid/Silly/Shiny LED matrix controller
https://shinyblink.github.io/sled/
ISC License
121 stars 25 forks source link

return 1 after timer_add(...) breaks modules #55

Open cyriax0 opened 6 years ago

cyriax0 commented 6 years ago

Reproducing:

In an gfx_* module (e.g. gfx_rainbow)

int draw(int argc, char* argv[]) {
    [...]
    frame++;
    nexttick += FRAMETIME;
    timer_add(nexttick, modno, 0, NULL);
    if (frame > 100) return 1;
    return 0;
}

What happens

After returning 1 modules the timers are broken and modules start a switch loop in which the last two modules are switched rapidly without waiting for timers or fininshing. The output is erratic. No modules run normally.

Possible solutions

clear timer for that module after a module returns 1