]> oss.titaniummirror.com Git - rgblamp.git/commitdiff
Misc fixes; close now
authorR. Steve McKown <rsmckown@gmail.com>
Sat, 10 Dec 2011 06:58:00 +0000 (23:58 -0700)
committerR. Steve McKown <rsmckown@gmail.com>
Sat, 10 Dec 2011 06:58:00 +0000 (23:58 -0700)
Code seems to be working, except transitions after the first don't seem
to fade.

main.c

diff --git a/main.c b/main.c
index 331ec58c254491d20ffd1813510e93ddf63dcec4..e4ef0f0ca52af3680129fe9d4322936a5109d280 100644 (file)
--- a/main.c
+++ b/main.c
@@ -125,11 +125,12 @@ void turnOn()
 {
   dbgpin_high();
   on = 1;
-  rgb_on();
   red.value = 0;
   grn.value = 0;
   blu.value = 0;
   wht.value = 0;
+  leds_set(red, grn, blu, wht);
+  rgb_on();
   start_fade();
 }
 
@@ -189,16 +190,16 @@ void fade_task()
   leds_set(red, grn, blu, wht);
 }
 
-void auto_onoff_task()
+void auto_offon_task()
 {
   if (on) {
     turnOff();
     if (btn_rs() == BTN_RS_RIGHT)
-      tmr_start(TMR_AUTO_OFFON, AUTO_OFF_COUNT);
+      tmr_start(TMR_AUTO_OFFON, AUTO_ON_COUNT);
   } else /* off */ {
     turnOn();
     if (btn_rs() == BTN_RS_RIGHT)
-      tmr_start(TMR_AUTO_OFFON, AUTO_ON_COUNT);
+      tmr_start(TMR_AUTO_OFFON, AUTO_OFF_COUNT);
   }
 }
 
@@ -229,7 +230,7 @@ void user_tasks(unsigned char block)
         start_fade();
         break;
       case TASK_AUTO_OFFON:     /* auto on/off timer has fired */
-        auto_onoff_task();
+        auto_offon_task();
         break;
     }
   }