share for RS

Fork of rbVectorIQ by Mark @RRVA

Revision:
6:074f5ec7428c
Parent:
5:1f6311e0fc14
Child:
7:0db51a3107fc
--- a/main.cpp	Fri Dec 02 14:33:16 2016 +0000
+++ b/main.cpp	Fri Dec 09 15:50:13 2016 +0000
@@ -54,6 +54,7 @@
 #define PATTERN_CANDY                    0x07
 #define PATTERN_SNOW                     0x08
 #define PATTERN_XMAS                     0x09
+#define PATTERN_ICE                      0x0A
 #define LEDS_ON                          0x01
 #define LEDS_OFF                         0x02
 
@@ -151,6 +152,14 @@
             blue = buf[3];
             pattern = buf[5];
         }
+        else
+        {
+            LEDS_ON_FLAG = 1;
+            red = buf[1];
+            green = buf[2];
+            blue = buf[3];
+            pattern = buf[5];
+        }
     }
 }
 
@@ -180,42 +189,39 @@
 {
     if ((radio_active == false) && (LEDS_ON_FLAG == 1)) {
         if (pattern == PATTERN_ON) {
-            for (uint8_t i = 0; i < NUM_LEDS; i++)
+            for (uint8_t i = 0; i <= NUM_LEDS; i++)
                 neopixel_set_color(&m_strip, i, red, green, blue);
             neopixel_show(&m_strip);
             
         } else if (pattern == PATTERN_FAST) {
-            neopixel_clear(&m_strip);
+            //neopixel_clear(&m_strip);
+            for (uint8_t i = 0; i <= NUM_LEDS; i++)
+                neopixel_set_color(&m_strip, i, 0, 0, 0);
             if (led_to_enable > NUM_LEDS)
                 led_to_enable = 0;
-
             neopixel_set_color(&m_strip, led_to_enable, red, green, blue);
             neopixel_show(&m_strip);
             led_to_enable++;
         } else if (pattern == PATTERN_SLOW) {
-            if (slow_count > 20) {
-                slow_count = 0;
-                neopixel_clear(&m_strip);
-                if (led_to_enable > NUM_LEDS)
-                    led_to_enable = 0;
-
-                neopixel_set_color(&m_strip, led_to_enable, red, green, blue);
-                neopixel_show(&m_strip);
-                led_to_enable++;
-            }
-            slow_count++;
+            for (uint8_t i = 0; i <= NUM_LEDS; i++)
+                neopixel_set_color(&m_strip, i, 0, 0, 0);
+            if (led_to_enable > NUM_LEDS)
+                led_to_enable = 0;
+            neopixel_set_color(&m_strip, led_to_enable, red, green, blue);
+            neopixel_show(&m_strip);
+            led_to_enable++;
+            wait_ms(1000);
+            
         } else if (pattern == PATTERN_CHASE) {
             for (uint8_t i = 0; i < NUM_LEDS; i++)
                 neopixel_set_color(&m_strip, i, red, green, blue);
             neopixel_show(&m_strip);
+            
         } else if (pattern == PATTERN_MRB) {
             neopixel_clear(&m_strip);
             led_to_enable = rand()%NUM_LEDS;
-
             neopixel_set_color(&m_strip, led_to_enable, red, green, blue);
             neopixel_show(&m_strip);
-
-            led_to_enable++;
         }
 
         else if (pattern == PATTERN_RAINBOW)
@@ -225,10 +231,16 @@
             candyChase(100, NUM_LEDS, m_strip);
 
         else if (pattern == PATTERN_SNOW)
-            snowflakes(100, NUM_LEDS, m_strip);
+            snowflakes(250, NUM_LEDS, m_strip);
+            
+        else if (pattern == PATTERN_ICE)
+            iceflakes(250, NUM_LEDS, m_strip);
             
         else if (pattern == PATTERN_XMAS)
             xmas(200, NUM_LEDS, m_strip);
+            
+        else
+            neopixel_clear(&m_strip);
 
     }
 }