]> git.zerfleddert.de Git - fnordlicht-mini/commitdiff
more lean and mean, switching still doesn't work... :-(
authorgitknilch <gitknilch@cwde.de>
Mon, 21 Mar 2011 17:17:01 +0000 (18:17 +0100)
committergitknilch <gitknilch@cwde.de>
Mon, 21 Mar 2011 17:17:01 +0000 (18:17 +0100)
firmware/fnordlicht-firmware/static_programs.c

index d5a79e086090f829b151c74fa3d8981d9760c4f6..911e379a48945820490f4f0a084835666bdac50d 100644 (file)
@@ -40,53 +40,39 @@ PROGMEM program_handler static_programs[] = {
     program_showcfg,
 };
 
+#define DEBUG_COLORLEVEL 32u
+
 PT_THREAD(program_showcfg(struct process_t *process))
 {
     static uint16_t sleep;
-    struct rgb_color_t c, d;
+    static struct rgb_color_t c, d;
+    static uint8_t i;
 
     PT_BEGIN(&process->pt);
 
-    c.red = (remote_address() & 0x01u) * 128u;
-    c.green = (remote_address() & 0x02u) * 128u;
-    c.blue = (remote_address() & 0x04u) * 128u;
-
-    d.red = d.green = d.blue = 128u;
-
-    pwm_fade_rgb(&d, 0xffu, 0);
-
-    PT_WAIT_UNTIL(&process->pt, pwm_target_reached());
-
-    /* sleep .5s (remember: we are called every 100ms) */
-    sleep = 5;
-    while (sleep--)
-           PT_YIELD(&process->pt);
-
-    pwm_fade_rgb(&c, 0xffu, 0);
+    c.red = (remote_address() & 0x01u) ? DEBUG_COLORLEVEL : 0;
+    c.green = (remote_address() & 0x02u) ? DEBUG_COLORLEVEL : 0;
+    c.blue = (remote_address() & 0x04u) ? DEBUG_COLORLEVEL : 0;
 
-    PT_WAIT_UNTIL(&process->pt, pwm_target_reached());
+    d.red = d.green = d.blue = DEBUG_COLORLEVEL;
 
-    /* sleep 1s (remember: we are called every 100ms) */
-    sleep = 10;
-    while (sleep--)
-           PT_YIELD(&process->pt);
-    pwm_fade_rgb(&d, 0xffu, 0);
-
-    PT_WAIT_UNTIL(&process->pt, pwm_target_reached());
+    global_pwm.target.rgb = c;
 
-    /* sleep .5s (remember: we are called every 100ms) */
-    sleep = 5;
-    while (sleep--)
+    for (i = 0; i < 3u; i++)
+    {
+        /* sleep 1s (remember: we are called every 100ms) */
+        sleep = 10;
+        while (sleep--)
            PT_YIELD(&process->pt);
 
-    pwm_fade_rgb(&c, 0xffu, 0);
+        global_pwm.target.rgb = d;
 
-    PT_WAIT_UNTIL(&process->pt, pwm_target_reached());
+        sleep = 5;
+        while (sleep--)
+            PT_YIELD(&process->pt);
 
-    /* sleep 1s (remember: we are called every 100ms) */
-    sleep = 10;
-    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)) {
Impressum, Datenschutz