X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/fnordlicht-mini/blobdiff_plain/ec1bef8e19888e982ffc53129f74d58868e8d203..3ae238786b0d7e9aa120ef2847169cd6c0b3a13a:/firmware/fnordlicht-firmware/static_programs.c diff --git a/firmware/fnordlicht-firmware/static_programs.c b/firmware/fnordlicht-firmware/static_programs.c index c437fe7..911e379 100644 --- a/firmware/fnordlicht-firmware/static_programs.c +++ b/firmware/fnordlicht-firmware/static_programs.c @@ -37,8 +37,53 @@ PROGMEM program_handler static_programs[] = { program_colorwheel, program_random, program_replay, + program_showcfg, }; +#define DEBUG_COLORLEVEL 32u + +PT_THREAD(program_showcfg(struct process_t *process)) +{ + static uint16_t sleep; + static struct rgb_color_t c, d; + static uint8_t i; + + PT_BEGIN(&process->pt); + + c.red = (remote_address() & 0x01u) ? DEBUG_COLORLEVEL : 0; + c.green = (remote_address() & 0x02u) ? DEBUG_COLORLEVEL : 0; + c.blue = (remote_address() & 0x04u) ? DEBUG_COLORLEVEL : 0; + + d.red = d.green = d.blue = DEBUG_COLORLEVEL; + + global_pwm.target.rgb = c; + + for (i = 0; i < 3u; i++) + { + /* sleep 1s (remember: we are called every 100ms) */ + sleep = 10; + while (sleep--) + PT_YIELD(&process->pt); + + global_pwm.target.rgb = d; + + sleep = 5; + while (sleep--) + PT_YIELD(&process->pt); + + global_pwm.target.rgb = c; + } + + /* now start default script */ + if (storage_valid_config() && (startup_config.params.mode == STARTUP_PROGRAM)) { + script_start(0, startup_config.params.program, (union program_params_t *)startup_config.params.program_parameters); + } else { + script_start_default(); + } + + PT_END(&process->pt); +} + PT_THREAD(program_colorwheel(struct process_t *process)) { static uint16_t sleep;