]> oss.titaniummirror.com Git - rgblamp.git/commitdiff
Extend candle flicker in most modes 1.2
authorR. Steve McKown <rsmckown@gmail.com>
Sat, 31 Dec 2011 21:23:31 +0000 (14:23 -0700)
committerR. Steve McKown <rsmckown@gmail.com>
Sat, 31 Dec 2011 21:55:25 +0000 (14:55 -0700)
Flicker is not implemented in MODE_PARTY or when color is white.

main.c

diff --git a/main.c b/main.c
index 3c3066075c1bc9983bc5c62a6e41727133d19137..4efecb58f57a9eda3cda482970a435db96482244 100644 (file)
--- a/main.c
+++ b/main.c
@@ -74,7 +74,7 @@ enum {
   HELD_TMR_PERIODS = 1,  /* Held timer fires every 32.768 msec */
   HELD_PERIODS = 16,     /* Held this long before held events fire */
   COLOR_COUNT = 12,
-  COLOR_CANDLE = 0,      /* Color index for white */
+  COLOR_CANDLE = 0,      /* Color index for the candle color */
   COLOR_WHITE = 11,      /* Color index for white */
   BRIGHT_TOP = 100,      /* Bright ramps up to top ... */
   BRIGHT_BOTTOM = -5,    /* ... then down to bottom */
@@ -182,7 +182,7 @@ void leds_set()
   signed char b;
 
   /* Use correct brightness value, then constrain it */
-  if (mode == MODE_SOLID && color == COLOR_CANDLE)
+  if (mode != MODE_PARTY && color != COLOR_WHITE)
     b = cbright;
   else
     b = bright;
@@ -374,13 +374,15 @@ void fade_task()
     wht.value += wht.remainder;
     tmr_stop(TMR_CANDLE);
     tmr_stop(TMR_FADE);
-    if (mode == MODE_CYCLE)
-      tmr_start(TMR_INCOLOR, STD_INCOLOR);
-    else if (mode == MODE_PARTY)
+    if (mode == MODE_PARTY)
       tmr_start(TMR_INCOLOR, PARTY_MIN + (lfsr_get() % PARTY_RANGE));
-    else if (mode == MODE_SOLID && color == COLOR_CANDLE) {
-      cbright = bright - CBRIGHT_VARIANCE / 2;
-      tmr_startPeriodic(TMR_CANDLE, 1);
+    else {
+      if (mode == MODE_CYCLE)
+        tmr_start(TMR_INCOLOR, STD_INCOLOR);
+      if (color != COLOR_WHITE) {
+        cbright = bright - CBRIGHT_VARIANCE / 2;
+        tmr_startPeriodic(TMR_CANDLE, 1);
+      }
     }
   }
   leds_set();