From 955e1330d99cf597e9129aec7a0b78af199012ca Mon Sep 17 00:00:00 2001 From: zskullz Date: Sat, 9 Nov 2019 20:10:04 -0700 Subject: [PATCH 1/7] Optimize code Use animation functions instead of copy paste for each zone and section --- Holiday_LED_2.0_6_Zones.ino | 5452 ++++------------------------------- 1 file changed, 587 insertions(+), 4865 deletions(-) diff --git a/Holiday_LED_2.0_6_Zones.ino b/Holiday_LED_2.0_6_Zones.ino index b623fa9..4d8b538 100644 --- a/Holiday_LED_2.0_6_Zones.ino +++ b/Holiday_LED_2.0_6_Zones.ino @@ -12,10 +12,7 @@ #include //ArduinoOTA is now included with the ArduinoIDE /***************** START USER CONFIG SECTION *********************************/ -/***************** START USER CONFIG SECTION *********************************/ -/***************** START USER CONFIG SECTION *********************************/ -/***************** START USER CONFIG SECTION *********************************/ - + #define USER_SSID "YOUR_WIRELESS_SSID" #define USER_PASSWORD "YOUR_WIRELESS_PW" #define USER_MQTT_SERVER "YOUR_MQTT_SERVER_ADDRESS" @@ -31,8 +28,8 @@ #define FIRSTZONE_COLOR_ORDER GRB //Color orders, can be RGB, RBG, GRB, GBR, BRG, BGR #define ZONETWO 1 //ZONETWO is pin D2, 1 = zone used 0 = zone unused -#define SECONDZONE_SECTIONS 1 //Number of roof sections setup below -#define SECONDZONE_LEDS 300 //Number of LEDS in this zone +#define SECONDZONE_SECTIONS 3 //Number of roof sections setup below +#define SECONDZONE_LEDS 389 //Number of LEDS in this zone #define SECONDZONE_COLOR_ORDER GRB //Color orders, can be RGB, RBG, GRB, GBR, BRG, BGR #define ZONETHREE 1 //ZONETHREE is pin D3, 1 = zone used 0 = zone unused @@ -455,12 +452,9 @@ #endif -/***************** END USER CONFIG SECTION *********************************/ -/***************** END USER CONFIG SECTION *********************************/ -/***************** END USER CONFIG SECTION *********************************/ -/***************** END USER CONFIG SECTION *********************************/ /***************** END USER CONFIG SECTION *********************************/ + /*********************** WIFI AND MQTT SETUP *****************************/ /*********************** DON'T CHANGE THIS INFO *****************************/ @@ -683,10 +677,6 @@ void calculateMax() } /************************** MQTT CALLBACK ***********************/ -/************************** MQTT CALLBACK ***********************/ -/************************** MQTT CALLBACK ***********************/ -/************************** MQTT CALLBACK ***********************/ -/************************** MQTT CALLBACK ***********************/ void callback(char* topic, byte* payload, unsigned int length) @@ -964,11 +954,6 @@ void callback(char* topic, byte* payload, unsigned int length) /***************** GLOBAL LIGHT FUNCTIONS *******************************/ -/***************** GLOBAL LIGHT FUNCTIONS *******************************/ -/***************** GLOBAL LIGHT FUNCTIONS *******************************/ -/***************** GLOBAL LIGHT FUNCTIONS *******************************/ -/***************** GLOBAL LIGHT FUNCTIONS *******************************/ - void chase() { @@ -996,160 +981,322 @@ void choosePattern() if(effect == "Color_Chase") { #if ZONEONE == 1 - RGB_firstZone(); + rGB(firstZone, FIRSTZONE_LEDS); #endif #if ZONETWO == 1 - RGB_secondZone(); + rGB(secondZone, SECONDZONE_LEDS); #endif #if ZONETHREE == 1 - RGB_thirdZone(); + rGB(thirdZone, THIRDZONE_LEDS); #endif #if ZONEFOUR == 1 - RGB_fourthZone(); + rGB(fourthZone, FOURTHZONE_LEDS); #endif #if ZONEFIVE == 1 - RGB_fifthZone(); + rGB(fifthZone, FIFTHZONE_LEDS); #endif #if ZONESIX == 1 - RGB_sixthZone(); + rGB(sixthZone, SIXTHZONE_LEDS); #endif } if(effect == "Color_Glitter") { - #if ZONEONE == 1 - ColorGlitter_firstZone(glitterChance); + #if ZONEONE == 1 + ColorGlitter(firstZone, FIRSTZONE_LEDS, glitterChance); #endif #if ZONETWO == 1 - ColorGlitter_secondZone(glitterChance); + ColorGlitter(secondZone, SECONDZONE_LEDS, glitterChance); #endif #if ZONETHREE == 1 - ColorGlitter_thirdZone(glitterChance); + ColorGlitter(thirdZone, THIRDZONE_LEDS, glitterChance); #endif #if ZONEFOUR == 1 - ColorGlitter_fourthZone(glitterChance); + ColorGlitter(fourthZone, FOURTHZONE_LEDS, glitterChance); #endif #if ZONEFIVE == 1 - ColorGlitter_fifthZone(glitterChance); + ColorGlitter(fifthZone, FIFTHZONE_LEDS, glitterChance); #endif #if ZONESIX == 1 - ColorGlitter_sixthZone(glitterChance); + ColorGlitter(sixthZone, SIXTHZONE_LEDS, glitterChance); #endif } if(effect == "Single_Race") { - #if ZONEONE == 1 - SingleRace_firstZone(); + #if ZONEONE == 1 + previousLED_firstZone = SingleRace(firstZone, FIRSTZONE_LEDS, previousLED_firstZone); #endif #if ZONETWO == 1 - SingleRace_secondZone(); + previousLED_secondZone = SingleRace(secondZone, SECONDZONE_LEDS, previousLED_secondZone); #endif #if ZONETHREE == 1 - SingleRace_thirdZone(); + previousLED_thirdZone = SingleRace(thirdZone, THIRDZONE_LEDS, previousLED_thirdZone); #endif #if ZONEFOUR == 1 - SingleRace_fourthZone(); + previousLED_fourthZone = SingleRace(fourthZone, FOURTHZONE_LEDS, previousLED_fourthZone); #endif #if ZONEFIVE == 1 - SingleRace_fifthZone(); + previousLED_fifthZone = SingleRace(fifthZone, FIFTHZONE_LEDS, previousLED_fifthZone); #endif #if ZONESIX == 1 - SingleRace_sixthZone(); + previousLED_sixthZone = SingleRace(sixthZone, SIXTHZONE_LEDS, previousLED_sixthZone); #endif } if(effect == "Double_Crash") { #if ZONEONE == 1 - Crash_firstZone(); + fadeToBlackBy(firstZone, FIRSTZONE_LEDS, 15); + #ifdef ZONEONE_SECTION1_START + Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION1_START, ZONEONE_SECTION1_END); + #endif + #ifdef ZONEONE_SECTION2_START + Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION2_START, ZONEONE_SECTION2_END); + #endif + #ifdef ZONEONE_SECTION3_START + Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION3_START, ZONEONE_SECTION3_END); + #endif + #ifdef ZONEONE_SECTION4_START + Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION4_START, ZONEONE_SECTION4_END); + #endif + #ifdef ZONEONE_SECTION5_START + Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION5_START, ZONEONE_SECTION5_END); + #endif + #ifdef ZONEONE_SECTION6_START + Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION6_START, ZONEONE_SECTION6_END); + #endif + #ifdef ZONEONE_SECTION7_START + Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION7_START, ZONEONE_SECTION7_END); + #endif + #ifdef ZONEONE_SECTION8_START + Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION8_START, ZONEONE_SECTION8_END); + #endif + #ifdef ZONEONE_SECTION9_START + Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION9_START, ZONEONE_SECTION9_END); + #endif #endif #if ZONETWO == 1 - Crash_secondZone(); + fadeToBlackBy(secondZone, SECONDZONE_LEDS, 15); + #ifdef ZONETWO_SECTION1_START + Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION1_START, ZONETWO_SECTION1_END); + #endif + #ifdef ZONETWO_SECTION2_START + Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION2_START, ZONETWO_SECTION2_END); + #endif + #ifdef ZONETWO_SECTION3_START + Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION3_START, ZONETWO_SECTION3_END); + #endif + #ifdef ZONETWO_SECTION4_START + Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION4_START, ZONETWO_SECTION4_END); + #endif + #ifdef ZONETWO_SECTION5_START + Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION5_START, ZONETWO_SECTION5_END); + #endif + #ifdef ZONETWO_SECTION6_START + Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION6_START, ZONETWO_SECTION6_END); + #endif + #ifdef ZONETWO_SECTION7_START + Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION7_START, ZONETWO_SECTION7_END); + #endif + #ifdef ZONETWO_SECTION8_START + Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION8_START, ZONETWO_SECTION8_END); + #endif + #ifdef ZONETWO_SECTION9_START + Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION9_START, ZONETWO_SECTION9_END); + #endif #endif #if ZONETHREE == 1 - Crash_thirdZone(); + fadeToBlackBy(thirdZone, THIRDZONE_LEDS, 15); + #ifdef ZONETHREE_SECTION1_START + Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION1_START, ZONETHREE_SECTION1_END); + #endif + #ifdef ZONETHREE_SECTION2_START + Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION2_START, ZONETHREE_SECTION2_END); + #endif + #ifdef ZONETHREE_SECTION3_START + Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION3_START, ZONETHREE_SECTION3_END); + #endif + #ifdef ZONETHREE_SECTION4_START + Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION4_START, ZONETHREE_SECTION4_END); + #endif + #ifdef ZONETHREE_SECTION5_START + Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION5_START, ZONETHREE_SECTION5_END); + #endif + #ifdef ZONETHREE_SECTION6_START + Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION6_START, ZONETHREE_SECTION6_END); + #endif + #ifdef ZONETHREE_SECTION7_START + Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION7_START, ZONETHREE_SECTION7_END); + #endif + #ifdef ZONETHREE_SECTION8_START + Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION8_START, ZONETHREE_SECTION8_END); + #endif + #ifdef ZONETHREE_SECTION9_START + Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION9_START, ZONETHREE_SECTION9_END); + #endif #endif #if ZONEFOUR == 1 - Crash_fourthZone(); + fadeToBlackBy(fourthZone, FOURTHZONE_LEDS, 15); + #ifdef ZONEFOUR_SECTION1_START + Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION1_START, ZONEFOUR_SECTION1_END); + #endif + #ifdef ZONEFOUR_SECTION2_START + Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION2_START, ZONEFOUR_SECTION2_END); + #endif + #ifdef ZONEFOUR_SECTION3_START + Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION3_START, ZONEFOUR_SECTION3_END); + #endif + #ifdef ZONEFOUR_SECTION4_START + Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION4_START, ZONEFOUR_SECTION4_END); + #endif + #ifdef ZONEFOUR_SECTION5_START + Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION5_START, ZONEFOUR_SECTION5_END); + #endif + #ifdef ZONEFOUR_SECTION6_START + Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION6_START, ZONEFOUR_SECTION6_END); + #endif + #ifdef ZONEFOUR_SECTION7_START + Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION7_START, ZONEFOUR_SECTION7_END); + #endif + #ifdef ZONEFOUR_SECTION8_START + Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION8_START, ZONEFOUR_SECTION8_END); + #endif + #ifdef ZONEFOUR_SECTION9_START + Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION9_START, ZONEFOUR_SECTION9_END); + #endif #endif #if ZONEFIVE == 1 - Crash_fifthZone(); + fadeToBlackBy(fifthZone, FIFTHZONE_LEDS, 15); + #ifdef ZONEFIVE_SECTION1_START + Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION1_START, ZONEFIVE_SECTION1_END); + #endif + #ifdef ZONEFIVE_SECTION2_START + Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION2_START, ZONEFIVE_SECTION2_END); + #endif + #ifdef ZONEFIVE_SECTION3_START + Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION3_START, ZONEFIVE_SECTION3_END); + #endif + #ifdef ZONEFIVE_SECTION4_START + Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION4_START, ZONEFIVE_SECTION4_END); + #endif + #ifdef ZONEFIVE_SECTION5_START + Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION5_START, ZONEFIVE_SECTION5_END); + #endif + #ifdef ZONEFIVE_SECTION6_START + Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION6_START, ZONEFIVE_SECTION6_END); + #endif + #ifdef ZONEFIVE_SECTION7_START + Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION7_START, ZONEFIVE_SECTION7_END); + #endif + #ifdef ZONEFIVE_SECTION8_START + Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION8_START, ZONEFIVE_SECTION8_END); + #endif + #ifdef ZONEFIVE_SECTION9_START + Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION9_START, ZONEFIVE_SECTION9_END); + #endif #endif #if ZONESIX == 1 - Crash_sixthZone(); + fadeToBlackBy(sixthZone, SIXTHZONE_LEDS, 15); + #ifdef ZONESIX_SECTION1_START + Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION1_START, ZONESIX_SECTION1_END); + #endif + #ifdef ZONESIX_SECTION2_START + Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION2_START, ZONESIX_SECTION2_END); + #endif + #ifdef ZONESIX_SECTION3_START + Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION3_START, ZONESIX_SECTION3_END); + #endif + #ifdef ZONESIX_SECTION4_START + Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION4_START, ZONESIX_SECTION4_END); + #endif + #ifdef ZONESIX_SECTION5_START + Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION5_START, ZONESIX_SECTION5_END); + #endif + #ifdef ZONESIX_SECTION6_START + Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION6_START, ZONESIX_SECTION6_END); + #endif + #ifdef ZONESIX_SECTION7_START + Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION7_START, ZONESIX_SECTION7_END); + #endif + #ifdef ZONESIX_SECTION8_START + Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION8_START, ZONESIX_SECTION8_END); + #endif + #ifdef ZONESIX_SECTION9_START + Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION9_START, ZONESIX_SECTION9_END); + #endif #endif } if(effect == "Rainbow") { #if ZONEONE == 1 - Rainbow_firstZone(); + Rainbow(firstZone, FIRSTZONE_LEDS); #endif #if ZONETWO == 1 - Rainbow_secondZone(); + Rainbow(secondZone, SECONDZONE_LEDS); #endif #if ZONETHREE == 1 - Rainbow_thirdZone(); + Rainbow(thirdZone, THIRDZONE_LEDS); #endif #if ZONEFOUR == 1 - Rainbow_fourthZone(); + Rainbow(fourthZone, FOURTHZONE_LEDS); #endif #if ZONEFIVE == 1 - Rainbow_fifthZone(); + Rainbow(fifthZone, FIFTHZONE_LEDS); #endif #if ZONESIX == 1 - Rainbow_sixthZone(); + Rainbow(sixthZone, SIXTHZONE_LEDS); #endif } if(effect == "Blocked_Colors") { #if ZONEONE == 1 - Blocked_firstZone(); + Blocked(firstZone, FIRSTZONE_LEDS); #endif #if ZONETWO == 1 - Blocked_secondZone(); + Blocked(secondZone, SECONDZONE_LEDS); #endif #if ZONETHREE == 1 - Blocked_thirdZone(); + Blocked(thirdZone, THIRDZONE_LEDS); #endif #if ZONEFOUR == 1 - Blocked_fourthZone(); + Blocked(fourthZone, FOURTHZONE_LEDS); #endif #if ZONEFIVE == 1 - Blocked_fifthZone(); + Blocked(fifthZone, FIFTHZONE_LEDS); #endif #if ZONESIX == 1 - Blocked_sixthZone(); + Blocked(sixthZone, SIXTHZONE_LEDS); #endif } @@ -1157,107 +1304,108 @@ void choosePattern() { #if ZONEONE == 1 - BPM_firstZone(); + BPM(firstZone, FIRSTZONE_LEDS); #endif #if ZONETWO == 1 - BPM_secondZone(); + BPM(secondZone, SECONDZONE_LEDS); #endif #if ZONETHREE == 1 - BPM_thirdZone(); + BPM(thirdZone, THIRDZONE_LEDS); #endif #if ZONEFOUR == 1 - BPM_fourthZone(); + BPM(fourthZone, FOURTHZONE_LEDS); #endif #if ZONEFIVE == 1 - BPM_fifthZone(); + BPM(fifthZone, FIFTHZONE_LEDS); #endif #if ZONESIX == 1 - BPM_sixthZone(); + BPM(sixthZone, SIXTHZONE_LEDS); #endif + } if(effect == "Twinkle") { #if ZONEONE == 1 - Twinkle_firstZone(); + Twinkle(firstZone, FIRSTZONE_LEDS); #endif #if ZONETWO == 1 - Twinkle_secondZone(); + Twinkle(secondZone, SECONDZONE_LEDS); #endif #if ZONETHREE == 1 - Twinkle_thirdZone(); + Twinkle(thirdZone, THIRDZONE_LEDS); #endif #if ZONEFOUR == 1 - Twinkle_fourthZone(); + Twinkle(fourthZone, FOURTHZONE_LEDS); #endif #if ZONEFIVE == 1 - Twinkle_fifthZone(); + Twinkle(fifthZone, FIFTHZONE_LEDS); #endif #if ZONESIX == 1 - Twinkle_sixthZone(); + Twinkle(sixthZone, SIXTHZONE_LEDS); #endif } if(effect == "Fill_Solid") { #if ZONEONE == 1 - Solid_firstZone(); + Solid(firstZone, FIRSTZONE_LEDS); #endif #if ZONETWO == 1 - Solid_secondZone(); + Solid(secondZone, SECONDZONE_LEDS); #endif #if ZONETHREE == 1 - Solid_thirdZone(); + Solid(thirdZone, THIRDZONE_LEDS); #endif #if ZONEFOUR == 1 - Solid_fourthZone(); + Solid(fourthZone, FOURTHZONE_LEDS); #endif #if ZONEFIVE == 1 - Solid_fifthZone(); + Solid(fifthZone, FIFTHZONE_LEDS); #endif #if ZONESIX == 1 - Solid_sixthZone(); + Solid(sixthZone, SIXTHZONE_LEDS); #endif } if(effect == "Spooky_Eyes") { #if ZONEONE == 1 - Eyes_firstZone(); + Eyes(firstZone, FIRSTZONE_LEDS); #endif #if ZONETWO == 1 - Eyes_secondZone(); + Eyes(secondZone, SECONDZONE_LEDS); #endif #if ZONETHREE == 1 - Eyes_thirdZone(); + Eyes(thirdZone, THIRDZONE_LEDS); #endif #if ZONEFOUR == 1 - Eyes_fourthZone(); + Eyes(fourthZone, FOURTHZONE_LEDS); #endif #if ZONEFIVE == 1 - Eyes_fifthZone(); + Eyes(fifthZone, FIFTHZONE_LEDS); #endif #if ZONESIX == 1 - Eyes_sixthZone(); + Eyes(sixthZone, SIXTHZONE_LEDS); #endif } @@ -1265,240 +1413,291 @@ void choosePattern() if(effect == "LED_Locator") { #if ZONEONE == 1 - Locator_firstZone(); + Locator(firstZone, FIRSTZONE_LEDS); #endif #if ZONETWO == 1 - Locator_secondZone(); + Locator(secondZone, SECONDZONE_LEDS); #endif #if ZONETHREE == 1 - Locator_thirdZone(); + Locator(thirdZone, THIRDZONE_LEDS); #endif #if ZONEFOUR == 1 - Locator_fourthZone(); + Locator(fourthZone, FOURTHZONE_LEDS); #endif #if ZONEFIVE == 1 - Locator_fifthZone(); + Locator(fifthZone, FIFTHZONE_LEDS); #endif #if ZONESIX == 1 - Locator_sixthZone(); + Locator(sixthZone, SIXTHZONE_LEDS); #endif } if(effect == "Ripple") { - #if ZONEONE == 1 - Ripple_firstZone(); + #if ZONEONE == 1 + Ripple(firstZone, FIRSTZONE_LEDS, center_firstZone, step_firstZone); #endif #if ZONETWO == 1 - Ripple_secondZone(); + Ripple(secondZone, SECONDZONE_LEDS, center_secondZone, step_secondZone); #endif #if ZONETHREE == 1 - Ripple_thirdZone(); + Ripple(thirdZone, THIRDZONE_LEDS, center_thirdZone, step_thirdZone); #endif #if ZONEFOUR == 1 - Ripple_fourthZone(); + Ripple(fourthZone, FOURTHZONE_LEDS, center_fourthZone, step_fourthZone); #endif #if ZONEFIVE == 1 - Ripple_fifthZone(); + Ripple(fifthZone, FIFTHZONE_LEDS, center_fifthZone, step_fifthZone); #endif #if ZONESIX == 1 - Ripple_sixthZone(); + Ripple(sixthZone, SIXTHZONE_LEDS, center_sixthZone, step_sixthZone); #endif } if(effect == "Fire") { - - #if ZONEONE == 1 - #if FIRSTZONE_SECTIONS >= 1 - fire_firstZone_SECTION1(); - #endif - #if FIRSTZONE_SECTIONS >= 2 - fire_firstZone_SECTION2(); - #endif - #if FIRSTZONE_SECTIONS >= 3 - fire_firstZone_SECTION3(); - #endif - #if FIRSTZONE_SECTIONS >= 4 - fire_firstZone_SECTION4(); - #endif - #if FIRSTZONE_SECTIONS >= 5 - fire_firstZone_SECTION5(); - #endif - #if FIRSTZONE_SECTIONS >= 6 - fire_firstZone_SECTION6(); - #endif - #if FIRSTZONE_SECTIONS >= 7 - fire_firstZone_SECTION7(); - #endif - #if FIRSTZONE_SECTIONS >= 8 - fire_firstZone_SECTION8(); - #endif - #if FIRSTZONE_SECTIONS >= 9 - fire_firstZone_SECTION9(); - #endif - #endif - - #if ZONETWO == 1 - #if SECONDZONE_SECTIONS >= 1 - fire_secondZone_SECTION1(); - #endif - #if SECONDZONE_SECTIONS >= 2 - fire_secondZone_SECTION2(); - #endif - #if SECONDZONE_SECTIONS >= 3 - fire_secondZone_SECTION3(); - #endif - #if SECONDZONE_SECTIONS >= 4 - fire_secondZone_SECTION4(); - #endif - #if SECONDZONE_SECTIONS >= 5 - fire_secondZone_SECTION5(); - #endif - #if SECONDZONE_SECTIONS >= 6 - fire_secondZone_SECTION6(); - #endif - #if SECONDZONE_SECTIONS >= 7 - fire_secondZone_SECTION7(); - #endif - #if SECONDZONE_SECTIONS >= 8 - fire_secondZone_SECTION8(); - #endif - #if SECONDZONE_SECTIONS >= 9 - fire_secondZone_SECTION9(); - #endif - #endif - - #if ZONETHREE == 1 - #if THIRDZONE_SECTIONS >= 1 - fire_thirdZone_SECTION1(); - #endif - #if THIRDZONE_SECTIONS >= 2 - fire_thirdZone_SECTION2(); - #endif - #if THIRDZONE_SECTIONS >= 3 - fire_thirdZone_SECTION3(); - #endif - #if THIRDZONE_SECTIONS >= 4 - fire_thirdZone_SECTION4(); - #endif - #if THIRDZONE_SECTIONS >= 5 - fire_thirdZone_SECTION5(); - #endif - #if THIRDZONE_SECTIONS >= 6 - fire_thirdZone_SECTION6(); - #endif - #if THIRDZONE_SECTIONS >= 7 - fire_thirdZone_SECTION7(); - #endif - #if THIRDZONE_SECTIONS >= 8 - fire_thirdZone_SECTION8(); - #endif - #if THIRDZONE_SECTIONS >= 9 - fire_thirdZone_SECTION9(); - #endif - #endif - - #if ZONEFOUR == 1 - #if FOURTHZONE_SECTIONS >= 1 - fire_fourthZone_SECTION1(); - #endif - #if FOURTHZONE_SECTIONS >= 2 - fire_fourthZone_SECTION2(); - #endif - #if FOURTHZONE_SECTIONS >= 3 - fire_fourthZone_SECTION3(); - #endif - #if FOURTHZONE_SECTIONS >= 4 - fire_fourthZone_SECTION4(); - #endif - #if FOURTHZONE_SECTIONS >= 5 - fire_fourthZone_SECTION5(); - #endif - #if FOURTHZONE_SECTIONS >= 6 - fire_fourthZone_SECTION6(); - #endif - #if FOURTHZONE_SECTIONS >= 7 - fire_fourthZone_SECTION7(); - #endif - #if FOURTHZONE_SECTIONS >= 8 - fire_fourthZone_SECTION8(); - #endif - #if FOURTHZONE_SECTIONS >= 9 - fire_fourthZone_SECTION9(); - #endif - #endif - - #if ZONEFIVE == 1 - #if FIFTHZONE_SECTIONS >= 1 - fire_fifthZone_SECTION1(); - #endif - #if FIFTHZONE_SECTIONS >= 2 - fire_fifthZone_SECTION2(); - #endif - #if FIFTHZONE_SECTIONS >= 3 - fire_fifthZone_SECTION3(); - #endif - #if FIFTHZONE_SECTIONS >= 4 - fire_fifthZone_SECTION4(); - #endif - #if FIFTHZONE_SECTIONS >= 5 - fire_fifthZone_SECTION5(); - #endif - #if FIFTHZONE_SECTIONS >= 6 - fire_fifthZone_SECTION6(); - #endif - #if FIFTHZONE_SECTIONS >= 7 - fire_fifthZone_SECTION7(); - #endif - #if FIFTHZONE_SECTIONS >= 8 - fire_fifthZone_SECTION8(); - #endif - #if FIFTHZONE_SECTIONS >= 9 - fire_fifthZone_SECTION9(); - #endif - #endif - - #if ZONESIX == 1 - #if SIXTHZONE_SECTIONS >= 1 - fire_sixthZone_SECTION1(); - #endif - #if SIXTHZONE_SECTIONS >= 2 - fire_sixthZone_SECTION2(); - #endif - #if SIXTHZONE_SECTIONS >= 3 - fire_sixthZone_SECTION3(); - #endif - #if SIXTHZONE_SECTIONS >= 4 - fire_sixthZone_SECTION4(); + #if ZONEONE == 1 + #if FIRSTZONE_SECTIONS >= 1 + static byte z1s1heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(firstZone, z1s1heat, ZONEONE_SECTION1_START, ZONEONE_SECTION1_END, ZONEONE_SECTION1_START_FIRE, ZONEONE_SECTION1_END_FIRE); + #endif + #if FIRSTZONE_SECTIONS >= 2 + static byte z1s2heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(firstZone, z1s2heat, ZONEONE_SECTION2_START, ZONEONE_SECTION2_END, ZONEONE_SECTION2_START_FIRE, ZONEONE_SECTION2_END_FIRE); + #endif + #if FIRSTZONE_SECTIONS >= 3 + static byte z1s3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(firstZone, z1s3heat, ZONEONE_SECTION3_START, ZONEONE_SECTION3_END, ZONEONE_SECTION3_START_FIRE, ZONEONE_SECTION3_END_FIRE); + #endif + #if FIRSTZONE_SECTIONS >= 4 + static byte z1s4heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(firstZone, z1s4heat, ZONEONE_SECTION4_START, ZONEONE_SECTION4_END, ZONEONE_SECTION4_START_FIRE, ZONEONE_SECTION4_END_FIRE); + #endif + #if FIRSTZONE_SECTIONS >= 5 + static byte z1s5heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(firstZone, z1s5heat, ZONEONE_SECTION5_START, ZONEONE_SECTION5_END, ZONEONE_SECTION5_START_FIRE, ZONEONE_SECTION5_END_FIRE); + #endif + #if FIRSTZONE_SECTIONS >= 6 + static byte z1s6heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(firstZone, z1s6heat, ZONEONE_SECTION6_START, ZONEONE_SECTION6_END, ZONEONE_SECTION6_START_FIRE, ZONEONE_SECTION6_END_FIRE); + #endif + #if FIRSTZONE_SECTIONS >= 7 + static byte z1s7heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(firstZone, z1s7heat, ZONEONE_SECTION7_START, ZONEONE_SECTION7_END, ZONEONE_SECTION7_START_FIRE, ZONEONE_SECTION7_END_FIRE); + #endif + #if FIRSTZONE_SECTIONS >= 8 + static byte z1s8heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(firstZone, z1s8heat, ZONEONE_SECTION8_START, ZONEONE_SECTION8_END, ZONEONE_SECTION8_START_FIRE, ZONEONE_SECTION8_END_FIRE); + #endif + #if FIRSTZONE_SECTIONS >= 9 + static byte z1s9heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(firstZone, z1s9heat, ZONEONE_SECTION9_START, ZONEONE_SECTION9_END, ZONEONE_SECTION9_START_FIRE, ZONEONE_SECTION9_END_FIRE); + #endif #endif - #if SIXTHZONE_SECTIONS >= 5 - fire_sixthZone_SECTION5(); + #if ZONETWO == 1 + #if SECONDZONE_SECTIONS >= 1 + static byte z2s1heat[ZONETWO_SECTION1_END-ZONETWO_SECTION1_START]; + fire(secondZone, z2s1heat, ZONETWO_SECTION1_START, ZONETWO_SECTION1_END, ZONETWO_SECTION1_START_FIRE, ZONETWO_SECTION1_END_FIRE); + #endif + #if SECONDZONE_SECTIONS >= 2 + static byte z2s2heat[ZONETWO_SECTION2_END-ZONETWO_SECTION2_START]; + fire(secondZone, z2s2heat, ZONETWO_SECTION2_START, ZONETWO_SECTION2_END, ZONETWO_SECTION2_START_FIRE, ZONETWO_SECTION2_END_FIRE); + #endif + #if SECONDZONE_SECTIONS >= 3 + static byte z2s3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(secondZone, z2s3heat, ZONETWO_SECTION3_START, ZONETWO_SECTION3_END, ZONETWO_SECTION3_START_FIRE, ZONETWO_SECTION3_END_FIRE); + #endif + #if SECONDZONE_SECTIONS >= 4 + static byte z2s4heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(secondZone, z2s4heat, ZONETWO_SECTION4_START, ZONETWO_SECTION4_END, ZONETWO_SECTION4_START_FIRE, ZONETWO_SECTION4_END_FIRE); + #endif + #if SECONDZONE_SECTIONS >= 5 + static byte z2s5heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(secondZone, z2s5heat, ZONETWO_SECTION5_START, ZONETWO_SECTION5_END, ZONETWO_SECTION5_START_FIRE, ZONETWO_SECTION5_END_FIRE); + #endif + #if SECONDZONE_SECTIONS >= 6 + static byte z2s6heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(secondZone, z2s6heat, ZONETWO_SECTION6_START, ZONETWO_SECTION6_END, ZONETWO_SECTION6_START_FIRE, ZONETWO_SECTION6_END_FIRE); + #endif + #if SECONDZONE_SECTIONS >= 7 + static byte z2s7heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(secondZone, z2s7heat, ZONETWO_SECTION7_START, ZONETWO_SECTION7_END, ZONETWO_SECTION7_START_FIRE, ZONETWO_SECTION7_END_FIRE); + #endif + #if SECONDZONE_SECTIONS >= 8 + static byte z2s8heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(secondZone, z2s8heat, ZONETWO_SECTION8_START, ZONETWO_SECTION8_END, ZONETWO_SECTION8_START_FIRE, ZONETWO_SECTION8_END_FIRE); + #endif + #if SECONDZONE_SECTIONS >= 9 + static byte z2s9heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(secondZone, z2s9heat, ZONETWO_SECTION9_START, ZONETWO_SECTION9_END, ZONETWO_SECTION9_START_FIRE, ZONETWO_SECTION9_END_FIRE); + #endif #endif - #if SIXTHZONE_SECTIONS >= 6 - fire_sixthZone_SECTION6(); + #if ZONETHREE == 1 + #if THIRDZONE_SECTIONS >= 1 + static byte z3s1heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(thirdZone, z3s1heat, ZONETHREE_SECTION1_START, ZONETHREE_SECTION1_END, ZONETHREE_SECTION1_START_FIRE, ZONETHREE_SECTION1_END_FIRE); + #endif + #if THIRDZONE_SECTIONS >= 2 + static byte z3s2heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(thirdZone, z3s2heat, ZONETHREE_SECTION2_START, ZONETHREE_SECTION2_END, ZONETHREE_SECTION2_START_FIRE, ZONETHREE_SECTION2_END_FIRE); + #endif + #if THIRDZONE_SECTIONS >= 3 + static byte z3s3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(thirdZone, z3s3heat, ZONETHREE_SECTION3_START, ZONETHREE_SECTION3_END, ZONETHREE_SECTION3_START_FIRE, ZONETHREE_SECTION3_END_FIRE); + #endif + #if THIRDZONE_SECTIONS >= 4 + static byte z3s4heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(thirdZone, z3s4heat, ZONETHREE_SECTION4_START, ZONETHREE_SECTION4_END, ZONETHREE_SECTION4_START_FIRE, ZONETHREE_SECTION4_END_FIRE); + #endif + #if THIRDZONE_SECTIONS >= 5 + static byte z3s5heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(thirdZone, z3s5heat, ZONETHREE_SECTION5_START, ZONETHREE_SECTION5_END, ZONETHREE_SECTION5_START_FIRE, ZONETHREE_SECTION5_END_FIRE); + #endif + #if THIRDZONE_SECTIONS >= 6 + static byte z3s6heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(thirdZone, z3s6heat, ZONETHREE_SECTION6_START, ZONETHREE_SECTION6_END, ZONETHREE_SECTION6_START_FIRE, ZONETHREE_SECTION6_END_FIRE); + #endif + #if THIRDZONE_SECTIONS >= 7 + static byte z3s7heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(thirdZone, z3s7heat, ZONETHREE_SECTION7_START, ZONETHREE_SECTION7_END, ZONETHREE_SECTION7_START_FIRE, ZONETHREE_SECTION7_END_FIRE); + #endif + #if THIRDZONE_SECTIONS >= 8 + static byte z3s8heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(thirdZone, z3s8heat, ZONETHREE_SECTION8_START, ZONETHREE_SECTION8_END, ZONETHREE_SECTION8_START_FIRE, ZONETHREE_SECTION8_END_FIRE); + #endif + #if THIRDZONE_SECTIONS >= 9 + static byte z3s9heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(thirdZone, z3s9heat, ZONETHREE_SECTION9_START, ZONETHREE_SECTION9_END, ZONETHREE_SECTION9_START_FIRE, ZONETHREE_SECTION9_END_FIRE); + #endif #endif - #if SIXTHZONE_SECTIONS >= 7 - fire_sixthZone_SECTION7(); + + #if ZONEFOUR == 1 + #if FOURTHZONE_SECTIONS >= 1 + static byte z4s1heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fourthZone, z4s1heat, ZONEFOUR_SECTION1_START, ZONEFOUR_SECTION1_END, ZONEFOUR_SECTION1_START_FIRE, ZONEFOUR_SECTION1_END_FIRE); + #endif + #if FOURTHZONE_SECTIONS >= 2 + static byte z4s2heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fourthZone, z4s2heat, ZONEFOUR_SECTION2_START, ZONEFOUR_SECTION2_END, ZONEFOUR_SECTION2_START_FIRE, ZONEFOUR_SECTION2_END_FIRE); + #endif + #if FOURTHZONE_SECTIONS >= 3 + static byte z4s3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fourthZone, z4s3heat, ZONEFOUR_SECTION3_START, ZONEFOUR_SECTION3_END, ZONEFOUR_SECTION3_START_FIRE, ZONEFOUR_SECTION3_END_FIRE); + #endif + #if FOURTHZONE_SECTIONS >= 4 + static byte z4s4heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fourthZone, z4s4heat, ZONEFOUR_SECTION4_START, ZONEFOUR_SECTION4_END, ZONEFOUR_SECTION4_START_FIRE, ZONEFOUR_SECTION4_END_FIRE); + #endif + #if FOURTHZONE_SECTIONS >= 5 + static byte z4s5heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fourthZone, z4s5heat, ZONEFOUR_SECTION5_START, ZONEFOUR_SECTION5_END, ZONEFOUR_SECTION5_START_FIRE, ZONEFOUR_SECTION5_END_FIRE); + #endif + #if FOURTHZONE_SECTIONS >= 6 + static byte z4s6heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fourthZone, z4s6heat, ZONEFOUR_SECTION6_START, ZONEFOUR_SECTION6_END, ZONEFOUR_SECTION6_START_FIRE, ZONEFOUR_SECTION6_END_FIRE); + #endif + #if FOURTHZONE_SECTIONS >= 7 + static byte z4s7heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fourthZone, z4s7heat, ZONEFOUR_SECTION7_START, ZONEFOUR_SECTION7_END, ZONEFOUR_SECTION7_START_FIRE, ZONEFOUR_SECTION7_END_FIRE); + #endif + #if FOURTHZONE_SECTIONS >= 8 + static byte z4s8heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fourthZone, z4s8heat, ZONEFOUR_SECTION8_START, ZONEFOUR_SECTION8_END, ZONEFOUR_SECTION8_START_FIRE, ZONEFOUR_SECTION8_END_FIRE); + #endif + #if FOURTHZONE_SECTIONS >= 9 + static byte z4s9heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fourthZone, z4s9heat, ZONEFOUR_SECTION9_START, ZONEFOUR_SECTION9_END, ZONEFOUR_SECTION9_START_FIRE, ZONEFOUR_SECTION9_END_FIRE); + #endif #endif - #if SIXTHZONE_SECTIONS >= 8 - fire_sixthZone_SECTION8(); + + #if ZONEFIVE == 1 + #if FIFTHZONE_SECTIONS >= 1 + static byte z5s1heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fifthZone, z5s1heat, ZONEFIVE_SECTION1_START, ZONEFIVE_SECTION1_END, ZONEFIVE_SECTION1_START_FIRE, ZONEFIVE_SECTION1_END_FIRE); + #endif + #if FIFTHZONE_SECTIONS >= 2 + static byte z5s2heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fifthZone, z5s2heat, ZONEFIVE_SECTION2_START, ZONEFIVE_SECTION2_END, ZONEFIVE_SECTION2_START_FIRE, ZONEFIVE_SECTION2_END_FIRE); + #endif + #if FIFTHZONE_SECTIONS >= 3 + static byte z5s3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fifthZone, z5s3heat, ZONEFIVE_SECTION3_START, ZONEFIVE_SECTION3_END, ZONEFIVE_SECTION3_START_FIRE, ZONEFIVE_SECTION3_END_FIRE); + #endif + #if FIFTHZONE_SECTIONS >= 4 + static byte z5s4heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fifthZone, z5s4heat, ZONEFIVE_SECTION4_START, ZONEFIVE_SECTION4_END, ZONEFIVE_SECTION4_START_FIRE, ZONEFIVE_SECTION4_END_FIRE); + #endif + #if FIFTHZONE_SECTIONS >= 5 + static byte z5s5heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fifthZone, z5s5heat, ZONEFIVE_SECTION5_START, ZONEFIVE_SECTION5_END, ZONEFIVE_SECTION5_START_FIRE, ZONEFIVE_SECTION5_END_FIRE); + #endif + #if FIFTHZONE_SECTIONS >= 6 + static byte z5s6heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fifthZone, z5s6heat, ZONEFIVE_SECTION6_START, ZONEFIVE_SECTION6_END, ZONEFIVE_SECTION6_START_FIRE, ZONEFIVE_SECTION6_END_FIRE); + #endif + #if FIFTHZONE_SECTIONS >= 7 + static byte z5s7heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fifthZone, z5s7heat, ZONEFIVE_SECTION7_START, ZONEFIVE_SECTION7_END, ZONEFIVE_SECTION7_START_FIRE, ZONEFIVE_SECTION7_END_FIRE); + #endif + #if FIFTHZONE_SECTIONS >= 8 + static byte z5s8heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fifthZone, z5s8heat, ZONEFIVE_SECTION8_START, ZONEFIVE_SECTION8_END, ZONEFIVE_SECTION8_START_FIRE, ZONEFIVE_SECTION8_END_FIRE); + #endif + #if FIFTHZONE_SECTIONS >= 9 + static byte z5s9heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(fifthZone, z5s9heat, ZONEFIVE_SECTION9_START, ZONEFIVE_SECTION9_END, ZONEFIVE_SECTION9_START_FIRE, ZONEFIVE_SECTION9_END_FIRE); + #endif #endif - #if SIXTHZONE_SECTIONS >= 9 - fire_sixthZone_SECTION9(); + + #if ZONESIX == 1 + #if SIXTHZONE_SECTIONS >= 1 + static byte z6s1heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(sixthZone, z6s1heat, ZONESIX_SECTION1_START, ZONESIX_SECTION1_END, ZONESIX_SECTION1_START_FIRE, ZONESIX_SECTION1_END_FIRE); + #endif + #if SIXTHZONE_SECTIONS >= 2 + static byte z6s2heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(sixthZone, z6s2heat, ZONESIX_SECTION2_START, ZONESIX_SECTION2_END, ZONESIX_SECTION2_START_FIRE, ZONESIX_SECTION2_END_FIRE); + #endif + #if SIXTHZONE_SECTIONS >= 3 + static byte z6s3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(sixthZone, z6s3heat, ZONESIX_SECTION3_START, ZONESIX_SECTION3_END, ZONESIX_SECTION3_START_FIRE, ZONESIX_SECTION3_END_FIRE); + #endif + #if SIXTHZONE_SECTIONS >= 4 + static byte z6s4heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(sixthZone, z6s4heat, ZONESIX_SECTION4_START, ZONESIX_SECTION4_END, ZONESIX_SECTION4_START_FIRE, ZONESIX_SECTION4_END_FIRE); + #endif + #if SIXTHZONE_SECTIONS >= 5 + static byte z6s5heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(sixthZone, z6s5heat, ZONESIX_SECTION5_START, ZONESIX_SECTION5_END, ZONESIX_SECTION5_START_FIRE, ZONESIX_SECTION5_END_FIRE); + #endif + #if SIXTHZONE_SECTIONS >= 6 + static byte z6s6heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(sixthZone, z6s6heat, ZONESIX_SECTION6_START, ZONESIX_SECTION6_END, ZONESIX_SECTION6_START_FIRE, ZONESIX_SECTION6_END_FIRE); + #endif + #if SIXTHZONE_SECTIONS >= 7 + static byte z6s7heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(sixthZone, z6s7heat, ZONESIX_SECTION7_START, ZONESIX_SECTION7_END, ZONESIX_SECTION7_START_FIRE, ZONESIX_SECTION7_END_FIRE); + #endif + #if SIXTHZONE_SECTIONS >= 8 + static byte z6s8heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(sixthZone, z6s8heat, ZONESIX_SECTION8_START, ZONESIX_SECTION8_END, ZONESIX_SECTION8_START_FIRE, ZONESIX_SECTION8_END_FIRE); + #endif + #if SIXTHZONE_SECTIONS >= 9 + static byte z6s9heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + fire(sixthZone, z6s9heat, ZONESIX_SECTION9_START, ZONESIX_SECTION9_END, ZONESIX_SECTION9_START_FIRE, ZONESIX_SECTION9_END_FIRE); + #endif #endif - #endif - } + } } if(showLights == false) { @@ -1531,10 +1730,7 @@ void choosePattern() } /*********************** PATTERN MODIFIERS ***************************/ -/*********************** PATTERN MODIFIERS ***************************/ -/*********************** PATTERN MODIFIERS ***************************/ -/*********************** PATTERN MODIFIERS ***************************/ -/*********************** PATTERN MODIFIERS ***************************/ + void addLightning() { @@ -1842,10 +2038,6 @@ void locator_Move() -/***************** SETUP FUNCTION ****************************************/ -/***************** SETUP FUNCTION ****************************************/ -/***************** SETUP FUNCTION ****************************************/ -/***************** SETUP FUNCTION ****************************************/ /***************** SETUP FUNCTION ****************************************/ @@ -1870,10 +2062,6 @@ void setup() { } -/***************** MAIN LOOP ****************************************/ -/***************** MAIN LOOP ****************************************/ -/***************** MAIN LOOP ****************************************/ -/***************** MAIN LOOP ****************************************/ /***************** MAIN LOOP ****************************************/ @@ -1919,377 +2107,315 @@ void loop() } +/***************** Animation Functions ****************************************/ -/***************** firstZone Animations ****************************************/ -/***************** firstZone Animations ****************************************/ -/***************** firstZone Animations ****************************************/ -/***************** firstZone Animations ****************************************/ -/***************** firstZone Animations ****************************************/ - -#if ZONEONE == 1 - - -void Ripple_firstZone() +void Ripple(CRGB zone[], int ledCount, int zoneCenter, int zoneStep) { - for (int i = 0; i < FIRSTZONE_LEDS; i++) + for (int i = 0; i < ledCount; i++) { - firstZone[i] = CRGB((red2/75), (green2/75), (blue2/75)); + zone[i] = CRGB((red2/75), (green2/75), (blue2/75)); } - switch (step_firstZone) + switch (zoneStep) { case -1: - center_firstZone = random16(FIRSTZONE_LEDS); - step_firstZone = 0; + zoneCenter = random16(ledCount); + zoneStep = 0; break; case 0: - firstZone[center_firstZone] = CRGB(red1, green1, blue1); - step_firstZone ++; + zone[zoneCenter] = CRGB(red1, green1, blue1); + zoneStep ++; break; case 12: - step_firstZone = -1; + zoneStep = -1; break; default: // Middle of the ripples. - firstZone[(center_firstZone + step_firstZone + FIRSTZONE_LEDS) % FIRSTZONE_LEDS] += CRGB((red1/(step_firstZone * 5)), (green1/(step_firstZone * 5)), (blue1/(step_firstZone * 5))); - firstZone[(center_firstZone - step_firstZone + FIRSTZONE_LEDS) % FIRSTZONE_LEDS] += CRGB((red1/(step_firstZone * 5)), (green1/(step_firstZone * 5)), (blue1/(step_firstZone * 5))); - step_firstZone ++; + zone[(zoneCenter + zoneStep + ledCount) % ledCount] += CRGB((red1/(zoneStep * 5)), (green1/(zoneStep * 5)), (blue1/(zoneStep * 5))); + zone[(zoneCenter - zoneStep + ledCount) % ledCount] += CRGB((red1/(zoneStep * 5)), (green1/(zoneStep * 5)), (blue1/(zoneStep * 5))); + zoneStep ++; break; } } -void RGB_firstZone() +void rGB(CRGB zone[], int zoneLEDS) { if(startPosition < 6) { - fadeToBlackBy( firstZone, FIRSTZONE_LEDS, 80); - for(int pixel = startPosition+1; pixel < FIRSTZONE_LEDS; pixel+=6) + fadeToBlackBy( zone, zoneLEDS, 80); + for(int pixel = startPosition+1; pixel < zoneLEDS; pixel+=6) { - if(pixel <= FIRSTZONE_LEDS) + if(pixel <= zoneLEDS) { - firstZone[pixel] = CRGB(red1,green1,blue1); + zone[pixel] = CRGB(red1,green1,blue1); } } - for(int pixel = startPosition+3; pixel < FIRSTZONE_LEDS; pixel+=6) + for(int pixel = startPosition+3; pixel < zoneLEDS; pixel+=6) { - if(pixel <= FIRSTZONE_LEDS) + if(pixel <= zoneLEDS) { - firstZone[pixel] = CRGB(red2,green2,blue2); + zone[pixel] = CRGB(red2,green2,blue2); } } - for(int pixel = startPosition+5; pixel < FIRSTZONE_LEDS; pixel+=6) + for(int pixel = startPosition+5; pixel < zoneLEDS; pixel+=6) { - if(pixel <= FIRSTZONE_LEDS) + if(pixel <= zoneLEDS) { - firstZone[pixel] = CRGB(red3,green3,blue3); + zone[pixel] = CRGB(red3,green3,blue3); } } } if(startPosition == 1) { - firstZone[0]=CRGB(red3,green3,blue3); + zone[0]=CRGB(red3,green3,blue3); } if(startPosition == 2) { - firstZone[1]=CRGB(red3,green3,blue3); + zone[1]=CRGB(red3,green3,blue3); } if(startPosition == 3) { - firstZone[2]=CRGB(red3,green3,blue3); - firstZone[0]=CRGB(red2,green2,blue2); + zone[2]=CRGB(red3,green3,blue3); + zone[0]=CRGB(red2,green2,blue2); } if(startPosition == 4) { - firstZone[3]=CRGB(red3,green3,blue3); - firstZone[1]=CRGB(red2,green2,blue2); + zone[3]=CRGB(red3,green3,blue3); + zone[1]=CRGB(red2,green2,blue2); } if(startPosition == 5) { - firstZone[4]=CRGB(red3,green3,blue3); - firstZone[2]=CRGB(red2,green2,blue2); - firstZone[0]=CRGB(red1,green1,blue1); + zone[4]=CRGB(red3,green3,blue3); + zone[2]=CRGB(red2,green2,blue2); + zone[0]=CRGB(red1,green1,blue1); } } -void ColorGlitter_firstZone( fract8 chanceOfGlitter) +void ColorGlitter(CRGB zone[], int zoneLEDS, fract8 chanceOfGlitter) { - fadeToBlackBy( firstZone, FIRSTZONE_LEDS, 2); + fadeToBlackBy( zone, zoneLEDS, 2); if(startPosition == 0) { if( random8() < chanceOfGlitter) { - firstZone[ random16(FIRSTZONE_LEDS) ] += CRGB::Red; + zone[ random16(zoneLEDS) ] += CRGB::Red; } } if(startPosition == 1) { if( random8() < chanceOfGlitter) { - firstZone[ random16(FIRSTZONE_LEDS) ] += CRGB::Orange; + zone[ random16(zoneLEDS) ] += CRGB::Orange; } } if(startPosition == 2) { if( random8() < chanceOfGlitter) { - firstZone[ random16(FIRSTZONE_LEDS) ] += CRGB::Yellow; + zone[ random16(zoneLEDS) ] += CRGB::Yellow; } } if(startPosition == 3) { if( random8() < chanceOfGlitter) { - firstZone[ random16(FIRSTZONE_LEDS) ] += CRGB::Green; + zone[ random16(zoneLEDS) ] += CRGB::Green; } } if(startPosition == 4) { if( random8() < chanceOfGlitter) { - firstZone[ random16(FIRSTZONE_LEDS) ] += CRGB::Blue; + zone[ random16(zoneLEDS) ] += CRGB::Blue; } } if(startPosition == 5) { if( random8() < chanceOfGlitter) { - firstZone[ random16(FIRSTZONE_LEDS) ] += CRGB::Violet; + zone[ random16(zoneLEDS) ] += CRGB::Violet; } } } -void SingleRace_firstZone() +int SingleRace(CRGB zone[], int zoneLEDS, int previousZoneLED) { - fadeToBlackBy( firstZone, FIRSTZONE_LEDS, 1); - int pos = beatsin16( raceSpeed, 0, FIRSTZONE_LEDS); - if(pos > previousLED_firstZone) + fadeToBlackBy( zone, zoneLEDS, 1); + int pos = beatsin16( raceSpeed, 0, zoneLEDS); + if(pos > previousZoneLED) { - firstZone[pos] = CRGB(red1,green1,blue1); - previousLED_firstZone = pos; + zone[pos] = CRGB(red1,green1,blue1); } - if(pos < previousLED_firstZone) + if(pos < previousZoneLED) { - firstZone[pos] = CRGB(red2,green2,blue2); - previousLED_firstZone = pos; - } + zone[pos] = CRGB(red2,green2,blue2); + } + return pos; } -void Crash_firstZone() +void Crash(CRGB zone[], int zoneLEDS, int sectionStart, int sectionEnd) { - fadeToBlackBy( firstZone, FIRSTZONE_LEDS, 15); - #ifdef ZONEONE_SECTION1_START - int pos_SECTION1 = beatsin16( raceSpeed, 0, (ZONEONE_SECTION1_END - ZONEONE_SECTION1_START) ); - firstZone[ZONEONE_SECTION1_START + pos_SECTION1] = CRGB(red1,green1,blue1); - firstZone[ZONEONE_SECTION1_END - pos_SECTION1] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONEONE_SECTION2_START - int pos_SECTION2 = beatsin16( raceSpeed, 0, (ZONEONE_SECTION2_END - ZONEONE_SECTION2_START) ); - firstZone[ZONEONE_SECTION2_START + pos_SECTION2] = CRGB(red2,green2,blue2); - firstZone[ZONEONE_SECTION2_END - pos_SECTION2] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONEONE_SECTION3_START - int pos_SECTION3 = beatsin16( raceSpeed, 0, (ZONEONE_SECTION3_END - ZONEONE_SECTION3_START) ); - firstZone[ZONEONE_SECTION3_START + pos_SECTION3] = CRGB(red1,green1,blue1); - firstZone[ZONEONE_SECTION3_END - pos_SECTION3] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONEONE_SECTION4_START - int pos_SECTION4 = beatsin16( raceSpeed, 0, (ZONEONE_SECTION4_END - ZONEONE_SECTION4_START) ); - firstZone[ZONEONE_SECTION4_START + pos_SECTION4] = CRGB(red2,green2,blue2); - firstZone[ZONEONE_SECTION4_END - pos_SECTION4] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONEONE_SECTION5_START - int pos_SECTION5 = beatsin16( raceSpeed, 0, (ZONEONE_SECTION5_END - ZONEONE_SECTION5_START) ); - firstZone[ZONEONE_SECTION5_START + pos_SECTION5] = CRGB(red1,green1,blue1); - firstZone[ZONEONE_SECTION5_END - pos_SECTION5] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONEONE_SECTION6_START - int pos_SECTION6 = beatsin16( raceSpeed, 0, (ZONEONE_SECTION6_END - ZONEONE_SECTION6_START) ); - firstZone[ZONEONE_SECTION6_START + pos_SECTION6] = CRGB(red2,green2,blue2); - firstZone[ZONEONE_SECTION6_END - pos_SECTION6] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONEONE_SECTION7_START - int pos_SECTION7 = beatsin16( raceSpeed, 0, (ZONEONE_SECTION7_END - ZONEONE_SECTION7_START) ); - firstZone[ZONEONE_SECTION7_START + pos_SECTION7] = CRGB(red1,green1,blue1); - firstZone[ZONEONE_SECTION7_END - pos_SECTION7] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONEONE_SECTION8_START - int pos_SECTION8 = beatsin16( raceSpeed, 0, (ZONEONE_SECTION8_END - ZONEONE_SECTION8_START) ); - firstZone[ZONEONE_SECTION8_START + pos_SECTION8] = CRGB(red2,green2,blue2); - firstZone[ZONEONE_SECTION8_END - pos_SECTION8] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONEONE_SECTION9_START - int pos_SECTION9 = beatsin16( raceSpeed, 0, (ZONEONE_SECTION9_END - ZONEONE_SECTION9_START) ); - firstZone[ZONEONE_SECTION9_START + pos_SECTION9] = CRGB(red1,green1,blue1); - firstZone[ZONEONE_SECTION9_END - pos_SECTION9] = CRGB(red2,green2,blue2); - #endif - + int pos = beatsin16( raceSpeed, 0, (sectionEnd - sectionStart) ); + zone[sectionStart + pos] = CRGB(red1,green1,blue1); + zone[sectionEnd - pos] = CRGB(red2,green2,blue2); } -void Rainbow_firstZone() +void Rainbow(CRGB zone[], int zoneLEDS) { - fill_rainbow( firstZone, FIRSTZONE_LEDS, gHue, numberOfRainbows); + fill_rainbow( zone, zoneLEDS, gHue, numberOfRainbows); } -void Blocked_firstZone() +void Blocked(CRGB zone[], int zoneLEDS) { - fadeToBlackBy( firstZone, FIRSTZONE_LEDS, 2); - for( int mark = 0; mark < FIRSTZONE_LEDS; mark+=30) + fadeToBlackBy( zone, zoneLEDS, 2); + for( int mark = 0; mark < zoneLEDS; mark+=30) { for( int i = 0; i < 9; i++) { if(startPosition == 0 || startPosition == 1) { - if(i+mark <= FIRSTZONE_LEDS) + if(i+mark <= zoneLEDS) { - firstZone[i+mark] = CRGB(red1,green1,blue1); + zone[i+mark] = CRGB(red1,green1,blue1); } - if(i+10+mark <= FIRSTZONE_LEDS) + if(i+10+mark <= zoneLEDS) { - firstZone[i+10+mark] = CRGB(red2,green2,blue2); + zone[i+10+mark] = CRGB(red2,green2,blue2); } - if(i+20+mark <= FIRSTZONE_LEDS) + if(i+20+mark <= zoneLEDS) { - firstZone[i+20+mark] = CRGB(red3,green3,blue3); + zone[i+20+mark] = CRGB(red3,green3,blue3); } } if(startPosition == 2 || startPosition == 3) { - if(i+mark <= FIRSTZONE_LEDS) + if(i+mark <= zoneLEDS) { - firstZone[i+mark] = CRGB(red2,green2,blue2); + zone[i+mark] = CRGB(red2,green2,blue2); } - if(i+10+mark <= FIRSTZONE_LEDS) + if(i+10+mark <= zoneLEDS) { - firstZone[i+10+mark] = CRGB(red3,green3,blue3); + zone[i+10+mark] = CRGB(red3,green3,blue3); } - if(i+20+mark <= FIRSTZONE_LEDS) + if(i+20+mark <= zoneLEDS) { - firstZone[i+20+mark] = CRGB(red1,green1,blue1); + zone[i+20+mark] = CRGB(red1,green1,blue1); } } if(startPosition == 4 || startPosition == 5) { - if(i+mark <= FIRSTZONE_LEDS) + if(i+mark <= zoneLEDS) { - firstZone[i+mark] = CRGB(red3,green3,blue3); + zone[i+mark] = CRGB(red3,green3,blue3); } - if(i+10+mark <= FIRSTZONE_LEDS) + if(i+10+mark <= zoneLEDS) { - firstZone[i+10+mark] = CRGB(red1,green1,blue1); + zone[i+10+mark] = CRGB(red1,green1,blue1); } - if(i+20+mark <= FIRSTZONE_LEDS) + if(i+20+mark <= zoneLEDS) { - firstZone[i+20+mark] = CRGB(red2,green2,blue2); + zone[i+20+mark] = CRGB(red2,green2,blue2); } } } } } -void BPM_firstZone() +void BPM(CRGB zone[], int zoneLEDS) { if((red1*2) > (green1 + blue1)) { - CRGBPalette16 palette_firstZone = LavaColors_p; + CRGBPalette16 palette = LavaColors_p; uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < FIRSTZONE_LEDS; i++) + for( int i = 0; i < zoneLEDS; i++) { - firstZone[i] = ColorFromPalette(palette_firstZone, gHue+(i*2), beat-gHue+(i*10)); + zone[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10)); } } if((green1*2) > (red1 + blue1)) { - CRGBPalette16 palette_firstZone = ForestColors_p; + CRGBPalette16 palette = ForestColors_p; uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < FIRSTZONE_LEDS; i++) + for( int i = 0; i < zoneLEDS; i++) { - firstZone[i] = ColorFromPalette(palette_firstZone, gHue+(i*2), beat-gHue+(i*10)); + zone[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10)); } } if((blue1*2) > (green1 + red1)) { - CRGBPalette16 palette_firstZone = CloudColors_p; + CRGBPalette16 palette = CloudColors_p; uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < FIRSTZONE_LEDS; i++) + for( int i = 0; i < zoneLEDS; i++) { - firstZone[i] = ColorFromPalette(palette_firstZone, gHue+(i*2), beat-gHue+(i*10)); + zone[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10)); } } if((blue1*2) == (green1 + red1)) { - CRGBPalette16 palette_firstZone = PartyColors_p; + CRGBPalette16 palette = PartyColors_p; uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < FIRSTZONE_LEDS; i++) + for( int i = 0; i < zoneLEDS; i++) { - firstZone[i] = ColorFromPalette(palette_firstZone, gHue+(i*2), beat-gHue+(i*10)); + zone[i] = ColorFromPalette(palette, gHue+(i*2), beat-gHue+(i*10)); } } } -void Twinkle_firstZone() +void Twinkle(CRGB zone[], int zoneLEDS) { - fadeToBlackBy( firstZone, FIRSTZONE_LEDS, 80); - for( int i = 0; i < FIRSTZONE_LEDS-5; i+=5) + fadeToBlackBy( zone, zoneLEDS, 80); + for( int i = 0; i < zoneLEDS-5; i+=5) { - if(i <= FIRSTZONE_LEDS) + if(i <= zoneLEDS) { if (random8() > twinkleChance) { - firstZone[i] = CRGB( red1, green1, blue1); + zone[i] = CRGB( red1, green1, blue1); } else { - firstZone[i] = CRGB( 150, 100, 40); + zone[i] = CRGB( 150, 100, 40); } } } } -void Eyes_firstZone() +void Eyes(CRGB zone[], int zoneLEDS) { unsigned int chance = random8(); if( chance > eyeChance) { - unsigned int eye = random16(FIRSTZONE_LEDS); - firstZone[eye] = CRGB(red1,green1,blue1); - firstZone[eye-4] = CRGB(red1,green1,blue1); + unsigned int eye = random16(zoneLEDS); + zone[eye] = CRGB(red1,green1,blue1); + zone[eye-4] = CRGB(red1,green1,blue1); } if( chance > 39) { - fadeToBlackBy( firstZone, FIRSTZONE_LEDS, 10); + fadeToBlackBy( zone, zoneLEDS, 10); } } -void Solid_firstZone() +void Solid(CRGB zone[], int zoneLEDS) { - fill_solid(firstZone, FIRSTZONE_LEDS, CRGB(red1, green1, blue1)); + fill_solid(zone, zoneLEDS, CRGB(red1, green1, blue1)); } -void Locator_firstZone() +void Locator(CRGB zone[], int zoneLEDS) { - if(locatorLED <= FIRSTZONE_LEDS) + if(locatorLED <= zoneLEDS) { - fill_solid(firstZone, FIRSTZONE_LEDS, CRGB::Black); - firstZone[locatorLED]=CRGB(red1, green1, blue1); + fill_solid(zone, zoneLEDS, CRGB::Black); + zone[locatorLED]=CRGB(red1, green1, blue1); } } -#ifdef ZONEONE_SECTION1_START -void fire_firstZone_SECTION1() +void fire(CRGB zone[], byte heat[], int sectionStart, int sectionEnd, int fireStart, int fireEnd) { - static byte heat[ZONEONE_SECTION1_END - ZONEONE_SECTION1_START]; - for( int i = 0; i < ZONEONE_SECTION1_END - ZONEONE_SECTION1_START; i++) + int sizeOfSection = sectionEnd - sectionStart; + for( int i = 0; i < sizeOfSection; i++) { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / ZONEONE_SECTION1_END - ZONEONE_SECTION1_START) + 2)); + heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); } - for( int k= ZONEONE_SECTION1_END - ZONEONE_SECTION1_START - 1; k >= 2; k--) + for( int k= sizeOfSection - 1; k >= 2; k--) { heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; } @@ -2298,4431 +2424,27 @@ void fire_firstZone_SECTION1() int y = random8(7); heat[y] = qadd8( heat[y], random8(160,255) ); } - for( int j = 0; j < ZONEONE_SECTION1_END - ZONEONE_SECTION1_START; j++) + for( int j = 0; j < sizeOfSection; j++) { byte colorindex = scale8( heat[j], 240); CRGB color = ColorFromPalette( gPal, colorindex); int pixelnumber; if( gReverseDirection ) { - pixelnumber = (ZONEONE_SECTION1_END - ZONEONE_SECTION1_START -1) - j; + pixelnumber = (sizeOfSection -1) - j; } else { pixelnumber = j; } int thisFlame = ((pixelnumber * firesize)/100); - #if ZONEONE_SECTION1_START_FIRE == 1 - if(thisFlame <= ZONEONE_SECTION1_END - ZONEONE_SECTION1_START ) + if(fireStart == 1 && thisFlame <= sizeOfSection) { - firstZone[ZONEONE_SECTION1_START + thisFlame] = color; + zone[sectionStart + thisFlame] = color; } - #endif - #if ZONEONE_SECTION1_END_FIRE == 1 - if(thisFlame <= ZONEONE_SECTION1_END - ZONEONE_SECTION1_START ) + if(fireEnd == 1 && thisFlame <= sizeOfSection ) { - firstZone[ZONEONE_SECTION1_END - thisFlame] = color; + zone[sectionEnd - thisFlame] = color; } - #endif } } -#endif - -#ifdef ZONEONE_SECTION2_START -void fire_firstZone_SECTION2() -{ - const int sizeOfSection = ZONEONE_SECTION2_END - ZONEONE_SECTION2_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEONE_SECTION2_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION2_START + thisFlame] = color; - } - #endif - - #if ZONEONE_SECTION2_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION2_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEONE_SECTION3_START -void fire_firstZone_SECTION3() -{ - const int sizeOfSection = ZONEONE_SECTION3_END - ZONEONE_SECTION3_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEONE_SECTION3_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION3_START + thisFlame] = color; - } - #endif - - #if ZONEONE_SECTION3_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION3_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEONE_SECTION4_START -void fire_firstZone_SECTION4() -{ - const int sizeOfSection = ZONEONE_SECTION4_END - ZONEONE_SECTION4_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEONE_SECTION4_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION4_START + thisFlame] = color; - } - #endif - - #if ZONEONE_SECTION4_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION4_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEONE_SECTION5_START -void fire_firstZone_SECTION5() -{ - const int sizeOfSection = ZONEONE_SECTION5_END - ZONEONE_SECTION5_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEONE_SECTION5_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION5_START + thisFlame] = color; - } - #endif - - #if ZONEONE_SECTION5_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION5_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEONE_SECTION6_START -void fire_firstZone_SECTION6() -{ - const int sizeOfSection = ZONEONE_SECTION6_END - ZONEONE_SECTION6_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEONE_SECTION6_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION6_START + thisFlame] = color; - } - #endif - - #if ZONEONE_SECTION6_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION6_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEONE_SECTION7_START -void fire_firstZone_SECTION7() -{ - const int sizeOfSection = ZONEONE_SECTION7_END - ZONEONE_SECTION7_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEONE_SECTION7_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION7_START + thisFlame] = color; - } - #endif - - #if ZONEONE_SECTION7_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION7_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEONE_SECTION8_START -void fire_firstZone_SECTION8() -{ - const int sizeOfSection = ZONEONE_SECTION8_END - ZONEONE_SECTION8_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEONE_SECTION8_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION8_START + thisFlame] = color; - } - #endif - - #if ZONEONE_SECTION8_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION8_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEONE_SECTION9_START -void fire_firstZone_SECTION9() -{ - const int sizeOfSection = ZONEONE_SECTION9_END - ZONEONE_SECTION9_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEONE_SECTION9_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION9_START + thisFlame] = color; - } - #endif - - #if ZONEONE_SECTION9_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - firstZone[ZONEONE_SECTION9_END - thisFlame] = color; - } - #endif - } -} -#endif - -#endif - -/***************** secondZone Animations ****************************************/ -/***************** secondZone Animations ****************************************/ -/***************** secondZone Animations ****************************************/ -/***************** secondZone Animations ****************************************/ -/***************** secondZone Animations ****************************************/ - -#if ZONETWO == 1 - -void Ripple_secondZone() -{ - for (int i = 0; i < SECONDZONE_LEDS; i++) - { - secondZone[i] = CRGB((red2/75), (green2/75), (blue2/75)); - } - switch (step_secondZone) - { - case -1: - center_secondZone = random16(SECONDZONE_LEDS); - step_secondZone = 0; - break; - case 0: - secondZone[center_secondZone] = CRGB(red1, green1, blue1); - step_secondZone ++; - break; - case 12: - step_secondZone = -1; - break; - default: // Middle of the ripples. - secondZone[(center_secondZone + step_secondZone + SECONDZONE_LEDS) % SECONDZONE_LEDS] += CRGB((red1/(step_secondZone * 5)), (green1/(step_secondZone * 5)), (blue1/(step_secondZone * 5))); - secondZone[(center_secondZone - step_secondZone + SECONDZONE_LEDS) % SECONDZONE_LEDS] += CRGB((red1/(step_secondZone * 5)), (green1/(step_secondZone * 5)), (blue1/(step_secondZone * 5))); - step_secondZone ++; - break; - } -} - -void RGB_secondZone() -{ - if(startPosition < 6) - { - fadeToBlackBy( secondZone, SECONDZONE_LEDS, 80); - for(int pixel = startPosition+1; pixel < SECONDZONE_LEDS; pixel+=6) - { - if(pixel <= SECONDZONE_LEDS) - { - secondZone[pixel] = CRGB(red1,green1,blue1); - } - } - for(int pixel = startPosition+3; pixel < SECONDZONE_LEDS; pixel+=6) - { - if(pixel <= SECONDZONE_LEDS) - { - secondZone[pixel] = CRGB(red2,green2,blue2); - } - } - for(int pixel = startPosition+5; pixel < SECONDZONE_LEDS; pixel+=6) - { - if(pixel <= SECONDZONE_LEDS) - { - secondZone[pixel] = CRGB(red3,green3,blue3); - } - } - } - if(startPosition == 1) - { - secondZone[0]=CRGB(red3,green3,blue3); - } - if(startPosition == 2) - { - secondZone[1]=CRGB(red3,green3,blue3); - } - if(startPosition == 3) - { - secondZone[2]=CRGB(red3,green3,blue3); - secondZone[0]=CRGB(red2,green2,blue2); - } - if(startPosition == 4) - { - secondZone[3]=CRGB(red3,green3,blue3); - secondZone[1]=CRGB(red2,green2,blue2); - } - if(startPosition == 5) - { - secondZone[4]=CRGB(red3,green3,blue3); - secondZone[2]=CRGB(red2,green2,blue2); - secondZone[0]=CRGB(red1,green1,blue1); - } -} - -void ColorGlitter_secondZone( fract8 chanceOfGlitter) -{ - fadeToBlackBy( secondZone, SECONDZONE_LEDS, 2); - if(startPosition == 0) - { - if( random8() < chanceOfGlitter) - { - secondZone[ random16(SECONDZONE_LEDS) ] += CRGB::Red; - } - } - if(startPosition == 1) - { - if( random8() < chanceOfGlitter) - { - secondZone[ random16(SECONDZONE_LEDS) ] += CRGB::Orange; - } - } - if(startPosition == 2) - { - if( random8() < chanceOfGlitter) - { - secondZone[ random16(SECONDZONE_LEDS) ] += CRGB::Yellow; - } - } - if(startPosition == 3) - { - if( random8() < chanceOfGlitter) - { - secondZone[ random16(SECONDZONE_LEDS) ] += CRGB::Green; - } - } - if(startPosition == 4) - { - if( random8() < chanceOfGlitter) - { - secondZone[ random16(SECONDZONE_LEDS) ] += CRGB::Blue; - } - } - if(startPosition == 5) - { - if( random8() < chanceOfGlitter) - { - secondZone[ random16(SECONDZONE_LEDS) ] += CRGB::Violet; - } - } -} - -void SingleRace_secondZone() -{ - fadeToBlackBy( secondZone, SECONDZONE_LEDS, 1); - int pos = beatsin16( raceSpeed, 0, SECONDZONE_LEDS); - if(pos > previousLED_secondZone) - { - secondZone[pos] = CRGB(red1,green1,blue1); - previousLED_secondZone = pos; - } - if(pos < previousLED_secondZone) - { - secondZone[pos] = CRGB(red2,green2,blue2); - previousLED_secondZone = pos; - } -} - -void Crash_secondZone() -{ - fadeToBlackBy( secondZone, SECONDZONE_LEDS, 15); - #ifdef ZONETWO_SECTION1_START - int pos_SECTION1 = beatsin16( raceSpeed, 0, (ZONETWO_SECTION1_END - ZONETWO_SECTION1_START) ); - secondZone[ZONETWO_SECTION1_START + pos_SECTION1] = CRGB(red1,green1,blue1); - secondZone[ZONETWO_SECTION1_END - pos_SECTION1] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONETWO_SECTION2_START - int pos_SECTION2 = beatsin16( raceSpeed, 0, (ZONETWO_SECTION2_END - ZONETWO_SECTION2_START) ); - secondZone[ZONETWO_SECTION2_START + pos_SECTION2] = CRGB(red2,green2,blue2); - secondZone[ZONETWO_SECTION2_END - pos_SECTION2] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONETWO_SECTION3_START - int pos_SECTION3 = beatsin16( raceSpeed, 0, (ZONETWO_SECTION3_END - ZONETWO_SECTION3_START) ); - secondZone[ZONETWO_SECTION3_START + pos_SECTION3] = CRGB(red1,green1,blue1); - secondZone[ZONETWO_SECTION3_END - pos_SECTION3] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONETWO_SECTION4_START - int pos_SECTION4 = beatsin16( raceSpeed, 0, (ZONETWO_SECTION4_END - ZONETWO_SECTION4_START) ); - secondZone[ZONETWO_SECTION4_START + pos_SECTION4] = CRGB(red2,green2,blue2); - secondZone[ZONETWO_SECTION4_END - pos_SECTION4] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONETWO_SECTION5_START - int pos_SECTION5 = beatsin16( raceSpeed, 0, (ZONETWO_SECTION5_END - ZONETWO_SECTION5_START) ); - secondZone[ZONETWO_SECTION5_START + pos_SECTION5] = CRGB(red1,green1,blue1); - secondZone[ZONETWO_SECTION5_END - pos_SECTION5] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONETWO_SECTION6_START - int pos_SECTION6 = beatsin16( raceSpeed, 0, (ZONETWO_SECTION6_END - ZONETWO_SECTION6_START) ); - secondZone[ZONETWO_SECTION6_START + pos_SECTION6] = CRGB(red2,green2,blue2); - secondZone[ZONETWO_SECTION6_END - pos_SECTION6] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONETWO_SECTION7_START - int pos_SECTION7 = beatsin16( raceSpeed, 0, (ZONETWO_SECTION7_END - ZONETWO_SECTION7_START) ); - secondZone[ZONETWO_SECTION7_START + pos_SECTION7] = CRGB(red1,green1,blue1); - secondZone[ZONETWO_SECTION7_END - pos_SECTION7] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONETWO_SECTION8_START - int pos_SECTION8 = beatsin16( raceSpeed, 0, (ZONETWO_SECTION8_END - ZONETWO_SECTION8_START) ); - secondZone[ZONETWO_SECTION8_START + pos_SECTION8] = CRGB(red2,green2,blue2); - secondZone[ZONETWO_SECTION8_END - pos_SECTION8] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONETWO_SECTION9_START - int pos_SECTION9 = beatsin16( raceSpeed, 0, (ZONETWO_SECTION9_END - ZONETWO_SECTION9_START) ); - secondZone[ZONETWO_SECTION9_START + pos_SECTION9] = CRGB(red1,green1,blue1); - secondZone[ZONETWO_SECTION9_END - pos_SECTION9] = CRGB(red2,green2,blue2); - #endif - -} - -void Rainbow_secondZone() -{ - fill_rainbow( secondZone, SECONDZONE_LEDS, gHue, numberOfRainbows); -} - -void Blocked_secondZone() -{ - fadeToBlackBy( secondZone, SECONDZONE_LEDS, 2); - for( int mark = 0; mark < SECONDZONE_LEDS; mark+=30) - { - for( int i = 0; i < 9; i++) - { - if(startPosition == 0 || startPosition == 1) - { - if(i+mark <= SECONDZONE_LEDS) - { - secondZone[i+mark] = CRGB(red1,green1,blue1); - } - if(i+10+mark <= SECONDZONE_LEDS) - { - secondZone[i+10+mark] = CRGB(red2,green2,blue2); - } - if(i+20+mark <= SECONDZONE_LEDS) - { - secondZone[i+20+mark] = CRGB(red3,green3,blue3); - } - } - if(startPosition == 2 || startPosition == 3) - { - if(i+mark <= SECONDZONE_LEDS) - { - secondZone[i+mark] = CRGB(red2,green2,blue2); - } - if(i+10+mark <= SECONDZONE_LEDS) - { - secondZone[i+10+mark] = CRGB(red3,green3,blue3); - } - if(i+20+mark <= SECONDZONE_LEDS) - { - secondZone[i+20+mark] = CRGB(red1,green1,blue1); - } - } - if(startPosition == 4 || startPosition == 5) - { - if(i+mark <= SECONDZONE_LEDS) - { - secondZone[i+mark] = CRGB(red3,green3,blue3); - } - if(i+10+mark <= SECONDZONE_LEDS) - { - secondZone[i+10+mark] = CRGB(red1,green1,blue1); - } - if(i+20+mark <= SECONDZONE_LEDS) - { - secondZone[i+20+mark] = CRGB(red2,green2,blue2); - } - } - } - } -} - -void BPM_secondZone() -{ - if((red1*2) > (green1 + blue1)) - { - CRGBPalette16 palette_secondZone = LavaColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < SECONDZONE_LEDS; i++) - { - secondZone[i] = ColorFromPalette(palette_secondZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((green1*2) > (red1 + blue1)) - { - CRGBPalette16 palette_secondZone = ForestColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < SECONDZONE_LEDS; i++) - { - secondZone[i] = ColorFromPalette(palette_secondZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((blue1*2) > (green1 + red1)) - { - CRGBPalette16 palette_secondZone = CloudColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < SECONDZONE_LEDS; i++) - { - secondZone[i] = ColorFromPalette(palette_secondZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((blue1*2) == (green1 + red1)) - { - CRGBPalette16 palette_secondZone = PartyColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < SECONDZONE_LEDS; i++) - { - secondZone[i] = ColorFromPalette(palette_secondZone, gHue+(i*2), beat-gHue+(i*10)); - } - } -} - -void Twinkle_secondZone() -{ - fadeToBlackBy( secondZone, SECONDZONE_LEDS, 80); - for( int i = 0; i < SECONDZONE_LEDS-5; i+=5) - { - if(i <= SECONDZONE_LEDS) - { - if (random8() > twinkleChance) - { - secondZone[i] = CRGB( red1, green1, blue1); - } - else - { - secondZone[i] = CRGB( 150, 100, 40); - } - } - } -} - -void Eyes_secondZone() -{ - unsigned int chance = random8(); - if( chance > eyeChance) - { - unsigned int eye = random16(SECONDZONE_LEDS); - secondZone[eye] = CRGB(red1,green1,blue1); - secondZone[eye-4] = CRGB(red1,green1,blue1); - } - if( chance > 39) - { - fadeToBlackBy( secondZone, SECONDZONE_LEDS, 10); - } -} - -void Solid_secondZone() -{ - fill_solid(secondZone, SECONDZONE_LEDS, CRGB(red1, green1, blue1)); -} - -void Locator_secondZone() -{ - if(locatorLED <= SECONDZONE_LEDS) - { - fill_solid(secondZone, SECONDZONE_LEDS, CRGB::Black); - secondZone[locatorLED]=CRGB(red1, green1, blue1); - } -} - -#ifdef ZONETWO_SECTION1_START -void fire_secondZone_SECTION1() -{ - static byte heat[ZONETWO_SECTION1_END - ZONETWO_SECTION1_START]; - for( int i = 0; i < ZONETWO_SECTION1_END - ZONETWO_SECTION1_START; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / ZONETWO_SECTION1_END - ZONETWO_SECTION1_START) + 2)); - } - - for( int k= ZONETWO_SECTION1_END - ZONETWO_SECTION1_START - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < ZONETWO_SECTION1_END - ZONETWO_SECTION1_START; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (ZONETWO_SECTION1_END - ZONETWO_SECTION1_START -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETWO_SECTION1_START_FIRE == 1 - if(thisFlame <= ZONETWO_SECTION1_END - ZONETWO_SECTION1_START ) - { - secondZone[ZONETWO_SECTION1_START + thisFlame] = color; - } - #endif - - #if ZONETWO_SECTION1_END_FIRE == 1 - if(thisFlame <= ZONETWO_SECTION1_END - ZONETWO_SECTION1_START ) - { - secondZone[ZONETWO_SECTION1_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETWO_SECTION2_START -void fire_secondZone_SECTION2() -{ - const int sizeOfSection = ZONETWO_SECTION2_END - ZONETWO_SECTION2_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETWO_SECTION2_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION2_START + thisFlame] = color; - } - #endif - - #if ZONETWO_SECTION2_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION2_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETWO_SECTION3_START -void fire_secondZone_SECTION3() -{ - const int sizeOfSection = ZONETWO_SECTION3_END - ZONETWO_SECTION3_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETWO_SECTION3_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION3_START + thisFlame] = color; - } - #endif - - #if ZONETWO_SECTION3_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION3_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETWO_SECTION4_START -void fire_secondZone_SECTION4() -{ - const int sizeOfSection = ZONETWO_SECTION4_END - ZONETWO_SECTION4_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETWO_SECTION4_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION4_START + thisFlame] = color; - } - #endif - - #if ZONETWO_SECTION4_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION4_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETWO_SECTION5_START -void fire_secondZone_SECTION5() -{ - const int sizeOfSection = ZONETWO_SECTION5_END - ZONETWO_SECTION5_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETWO_SECTION5_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION5_START + thisFlame] = color; - } - #endif - - #if ZONETWO_SECTION5_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION5_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETWO_SECTION6_START -void fire_secondZone_SECTION6() -{ - const int sizeOfSection = ZONETWO_SECTION6_END - ZONETWO_SECTION6_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETWO_SECTION6_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION6_START + thisFlame] = color; - } - #endif - - #if ZONETWO_SECTION6_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION6_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETWO_SECTION7_START -void fire_secondZone_SECTION7() -{ - const int sizeOfSection = ZONETWO_SECTION7_END - ZONETWO_SECTION7_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETWO_SECTION7_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION7_START + thisFlame] = color; - } - #endif - - #if ZONETWO_SECTION7_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION7_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETWO_SECTION8_START -void fire_secondZone_SECTION8() -{ - const int sizeOfSection = ZONETWO_SECTION8_END - ZONETWO_SECTION8_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETWO_SECTION8_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION8_START + thisFlame] = color; - } - #endif - - #if ZONETWO_SECTION8_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION8_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETWO_SECTION9_START -void fire_secondZone_SECTION9() -{ - const int sizeOfSection = ZONETWO_SECTION9_END - ZONETWO_SECTION9_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETWO_SECTION9_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION9_START + thisFlame] = color; - } - #endif - - #if ZONETWO_SECTION9_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - secondZone[ZONETWO_SECTION9_END - thisFlame] = color; - } - #endif - } -} -#endif - -#endif - -/***************** thirdZone Animations ****************************************/ -/***************** thirdZone Animations ****************************************/ -/***************** thirdZone Animations ****************************************/ -/***************** thirdZone Animations ****************************************/ -/***************** thirdZone Animations ****************************************/ - -#if ZONETHREE == 1 - -void Ripple_thirdZone() -{ - for (int i = 0; i < THIRDZONE_LEDS; i++) - { - thirdZone[i] = CRGB((red2/75), (green2/75), (blue2/75)); - } - switch (step_thirdZone) - { - case -1: - center_thirdZone = random16(THIRDZONE_LEDS); - step_thirdZone = 0; - break; - case 0: - thirdZone[center_thirdZone] = CRGB(red1, green1, blue1); - step_thirdZone ++; - break; - case 12: - step_thirdZone = -1; - break; - default: // Middle of the ripples. - thirdZone[(center_thirdZone + step_thirdZone + THIRDZONE_LEDS) % THIRDZONE_LEDS] += CRGB((red1/(step_thirdZone * 5)), (green1/(step_thirdZone * 5)), (blue1/(step_thirdZone * 5))); - thirdZone[(center_thirdZone - step_thirdZone + THIRDZONE_LEDS) % THIRDZONE_LEDS] += CRGB((red1/(step_thirdZone * 5)), (green1/(step_thirdZone * 5)), (blue1/(step_thirdZone * 5))); - step_thirdZone ++; - break; - } -} - -void RGB_thirdZone() -{ - if(startPosition < 6) - { - fadeToBlackBy( thirdZone, THIRDZONE_LEDS, 80); - for(int pixel = startPosition+1; pixel < THIRDZONE_LEDS; pixel+=6) - { - if(pixel <= THIRDZONE_LEDS) - { - thirdZone[pixel] = CRGB(red1,green1,blue1); - } - } - for(int pixel = startPosition+3; pixel < THIRDZONE_LEDS; pixel+=6) - { - if(pixel <= THIRDZONE_LEDS) - { - thirdZone[pixel] = CRGB(red2,green2,blue2); - } - } - for(int pixel = startPosition+5; pixel < THIRDZONE_LEDS; pixel+=6) - { - if(pixel <= THIRDZONE_LEDS) - { - thirdZone[pixel] = CRGB(red3,green3,blue3); - } - } - } - if(startPosition == 1) - { - thirdZone[0]=CRGB(red3,green3,blue3); - } - if(startPosition == 2) - { - thirdZone[1]=CRGB(red3,green3,blue3); - } - if(startPosition == 3) - { - thirdZone[2]=CRGB(red3,green3,blue3); - thirdZone[0]=CRGB(red2,green2,blue2); - } - if(startPosition == 4) - { - thirdZone[3]=CRGB(red3,green3,blue3); - thirdZone[1]=CRGB(red2,green2,blue2); - } - if(startPosition == 5) - { - thirdZone[4]=CRGB(red3,green3,blue3); - thirdZone[2]=CRGB(red2,green2,blue2); - thirdZone[0]=CRGB(red1,green1,blue1); - } -} - -void ColorGlitter_thirdZone( fract8 chanceOfGlitter) -{ - fadeToBlackBy( thirdZone, THIRDZONE_LEDS, 2); - if(startPosition == 0) - { - if( random8() < chanceOfGlitter) - { - thirdZone[ random16(THIRDZONE_LEDS) ] += CRGB::Red; - } - } - if(startPosition == 1) - { - if( random8() < chanceOfGlitter) - { - thirdZone[ random16(THIRDZONE_LEDS) ] += CRGB::Orange; - } - } - if(startPosition == 2) - { - if( random8() < chanceOfGlitter) - { - thirdZone[ random16(THIRDZONE_LEDS) ] += CRGB::Yellow; - } - } - if(startPosition == 3) - { - if( random8() < chanceOfGlitter) - { - thirdZone[ random16(THIRDZONE_LEDS) ] += CRGB::Green; - } - } - if(startPosition == 4) - { - if( random8() < chanceOfGlitter) - { - thirdZone[ random16(THIRDZONE_LEDS) ] += CRGB::Blue; - } - } - if(startPosition == 5) - { - if( random8() < chanceOfGlitter) - { - thirdZone[ random16(THIRDZONE_LEDS) ] += CRGB::Violet; - } - } -} - -void SingleRace_thirdZone() -{ - fadeToBlackBy( thirdZone, THIRDZONE_LEDS, 1); - int pos = beatsin16( raceSpeed, 0, THIRDZONE_LEDS); - if(pos > previousLED_thirdZone) - { - thirdZone[pos] = CRGB(red1,green1,blue1); - previousLED_thirdZone = pos; - } - if(pos < previousLED_thirdZone) - { - thirdZone[pos] = CRGB(red2,green2,blue2); - previousLED_thirdZone = pos; - } -} - - void Crash_thirdZone() -{ - fadeToBlackBy( thirdZone, THIRDZONE_LEDS, 15); - #ifdef ZONETHREE_SECTION1_START - int pos_SECTION1 = beatsin16( raceSpeed, 0, (ZONETHREE_SECTION1_END - ZONETHREE_SECTION1_START) ); - thirdZone[ZONETHREE_SECTION1_START + pos_SECTION1] = CRGB(red1,green1,blue1); - thirdZone[ZONETHREE_SECTION1_END - pos_SECTION1] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONETHREE_SECTION2_START - int pos_SECTION2 = beatsin16( raceSpeed, 0, (ZONETHREE_SECTION2_END - ZONETHREE_SECTION2_START) ); - thirdZone[ZONETHREE_SECTION2_START + pos_SECTION2] = CRGB(red2,green2,blue2); - thirdZone[ZONETHREE_SECTION2_END - pos_SECTION2] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONETHREE_SECTION3_START - int pos_SECTION3 = beatsin16( raceSpeed, 0, (ZONETHREE_SECTION3_END - ZONETHREE_SECTION3_START) ); - thirdZone[ZONETHREE_SECTION3_START + pos_SECTION3] = CRGB(red1,green1,blue1); - thirdZone[ZONETHREE_SECTION3_END - pos_SECTION3] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONETHREE_SECTION4_START - int pos_SECTION4 = beatsin16( raceSpeed, 0, (ZONETHREE_SECTION4_END - ZONETHREE_SECTION4_START) ); - thirdZone[ZONETHREE_SECTION4_START + pos_SECTION4] = CRGB(red2,green2,blue2); - thirdZone[ZONETHREE_SECTION4_END - pos_SECTION4] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONETHREE_SECTION5_START - int pos_SECTION5 = beatsin16( raceSpeed, 0, (ZONETHREE_SECTION5_END - ZONETHREE_SECTION5_START) ); - thirdZone[ZONETHREE_SECTION5_START + pos_SECTION5] = CRGB(red1,green1,blue1); - thirdZone[ZONETHREE_SECTION5_END - pos_SECTION5] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONETHREE_SECTION6_START - int pos_SECTION6 = beatsin16( raceSpeed, 0, (ZONETHREE_SECTION6_END - ZONETHREE_SECTION6_START) ); - thirdZone[ZONETHREE_SECTION6_START + pos_SECTION6] = CRGB(red2,green2,blue2); - thirdZone[ZONETHREE_SECTION6_END - pos_SECTION6] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONETHREE_SECTION7_START - int pos_SECTION7 = beatsin16( raceSpeed, 0, (ZONETHREE_SECTION7_END - ZONETHREE_SECTION7_START) ); - thirdZone[ZONETHREE_SECTION7_START + pos_SECTION7] = CRGB(red1,green1,blue1); - thirdZone[ZONETHREE_SECTION7_END - pos_SECTION7] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONETHREE_SECTION8_START - int pos_SECTION8 = beatsin16( raceSpeed, 0, (ZONETHREE_SECTION8_END - ZONETHREE_SECTION8_START) ); - thirdZone[ZONETHREE_SECTION8_START + pos_SECTION8] = CRGB(red2,green2,blue2); - thirdZone[ZONETHREE_SECTION8_END - pos_SECTION8] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONETHREE_SECTION9_START - int pos_SECTION9 = beatsin16( raceSpeed, 0, (ZONETHREE_SECTION9_END - ZONETHREE_SECTION9_START) ); - thirdZone[ZONETHREE_SECTION9_START + pos_SECTION9] = CRGB(red1,green1,blue1); - thirdZone[ZONETHREE_SECTION9_END - pos_SECTION9] = CRGB(red2,green2,blue2); - #endif - -} - -void Rainbow_thirdZone() -{ - fill_rainbow( thirdZone, THIRDZONE_LEDS, gHue, numberOfRainbows); -} - -void Blocked_thirdZone() -{ - fadeToBlackBy( thirdZone, THIRDZONE_LEDS, 2); - for( int mark = 0; mark < THIRDZONE_LEDS; mark+=30) - { - for( int i = 0; i < 9; i++) - { - if(startPosition == 0 || startPosition == 1) - { - if(i+mark <= THIRDZONE_LEDS) - { - thirdZone[i+mark] = CRGB(red1,green1,blue1); - } - if(i+10+mark <= THIRDZONE_LEDS) - { - thirdZone[i+10+mark] = CRGB(red2,green2,blue2); - } - if(i+20+mark <= THIRDZONE_LEDS) - { - thirdZone[i+20+mark] = CRGB(red3,green3,blue3); - } - } - if(startPosition == 2 || startPosition == 3) - { - if(i+mark <= THIRDZONE_LEDS) - { - thirdZone[i+mark] = CRGB(red2,green2,blue2); - } - if(i+10+mark <= THIRDZONE_LEDS) - { - thirdZone[i+10+mark] = CRGB(red3,green3,blue3); - } - if(i+20+mark <= THIRDZONE_LEDS) - { - thirdZone[i+20+mark] = CRGB(red1,green1,blue1); - } - } - if(startPosition == 4 || startPosition == 5) - { - if(i+mark <= THIRDZONE_LEDS) - { - thirdZone[i+mark] = CRGB(red3,green3,blue3); - } - if(i+10+mark <= THIRDZONE_LEDS) - { - thirdZone[i+10+mark] = CRGB(red1,green1,blue1); - } - if(i+20+mark <= THIRDZONE_LEDS) - { - thirdZone[i+20+mark] = CRGB(red2,green2,blue2); - } - } - } - } -} - -void BPM_thirdZone() -{ - if((red1*2) > (green1 + blue1)) - { - CRGBPalette16 palette_thirdZone = LavaColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < THIRDZONE_LEDS; i++) - { - thirdZone[i] = ColorFromPalette(palette_thirdZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((green1*2) > (red1 + blue1)) - { - CRGBPalette16 palette_thirdZone = ForestColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < THIRDZONE_LEDS; i++) - { - thirdZone[i] = ColorFromPalette(palette_thirdZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((blue1*2) > (green1 + red1)) - { - CRGBPalette16 palette_thirdZone = CloudColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < THIRDZONE_LEDS; i++) - { - thirdZone[i] = ColorFromPalette(palette_thirdZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((blue1*2) == (green1 + red1)) - { - CRGBPalette16 palette_thirdZone = PartyColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < THIRDZONE_LEDS; i++) - { - thirdZone[i] = ColorFromPalette(palette_thirdZone, gHue+(i*2), beat-gHue+(i*10)); - } - } -} - -void Twinkle_thirdZone() -{ - fadeToBlackBy( thirdZone, THIRDZONE_LEDS, 80); - for( int i = 0; i < THIRDZONE_LEDS-5; i+=5) - { - if(i <= THIRDZONE_LEDS) - { - if (random8() > twinkleChance) - { - thirdZone[i] = CRGB( red1, green1, blue1); - } - else - { - thirdZone[i] = CRGB( 150, 100, 40); - } - } - } -} - -void Eyes_thirdZone() -{ - unsigned int chance = random8(); - if( chance > eyeChance) - { - unsigned int eye = random16(THIRDZONE_LEDS); - thirdZone[eye] = CRGB(red1,green1,blue1); - thirdZone[eye-4] = CRGB(red1,green1,blue1); - } - if( chance > 39) - { - fadeToBlackBy( thirdZone, THIRDZONE_LEDS, 10); - } -} - -void Solid_thirdZone() -{ - fill_solid(thirdZone, THIRDZONE_LEDS, CRGB(red1, green1, blue1)); -} - -void Locator_thirdZone() -{ - if(locatorLED <= THIRDZONE_LEDS) - { - fill_solid(thirdZone, THIRDZONE_LEDS, CRGB::Black); - thirdZone[locatorLED]=CRGB(red1, green1, blue1); - } -} - -#ifdef ZONETHREE_SECTION1_START -void fire_thirdZone_SECTION1() -{ - static byte heat[ZONETHREE_SECTION1_END - ZONETHREE_SECTION1_START]; - for( int i = 0; i < ZONETHREE_SECTION1_END - ZONETHREE_SECTION1_START; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / ZONETHREE_SECTION1_END - ZONETHREE_SECTION1_START) + 2)); - } - - for( int k= ZONETHREE_SECTION1_END - ZONETHREE_SECTION1_START - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < ZONETHREE_SECTION1_END - ZONETHREE_SECTION1_START; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (ZONETHREE_SECTION1_END - ZONETHREE_SECTION1_START -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETHREE_SECTION1_START_FIRE == 1 - if(thisFlame <= ZONETHREE_SECTION1_END - ZONETHREE_SECTION1_START ) - { - thirdZone[ZONETHREE_SECTION1_START + thisFlame] = color; - } - #endif - - #if ZONETHREE_SECTION1_END_FIRE == 1 - if(thisFlame <= ZONETHREE_SECTION1_END - ZONETHREE_SECTION1_START ) - { - thirdZone[ZONETHREE_SECTION1_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETHREE_SECTION2_START -void fire_thirdZone_SECTION2() -{ - const int sizeOfSection = ZONETHREE_SECTION2_END - ZONETHREE_SECTION2_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETHREE_SECTION2_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION2_START + thisFlame] = color; - } - #endif - - #if ZONETHREE_SECTION2_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION2_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETHREE_SECTION3_START -void fire_thirdZone_SECTION3() -{ - const int sizeOfSection = ZONETHREE_SECTION3_END - ZONETHREE_SECTION3_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETHREE_SECTION3_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION3_START + thisFlame] = color; - } - #endif - - #if ZONETHREE_SECTION3_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION3_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETHREE_SECTION4_START -void fire_thirdZone_SECTION4() -{ - const int sizeOfSection = ZONETHREE_SECTION4_END - ZONETHREE_SECTION4_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETHREE_SECTION4_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION4_START + thisFlame] = color; - } - #endif - - #if ZONETHREE_SECTION4_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION4_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETHREE_SECTION5_START -void fire_thirdZone_SECTION5() -{ - const int sizeOfSection = ZONETHREE_SECTION5_END - ZONETHREE_SECTION5_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETHREE_SECTION5_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION5_START + thisFlame] = color; - } - #endif - - #if ZONETHREE_SECTION5_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION5_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETHREE_SECTION6_START -void fire_thirdZone_SECTION6() -{ - const int sizeOfSection = ZONETHREE_SECTION6_END - ZONETHREE_SECTION6_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETHREE_SECTION6_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION6_START + thisFlame] = color; - } - #endif - - #if ZONETHREE_SECTION6_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION6_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETHREE_SECTION7_START -void fire_thirdZone_SECTION7() -{ - const int sizeOfSection = ZONETHREE_SECTION7_END - ZONETHREE_SECTION7_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETHREE_SECTION7_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION7_START + thisFlame] = color; - } - #endif - - #if ZONETHREE_SECTION7_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION7_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETHREE_SECTION8_START -void fire_thirdZone_SECTION8() -{ - const int sizeOfSection = ZONETHREE_SECTION8_END - ZONETHREE_SECTION8_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETHREE_SECTION8_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION8_START + thisFlame] = color; - } - #endif - - #if ZONETHREE_SECTION8_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION8_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONETHREE_SECTION9_START -void fire_thirdZone_SECTION9() -{ - const int sizeOfSection = ZONETHREE_SECTION9_END - ZONETHREE_SECTION9_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONETHREE_SECTION9_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION9_START + thisFlame] = color; - } - #endif - - #if ZONETHREE_SECTION9_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - thirdZone[ZONETHREE_SECTION9_END - thisFlame] = color; - } - #endif - } -} -#endif - -#endif - -/***************** fourthZone Animations ****************************************/ -/***************** fourthZone Animations ****************************************/ -/***************** fourthZone Animations ****************************************/ -/***************** fourthZone Animations ****************************************/ -/***************** fourthZone Animations ****************************************/ - -#if ZONEFOUR == 1 - -void Ripple_fourthZone() -{ - for (int i = 0; i < FOURTHZONE_LEDS; i++) - { - fourthZone[i] = CRGB((red2/75), (green2/75), (blue2/75)); - } - switch (step_fourthZone) - { - case -1: - center_fourthZone = random16(FOURTHZONE_LEDS); - step_fourthZone = 0; - break; - case 0: - fourthZone[center_fourthZone] = CRGB(red1, green1, blue1); - step_fourthZone ++; - break; - case 12: - step_fourthZone = -1; - break; - default: // Middle of the ripples. - fourthZone[(center_fourthZone + step_fourthZone + FOURTHZONE_LEDS) % FOURTHZONE_LEDS] += CRGB((red1/(step_fourthZone * 5)), (green1/(step_fourthZone * 5)), (blue1/(step_fourthZone * 5))); - fourthZone[(center_fourthZone - step_fourthZone + FOURTHZONE_LEDS) % FOURTHZONE_LEDS] += CRGB((red1/(step_fourthZone * 5)), (green1/(step_fourthZone * 5)), (blue1/(step_fourthZone * 5))); - step_fourthZone ++; - break; - } -} - -void RGB_fourthZone() -{ - if(startPosition < 6) - { - fadeToBlackBy( fourthZone, FOURTHZONE_LEDS, 80); - for(int pixel = startPosition+1; pixel < FOURTHZONE_LEDS; pixel+=6) - { - if(pixel <= FOURTHZONE_LEDS) - { - fourthZone[pixel] = CRGB(red1,green1,blue1); - } - } - for(int pixel = startPosition+3; pixel < FOURTHZONE_LEDS; pixel+=6) - { - if(pixel <= FOURTHZONE_LEDS) - { - fourthZone[pixel] = CRGB(red2,green2,blue2); - } - } - for(int pixel = startPosition+5; pixel < FOURTHZONE_LEDS; pixel+=6) - { - if(pixel <= FOURTHZONE_LEDS) - { - fourthZone[pixel] = CRGB(red3,green3,blue3); - } - } - } - if(startPosition == 1) - { - fourthZone[0]=CRGB(red3,green3,blue3); - } - if(startPosition == 2) - { - fourthZone[1]=CRGB(red3,green3,blue3); - } - if(startPosition == 3) - { - fourthZone[2]=CRGB(red3,green3,blue3); - fourthZone[0]=CRGB(red2,green2,blue2); - } - if(startPosition == 4) - { - fourthZone[3]=CRGB(red3,green3,blue3); - fourthZone[1]=CRGB(red2,green2,blue2); - } - if(startPosition == 5) - { - fourthZone[4]=CRGB(red3,green3,blue3); - fourthZone[2]=CRGB(red2,green2,blue2); - fourthZone[0]=CRGB(red1,green1,blue1); - } -} - -void ColorGlitter_fourthZone( fract8 chanceOfGlitter) -{ - fadeToBlackBy( fourthZone, FOURTHZONE_LEDS, 2); - if(startPosition == 0) - { - if( random8() < chanceOfGlitter) - { - fourthZone[ random16(FOURTHZONE_LEDS) ] += CRGB::Red; - } - } - if(startPosition == 1) - { - if( random8() < chanceOfGlitter) - { - fourthZone[ random16(FOURTHZONE_LEDS) ] += CRGB::Orange; - } - } - if(startPosition == 2) - { - if( random8() < chanceOfGlitter) - { - fourthZone[ random16(FOURTHZONE_LEDS) ] += CRGB::Yellow; - } - } - if(startPosition == 3) - { - if( random8() < chanceOfGlitter) - { - fourthZone[ random16(FOURTHZONE_LEDS) ] += CRGB::Green; - } - } - if(startPosition == 4) - { - if( random8() < chanceOfGlitter) - { - fourthZone[ random16(FOURTHZONE_LEDS) ] += CRGB::Blue; - } - } - if(startPosition == 5) - { - if( random8() < chanceOfGlitter) - { - fourthZone[ random16(FOURTHZONE_LEDS) ] += CRGB::Violet; - } - } -} - -void SingleRace_fourthZone() -{ - fadeToBlackBy( fourthZone, FOURTHZONE_LEDS, 1); - int pos = beatsin16( raceSpeed, 0, FOURTHZONE_LEDS); - if(pos > previousLED_fourthZone) - { - fourthZone[pos] = CRGB(red1,green1,blue1); - previousLED_fourthZone = pos; - } - if(pos < previousLED_fourthZone) - { - fourthZone[pos] = CRGB(red2,green2,blue2); - previousLED_fourthZone = pos; - } -} - - void Crash_fourthZone() -{ - fadeToBlackBy( fourthZone, FOURTHZONE_LEDS, 15); - #ifdef ZONEFOUR_SECTION1_START - int pos_SECTION1 = beatsin16( raceSpeed, 0, (ZONEFOUR_SECTION1_END - ZONEFOUR_SECTION1_START) ); - fourthZone[ZONEFOUR_SECTION1_START + pos_SECTION1] = CRGB(red1,green1,blue1); - fourthZone[ZONEFOUR_SECTION1_END - pos_SECTION1] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONEFOUR_SECTION2_START - int pos_SECTION2 = beatsin16( raceSpeed, 0, (ZONEFOUR_SECTION2_END - ZONEFOUR_SECTION2_START) ); - fourthZone[ZONEFOUR_SECTION2_START + pos_SECTION2] = CRGB(red2,green2,blue2); - fourthZone[ZONEFOUR_SECTION2_END - pos_SECTION2] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONEFOUR_SECTION3_START - int pos_SECTION3 = beatsin16( raceSpeed, 0, (ZONEFOUR_SECTION3_END - ZONEFOUR_SECTION3_START) ); - fourthZone[ZONEFOUR_SECTION3_START + pos_SECTION3] = CRGB(red1,green1,blue1); - fourthZone[ZONEFOUR_SECTION3_END - pos_SECTION3] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONEFOUR_SECTION4_START - int pos_SECTION4 = beatsin16( raceSpeed, 0, (ZONEFOUR_SECTION4_END - ZONEFOUR_SECTION4_START) ); - fourthZone[ZONEFOUR_SECTION4_START + pos_SECTION4] = CRGB(red2,green2,blue2); - fourthZone[ZONEFOUR_SECTION4_END - pos_SECTION4] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONEFOUR_SECTION5_START - int pos_SECTION5 = beatsin16( raceSpeed, 0, (ZONEFOUR_SECTION5_END - ZONEFOUR_SECTION5_START) ); - fourthZone[ZONEFOUR_SECTION5_START + pos_SECTION5] = CRGB(red1,green1,blue1); - fourthZone[ZONEFOUR_SECTION5_END - pos_SECTION5] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONEFOUR_SECTION6_START - int pos_SECTION6 = beatsin16( raceSpeed, 0, (ZONEFOUR_SECTION6_END - ZONEFOUR_SECTION6_START) ); - fourthZone[ZONEFOUR_SECTION6_START + pos_SECTION6] = CRGB(red2,green2,blue2); - fourthZone[ZONEFOUR_SECTION6_END - pos_SECTION6] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONEFOUR_SECTION7_START - int pos_SECTION7 = beatsin16( raceSpeed, 0, (ZONEFOUR_SECTION7_END - ZONEFOUR_SECTION7_START) ); - fourthZone[ZONEFOUR_SECTION7_START + pos_SECTION7] = CRGB(red1,green1,blue1); - fourthZone[ZONEFOUR_SECTION7_END - pos_SECTION7] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONEFOUR_SECTION8_START - int pos_SECTION8 = beatsin16( raceSpeed, 0, (ZONEFOUR_SECTION8_END - ZONEFOUR_SECTION8_START) ); - fourthZone[ZONEFOUR_SECTION8_START + pos_SECTION8] = CRGB(red2,green2,blue2); - fourthZone[ZONEFOUR_SECTION8_END - pos_SECTION8] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONEFOUR_SECTION9_START - int pos_SECTION9 = beatsin16( raceSpeed, 0, (ZONEFOUR_SECTION9_END - ZONEFOUR_SECTION9_START) ); - fourthZone[ZONEFOUR_SECTION9_START + pos_SECTION9] = CRGB(red1,green1,blue1); - fourthZone[ZONEFOUR_SECTION9_END - pos_SECTION9] = CRGB(red2,green2,blue2); - #endif - -} - -void Rainbow_fourthZone() -{ - fill_rainbow( fourthZone, FOURTHZONE_LEDS, gHue, numberOfRainbows); -} - -void Blocked_fourthZone() -{ - fadeToBlackBy( fourthZone, FOURTHZONE_LEDS, 2); - for( int mark = 0; mark < FOURTHZONE_LEDS; mark+=30) - { - for( int i = 0; i < 9; i++) - { - if(startPosition == 0 || startPosition == 1) - { - if(i+mark <= FOURTHZONE_LEDS) - { - fourthZone[i+mark] = CRGB(red1,green1,blue1); - } - if(i+10+mark <= FOURTHZONE_LEDS) - { - fourthZone[i+10+mark] = CRGB(red2,green2,blue2); - } - if(i+20+mark <= FOURTHZONE_LEDS) - { - fourthZone[i+20+mark] = CRGB(red3,green3,blue3); - } - } - if(startPosition == 2 || startPosition == 3) - { - if(i+mark <= FOURTHZONE_LEDS) - { - fourthZone[i+mark] = CRGB(red2,green2,blue2); - } - if(i+10+mark <= FOURTHZONE_LEDS) - { - fourthZone[i+10+mark] = CRGB(red3,green3,blue3); - } - if(i+20+mark <= FOURTHZONE_LEDS) - { - fourthZone[i+20+mark] = CRGB(red1,green1,blue1); - } - } - if(startPosition == 4 || startPosition == 5) - { - if(i+mark <= FOURTHZONE_LEDS) - { - fourthZone[i+mark] = CRGB(red3,green3,blue3); - } - if(i+10+mark <= FOURTHZONE_LEDS) - { - fourthZone[i+10+mark] = CRGB(red1,green1,blue1); - } - if(i+20+mark <= FOURTHZONE_LEDS) - { - fourthZone[i+20+mark] = CRGB(red2,green2,blue2); - } - } - } - } -} - -void BPM_fourthZone() -{ - if((red1*2) > (green1 + blue1)) - { - CRGBPalette16 palette_fourthZone = LavaColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < FOURTHZONE_LEDS; i++) - { - fourthZone[i] = ColorFromPalette(palette_fourthZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((green1*2) > (red1 + blue1)) - { - CRGBPalette16 palette_fourthZone = ForestColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < FOURTHZONE_LEDS; i++) - { - fourthZone[i] = ColorFromPalette(palette_fourthZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((blue1*2) > (green1 + red1)) - { - CRGBPalette16 palette_fourthZone = CloudColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < FOURTHZONE_LEDS; i++) - { - fourthZone[i] = ColorFromPalette(palette_fourthZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((blue1*2) == (green1 + red1)) - { - CRGBPalette16 palette_fourthZone = PartyColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < FOURTHZONE_LEDS; i++) - { - fourthZone[i] = ColorFromPalette(palette_fourthZone, gHue+(i*2), beat-gHue+(i*10)); - } - } -} - -void Twinkle_fourthZone() -{ - fadeToBlackBy( fourthZone, FOURTHZONE_LEDS, 80); - for( int i = 0; i < FOURTHZONE_LEDS-5; i+=5) - { - if(i <= FOURTHZONE_LEDS) - { - if (random8() > twinkleChance) - { - fourthZone[i] = CRGB( red1, green1, blue1); - } - else - { - fourthZone[i] = CRGB( 150, 100, 40); - } - } - } -} - -void Eyes_fourthZone() -{ - unsigned int chance = random8(); - if( chance > eyeChance) - { - unsigned int eye = random16(FOURTHZONE_LEDS); - fourthZone[eye] = CRGB(red1,green1,blue1); - fourthZone[eye-4] = CRGB(red1,green1,blue1); - } - if( chance > 39) - { - fadeToBlackBy( fourthZone, FOURTHZONE_LEDS, 10); - } -} - -void Solid_fourthZone() -{ - fill_solid(fourthZone, FOURTHZONE_LEDS, CRGB(red1, green1, blue1)); -} - -void Locator_fourthZone() -{ - if(locatorLED <= FOURTHZONE_LEDS) - { - fill_solid(fourthZone, FOURTHZONE_LEDS, CRGB::Black); - fourthZone[locatorLED]=CRGB(red1, green1, blue1); - } -} - -#ifdef ZONEFOUR_SECTION1_START -void fire_fourthZone_SECTION1() -{ - static byte heat[ZONEFOUR_SECTION1_END - ZONEFOUR_SECTION1_START]; - for( int i = 0; i < ZONEFOUR_SECTION1_END - ZONEFOUR_SECTION1_START; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / ZONEFOUR_SECTION1_END - ZONEFOUR_SECTION1_START) + 2)); - } - - for( int k= ZONEFOUR_SECTION1_END - ZONEFOUR_SECTION1_START - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < ZONEFOUR_SECTION1_END - ZONEFOUR_SECTION1_START; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (ZONEFOUR_SECTION1_END - ZONEFOUR_SECTION1_START -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFOUR_SECTION1_START_FIRE == 1 - if(thisFlame <= ZONEFOUR_SECTION1_END - ZONEFOUR_SECTION1_START ) - { - fourthZone[ZONEFOUR_SECTION1_START + thisFlame] = color; - } - #endif - - #if ZONEFOUR_SECTION1_END_FIRE == 1 - if(thisFlame <= ZONEFOUR_SECTION1_END - ZONEFOUR_SECTION1_START ) - { - fourthZone[ZONEFOUR_SECTION1_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFOUR_SECTION2_START -void fire_fourthZone_SECTION2() -{ - const int sizeOfSection = ZONEFOUR_SECTION2_END - ZONEFOUR_SECTION2_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFOUR_SECTION2_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION2_START + thisFlame] = color; - } - #endif - - #if ZONEFOUR_SECTION2_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION2_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFOUR_SECTION3_START -void fire_fourthZone_SECTION3() -{ - const int sizeOfSection = ZONEFOUR_SECTION3_END - ZONEFOUR_SECTION3_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFOUR_SECTION3_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION3_START + thisFlame] = color; - } - #endif - - #if ZONEFOUR_SECTION3_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION3_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFOUR_SECTION4_START -void fire_fourthZone_SECTION4() -{ - const int sizeOfSection = ZONEFOUR_SECTION4_END - ZONEFOUR_SECTION4_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFOUR_SECTION4_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION4_START + thisFlame] = color; - } - #endif - - #if ZONEFOUR_SECTION4_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION4_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFOUR_SECTION5_START -void fire_fourthZone_SECTION5() -{ - const int sizeOfSection = ZONEFOUR_SECTION5_END - ZONEFOUR_SECTION5_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFOUR_SECTION5_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION5_START + thisFlame] = color; - } - #endif - - #if ZONEFOUR_SECTION5_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION5_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFOUR_SECTION6_START -void fire_fourthZone_SECTION6() -{ - const int sizeOfSection = ZONEFOUR_SECTION6_END - ZONEFOUR_SECTION6_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFOUR_SECTION6_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION6_START + thisFlame] = color; - } - #endif - - #if ZONEFOUR_SECTION6_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION6_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFOUR_SECTION7_START -void fire_fourthZone_SECTION7() -{ - const int sizeOfSection = ZONEFOUR_SECTION7_END - ZONEFOUR_SECTION7_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFOUR_SECTION7_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION7_START + thisFlame] = color; - } - #endif - - #if ZONEFOUR_SECTION7_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION7_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFOUR_SECTION8_START -void fire_fourthZone_SECTION8() -{ - const int sizeOfSection = ZONEFOUR_SECTION8_END - ZONEFOUR_SECTION8_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFOUR_SECTION8_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION8_START + thisFlame] = color; - } - #endif - - #if ZONEFOUR_SECTION8_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION8_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFOUR_SECTION9_START -void fire_fourthZone_SECTION9() -{ - const int sizeOfSection = ZONEFOUR_SECTION9_END - ZONEFOUR_SECTION9_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFOUR_SECTION9_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION9_START + thisFlame] = color; - } - #endif - - #if ZONEFOUR_SECTION9_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fourthZone[ZONEFOUR_SECTION9_END - thisFlame] = color; - } - #endif - } -} -#endif - -#endif - -/***************** fifthZone Animations ****************************************/ -/***************** fifthZone Animations ****************************************/ -/***************** fifthZone Animations ****************************************/ -/***************** fifthZone Animations ****************************************/ -/***************** fifthZone Animations ****************************************/ - -#if ZONEFIVE == 1 - -void Ripple_fifthZone() -{ - for (int i = 0; i < FIFTHZONE_LEDS; i++) - { - fifthZone[i] = CRGB((red2/75), (green2/75), (blue2/75)); - } - switch (step_fifthZone) - { - case -1: - center_fifthZone = random16(FIFTHZONE_LEDS); - step_fifthZone = 0; - break; - case 0: - fifthZone[center_fifthZone] = CRGB(red1, green1, blue1); - step_fifthZone ++; - break; - case 12: - step_fifthZone = -1; - break; - default: // Middle of the ripples. - fifthZone[(center_fifthZone + step_fifthZone + FIFTHZONE_LEDS) % FIFTHZONE_LEDS] += CRGB((red1/(step_fifthZone * 5)), (green1/(step_fifthZone * 5)), (blue1/(step_fifthZone * 5))); - fifthZone[(center_fifthZone - step_fifthZone + FIFTHZONE_LEDS) % FIFTHZONE_LEDS] += CRGB((red1/(step_fifthZone * 5)), (green1/(step_fifthZone * 5)), (blue1/(step_fifthZone * 5))); - step_fifthZone ++; - break; - } -} - -void RGB_fifthZone() -{ - if(startPosition < 6) - { - fadeToBlackBy( fifthZone, FIFTHZONE_LEDS, 80); - for(int pixel = startPosition+1; pixel < FIFTHZONE_LEDS; pixel+=6) - { - if(pixel <= FIFTHZONE_LEDS) - { - fifthZone[pixel] = CRGB(red1,green1,blue1); - } - } - for(int pixel = startPosition+3; pixel < FIFTHZONE_LEDS; pixel+=6) - { - if(pixel <= FIFTHZONE_LEDS) - { - fifthZone[pixel] = CRGB(red2,green2,blue2); - } - } - for(int pixel = startPosition+5; pixel < FIFTHZONE_LEDS; pixel+=6) - { - if(pixel <= FIFTHZONE_LEDS) - { - fifthZone[pixel] = CRGB(red3,green3,blue3); - } - } - } - if(startPosition == 1) - { - fifthZone[0]=CRGB(red3,green3,blue3); - } - if(startPosition == 2) - { - fifthZone[1]=CRGB(red3,green3,blue3); - } - if(startPosition == 3) - { - fifthZone[2]=CRGB(red3,green3,blue3); - fifthZone[0]=CRGB(red2,green2,blue2); - } - if(startPosition == 4) - { - fifthZone[3]=CRGB(red3,green3,blue3); - fifthZone[1]=CRGB(red2,green2,blue2); - } - if(startPosition == 5) - { - fifthZone[4]=CRGB(red3,green3,blue3); - fifthZone[2]=CRGB(red2,green2,blue2); - fifthZone[0]=CRGB(red1,green1,blue1); - } -} - -void ColorGlitter_fifthZone( fract8 chanceOfGlitter) -{ - fadeToBlackBy( fifthZone, FIFTHZONE_LEDS, 2); - if(startPosition == 0) - { - if( random8() < chanceOfGlitter) - { - fifthZone[ random16(FIFTHZONE_LEDS) ] += CRGB::Red; - } - } - if(startPosition == 1) - { - if( random8() < chanceOfGlitter) - { - fifthZone[ random16(FIFTHZONE_LEDS) ] += CRGB::Orange; - } - } - if(startPosition == 2) - { - if( random8() < chanceOfGlitter) - { - fifthZone[ random16(FIFTHZONE_LEDS) ] += CRGB::Yellow; - } - } - if(startPosition == 3) - { - if( random8() < chanceOfGlitter) - { - fifthZone[ random16(FIFTHZONE_LEDS) ] += CRGB::Green; - } - } - if(startPosition == 4) - { - if( random8() < chanceOfGlitter) - { - fifthZone[ random16(FIFTHZONE_LEDS) ] += CRGB::Blue; - } - } - if(startPosition == 5) - { - if( random8() < chanceOfGlitter) - { - fifthZone[ random16(FIFTHZONE_LEDS) ] += CRGB::Violet; - } - } -} - -void SingleRace_fifthZone() -{ - fadeToBlackBy( fifthZone, FIFTHZONE_LEDS, 1); - int pos = beatsin16( raceSpeed, 0, FIFTHZONE_LEDS); - if(pos > previousLED_fifthZone) - { - fifthZone[pos] = CRGB(red1,green1,blue1); - previousLED_fifthZone = pos; - } - if(pos < previousLED_fifthZone) - { - fifthZone[pos] = CRGB(red2,green2,blue2); - previousLED_fifthZone = pos; - } -} - - void Crash_fifthZone() -{ - fadeToBlackBy( fifthZone, FIFTHZONE_LEDS, 15); - #ifdef ZONEFIVE_SECTION1_START - int pos_SECTION1 = beatsin16( raceSpeed, 0, (ZONEFIVE_SECTION1_END - ZONEFIVE_SECTION1_START) ); - fifthZone[ZONEFIVE_SECTION1_START + pos_SECTION1] = CRGB(red1,green1,blue1); - fifthZone[ZONEFIVE_SECTION1_END - pos_SECTION1] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONEFIVE_SECTION2_START - int pos_SECTION2 = beatsin16( raceSpeed, 0, (ZONEFIVE_SECTION2_END - ZONEFIVE_SECTION2_START) ); - fifthZone[ZONEFIVE_SECTION2_START + pos_SECTION2] = CRGB(red2,green2,blue2); - fifthZone[ZONEFIVE_SECTION2_END - pos_SECTION2] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONEFIVE_SECTION3_START - int pos_SECTION3 = beatsin16( raceSpeed, 0, (ZONEFIVE_SECTION3_END - ZONEFIVE_SECTION3_START) ); - fifthZone[ZONEFIVE_SECTION3_START + pos_SECTION3] = CRGB(red1,green1,blue1); - fifthZone[ZONEFIVE_SECTION3_END - pos_SECTION3] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONEFIVE_SECTION4_START - int pos_SECTION4 = beatsin16( raceSpeed, 0, (ZONEFIVE_SECTION4_END - ZONEFIVE_SECTION4_START) ); - fifthZone[ZONEFIVE_SECTION4_START + pos_SECTION4] = CRGB(red2,green2,blue2); - fifthZone[ZONEFIVE_SECTION4_END - pos_SECTION4] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONEFIVE_SECTION5_START - int pos_SECTION5 = beatsin16( raceSpeed, 0, (ZONEFIVE_SECTION5_END - ZONEFIVE_SECTION5_START) ); - fifthZone[ZONEFIVE_SECTION5_START + pos_SECTION5] = CRGB(red1,green1,blue1); - fifthZone[ZONEFIVE_SECTION5_END - pos_SECTION5] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONEFIVE_SECTION6_START - int pos_SECTION6 = beatsin16( raceSpeed, 0, (ZONEFIVE_SECTION6_END - ZONEFIVE_SECTION6_START) ); - fifthZone[ZONEFIVE_SECTION6_START + pos_SECTION6] = CRGB(red2,green2,blue2); - fifthZone[ZONEFIVE_SECTION6_END - pos_SECTION6] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONEFIVE_SECTION7_START - int pos_SECTION7 = beatsin16( raceSpeed, 0, (ZONEFIVE_SECTION7_END - ZONEFIVE_SECTION7_START) ); - fifthZone[ZONEFIVE_SECTION7_START + pos_SECTION7] = CRGB(red1,green1,blue1); - fifthZone[ZONEFIVE_SECTION7_END - pos_SECTION7] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONEFIVE_SECTION8_START - int pos_SECTION8 = beatsin16( raceSpeed, 0, (ZONEFIVE_SECTION8_END - ZONEFIVE_SECTION8_START) ); - fifthZone[ZONEFIVE_SECTION8_START + pos_SECTION8] = CRGB(red2,green2,blue2); - fifthZone[ZONEFIVE_SECTION8_END - pos_SECTION8] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONEFIVE_SECTION9_START - int pos_SECTION9 = beatsin16( raceSpeed, 0, (ZONEFIVE_SECTION9_END - ZONEFIVE_SECTION9_START) ); - fifthZone[ZONEFIVE_SECTION9_START + pos_SECTION9] = CRGB(red1,green1,blue1); - fifthZone[ZONEFIVE_SECTION9_END - pos_SECTION9] = CRGB(red2,green2,blue2); - #endif - -} - -void Rainbow_fifthZone() -{ - fill_rainbow( fifthZone, FIFTHZONE_LEDS, gHue, numberOfRainbows); -} - -void Blocked_fifthZone() -{ - fadeToBlackBy( fifthZone, FIFTHZONE_LEDS, 2); - for( int mark = 0; mark < FIFTHZONE_LEDS; mark+=30) - { - for( int i = 0; i < 9; i++) - { - if(startPosition == 0 || startPosition == 1) - { - if(i+mark <= FIFTHZONE_LEDS) - { - fifthZone[i+mark] = CRGB(red1,green1,blue1); - } - if(i+10+mark <= FIFTHZONE_LEDS) - { - fifthZone[i+10+mark] = CRGB(red2,green2,blue2); - } - if(i+20+mark <= FIFTHZONE_LEDS) - { - fifthZone[i+20+mark] = CRGB(red3,green3,blue3); - } - } - if(startPosition == 2 || startPosition == 3) - { - if(i+mark <= FIFTHZONE_LEDS) - { - fifthZone[i+mark] = CRGB(red2,green2,blue2); - } - if(i+10+mark <= FIFTHZONE_LEDS) - { - fifthZone[i+10+mark] = CRGB(red3,green3,blue3); - } - if(i+20+mark <= FIFTHZONE_LEDS) - { - fifthZone[i+20+mark] = CRGB(red1,green1,blue1); - } - } - if(startPosition == 4 || startPosition == 5) - { - if(i+mark <= FIFTHZONE_LEDS) - { - fifthZone[i+mark] = CRGB(red3,green3,blue3); - } - if(i+10+mark <= FIFTHZONE_LEDS) - { - fifthZone[i+10+mark] = CRGB(red1,green1,blue1); - } - if(i+20+mark <= FIFTHZONE_LEDS) - { - fifthZone[i+20+mark] = CRGB(red2,green2,blue2); - } - } - } - } -} - -void BPM_fifthZone() -{ - if((red1*2) > (green1 + blue1)) - { - CRGBPalette16 palette_fifthZone = LavaColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < FIFTHZONE_LEDS; i++) - { - fifthZone[i] = ColorFromPalette(palette_fifthZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((green1*2) > (red1 + blue1)) - { - CRGBPalette16 palette_fifthZone = ForestColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < FIFTHZONE_LEDS; i++) - { - fifthZone[i] = ColorFromPalette(palette_fifthZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((blue1*2) > (green1 + red1)) - { - CRGBPalette16 palette_fifthZone = CloudColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < FIFTHZONE_LEDS; i++) - { - fifthZone[i] = ColorFromPalette(palette_fifthZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((blue1*2) == (green1 + red1)) - { - CRGBPalette16 palette_fifthZone = PartyColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < FIFTHZONE_LEDS; i++) - { - fifthZone[i] = ColorFromPalette(palette_fifthZone, gHue+(i*2), beat-gHue+(i*10)); - } - } -} - -void Twinkle_fifthZone() -{ - fadeToBlackBy( fifthZone, FIFTHZONE_LEDS, 80); - for( int i = 0; i < FIFTHZONE_LEDS-5; i+=5) - { - if(i <= FIFTHZONE_LEDS) - { - if (random8() > twinkleChance) - { - fifthZone[i] = CRGB( red1, green1, blue1); - } - else - { - fifthZone[i] = CRGB( 150, 100, 40); - } - } - } -} - -void Eyes_fifthZone() -{ - unsigned int chance = random8(); - if( chance > eyeChance) - { - unsigned int eye = random16(FIFTHZONE_LEDS); - fifthZone[eye] = CRGB(red1,green1,blue1); - fifthZone[eye-4] = CRGB(red1,green1,blue1); - } - if( chance > 39) - { - fadeToBlackBy( fifthZone, FIFTHZONE_LEDS, 10); - } -} - -void Solid_fifthZone() -{ - fill_solid(fifthZone, FIFTHZONE_LEDS, CRGB(red1, green1, blue1)); -} - -void Locator_fifthZone() -{ - if(locatorLED <= FIFTHZONE_LEDS) - { - fill_solid(fifthZone, FIFTHZONE_LEDS, CRGB::Black); - fifthZone[locatorLED]=CRGB(red1, green1, blue1); - } -} - -#ifdef ZONEFIVE_SECTION1_START -void fire_fifthZone_SECTION1() -{ - static byte heat[ZONEFIVE_SECTION1_END - ZONEFIVE_SECTION1_START]; - for( int i = 0; i < ZONEFIVE_SECTION1_END - ZONEFIVE_SECTION1_START; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / ZONEFIVE_SECTION1_END - ZONEFIVE_SECTION1_START) + 2)); - } - - for( int k= ZONEFIVE_SECTION1_END - ZONEFIVE_SECTION1_START - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < ZONEFIVE_SECTION1_END - ZONEFIVE_SECTION1_START; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (ZONEFIVE_SECTION1_END - ZONEFIVE_SECTION1_START -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFIVE_SECTION1_START_FIRE == 1 - if(thisFlame <= ZONEFIVE_SECTION1_END - ZONEFIVE_SECTION1_START ) - { - fifthZone[ZONEFIVE_SECTION1_START + thisFlame] = color; - } - #endif - - #if ZONEFIVE_SECTION1_END_FIRE == 1 - if(thisFlame <= ZONEFIVE_SECTION1_END - ZONEFIVE_SECTION1_START ) - { - fifthZone[ZONEFIVE_SECTION1_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFIVE_SECTION2_START -void fire_fifthZone_SECTION2() -{ - const int sizeOfSection = ZONEFIVE_SECTION2_END - ZONEFIVE_SECTION2_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFIVE_SECTION2_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION2_START + thisFlame] = color; - } - #endif - - #if ZONEFIVE_SECTION2_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION2_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFIVE_SECTION3_START -void fire_fifthZone_SECTION3() -{ - const int sizeOfSection = ZONEFIVE_SECTION3_END - ZONEFIVE_SECTION3_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFIVE_SECTION3_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION3_START + thisFlame] = color; - } - #endif - - #if ZONEFIVE_SECTION3_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION3_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFIVE_SECTION4_START -void fire_fifthZone_SECTION4() -{ - const int sizeOfSection = ZONEFIVE_SECTION4_END - ZONEFIVE_SECTION4_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFIVE_SECTION4_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION4_START + thisFlame] = color; - } - #endif - - #if ZONEFIVE_SECTION4_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION4_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFIVE_SECTION5_START -void fire_fifthZone_SECTION5() -{ - const int sizeOfSection = ZONEFIVE_SECTION5_END - ZONEFIVE_SECTION5_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFIVE_SECTION5_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION5_START + thisFlame] = color; - } - #endif - - #if ZONEFIVE_SECTION5_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION5_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFIVE_SECTION6_START -void fire_fifthZone_SECTION6() -{ - const int sizeOfSection = ZONEFIVE_SECTION6_END - ZONEFIVE_SECTION6_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFIVE_SECTION6_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION6_START + thisFlame] = color; - } - #endif - - #if ZONEFIVE_SECTION6_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION6_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFIVE_SECTION7_START -void fire_fifthZone_SECTION7() -{ - const int sizeOfSection = ZONEFIVE_SECTION7_END - ZONEFIVE_SECTION7_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFIVE_SECTION7_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION7_START + thisFlame] = color; - } - #endif - - #if ZONEFIVE_SECTION7_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION7_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFIVE_SECTION8_START -void fire_fifthZone_SECTION8() -{ - const int sizeOfSection = ZONEFIVE_SECTION8_END - ZONEFIVE_SECTION8_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFIVE_SECTION8_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION8_START + thisFlame] = color; - } - #endif - - #if ZONEFIVE_SECTION8_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION8_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONEFIVE_SECTION9_START -void fire_fifthZone_SECTION9() -{ - const int sizeOfSection = ZONEFIVE_SECTION9_END - ZONEFIVE_SECTION9_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONEFIVE_SECTION9_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION9_START + thisFlame] = color; - } - #endif - - #if ZONEFIVE_SECTION9_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - fifthZone[ZONEFIVE_SECTION9_END - thisFlame] = color; - } - #endif - } -} -#endif - -#endif - -/***************** sixthZone Animations ****************************************/ -/***************** sixthZone Animations ****************************************/ -/***************** sixthZone Animations ****************************************/ -/***************** sixthZone Animations ****************************************/ -/***************** sixthZone Animations ****************************************/ - -#if ZONESIX == 1 - -void Ripple_sixthZone() -{ - for (int i = 0; i < SIXTHZONE_LEDS; i++) - { - sixthZone[i] = CRGB((red2/75), (green2/75), (blue2/75)); - } - switch (step_sixthZone) - { - case -1: - center_sixthZone = random16(SIXTHZONE_LEDS); - step_sixthZone = 0; - break; - case 0: - sixthZone[center_sixthZone] = CRGB(red1, green1, blue1); - step_sixthZone ++; - break; - case 12: - step_sixthZone = -1; - break; - default: // Middle of the ripples. - sixthZone[(center_sixthZone + step_sixthZone + SIXTHZONE_LEDS) % SIXTHZONE_LEDS] += CRGB((red1/(step_sixthZone * 5)), (green1/(step_sixthZone * 5)), (blue1/(step_sixthZone * 5))); - sixthZone[(center_sixthZone - step_sixthZone + SIXTHZONE_LEDS) % SIXTHZONE_LEDS] += CRGB((red1/(step_sixthZone * 5)), (green1/(step_sixthZone * 5)), (blue1/(step_sixthZone * 5))); - step_sixthZone ++; - break; - } -} - -void RGB_sixthZone() -{ - if(startPosition < 6) - { - fadeToBlackBy( sixthZone, SIXTHZONE_LEDS, 80); - for(int pixel = startPosition+1; pixel < SIXTHZONE_LEDS; pixel+=6) - { - if(pixel <= SIXTHZONE_LEDS) - { - sixthZone[pixel] = CRGB(red1,green1,blue1); - } - } - for(int pixel = startPosition+3; pixel < SIXTHZONE_LEDS; pixel+=6) - { - if(pixel <= SIXTHZONE_LEDS) - { - sixthZone[pixel] = CRGB(red2,green2,blue2); - } - } - for(int pixel = startPosition+5; pixel < SIXTHZONE_LEDS; pixel+=6) - { - if(pixel <= SIXTHZONE_LEDS) - { - sixthZone[pixel] = CRGB(red3,green3,blue3); - } - } - } - if(startPosition == 1) - { - sixthZone[0]=CRGB(red3,green3,blue3); - } - if(startPosition == 2) - { - sixthZone[1]=CRGB(red3,green3,blue3); - } - if(startPosition == 3) - { - sixthZone[2]=CRGB(red3,green3,blue3); - sixthZone[0]=CRGB(red2,green2,blue2); - } - if(startPosition == 4) - { - sixthZone[3]=CRGB(red3,green3,blue3); - sixthZone[1]=CRGB(red2,green2,blue2); - } - if(startPosition == 5) - { - sixthZone[4]=CRGB(red3,green3,blue3); - sixthZone[2]=CRGB(red2,green2,blue2); - sixthZone[0]=CRGB(red1,green1,blue1); - } -} - -void ColorGlitter_sixthZone( fract8 chanceOfGlitter) -{ - fadeToBlackBy( sixthZone, SIXTHZONE_LEDS, 2); - if(startPosition == 0) - { - if( random8() < chanceOfGlitter) - { - sixthZone[ random16(SIXTHZONE_LEDS) ] += CRGB::Red; - } - } - if(startPosition == 1) - { - if( random8() < chanceOfGlitter) - { - sixthZone[ random16(SIXTHZONE_LEDS) ] += CRGB::Orange; - } - } - if(startPosition == 2) - { - if( random8() < chanceOfGlitter) - { - sixthZone[ random16(SIXTHZONE_LEDS) ] += CRGB::Yellow; - } - } - if(startPosition == 3) - { - if( random8() < chanceOfGlitter) - { - sixthZone[ random16(SIXTHZONE_LEDS) ] += CRGB::Green; - } - } - if(startPosition == 4) - { - if( random8() < chanceOfGlitter) - { - sixthZone[ random16(SIXTHZONE_LEDS) ] += CRGB::Blue; - } - } - if(startPosition == 5) - { - if( random8() < chanceOfGlitter) - { - sixthZone[ random16(SIXTHZONE_LEDS) ] += CRGB::Violet; - } - } -} - -void SingleRace_sixthZone() -{ - fadeToBlackBy( sixthZone, SIXTHZONE_LEDS, 1); - int pos = beatsin16( raceSpeed, 0, SIXTHZONE_LEDS); - if(pos > previousLED_sixthZone) - { - sixthZone[pos] = CRGB(red1,green1,blue1); - previousLED_sixthZone = pos; - } - if(pos < previousLED_sixthZone) - { - sixthZone[pos] = CRGB(red2,green2,blue2); - previousLED_sixthZone = pos; - } -} - - void Crash_sixthZone() -{ - fadeToBlackBy( sixthZone, SIXTHZONE_LEDS, 15); - #ifdef ZONESIX_SECTION1_START - int pos_SECTION1 = beatsin16( raceSpeed, 0, (ZONESIX_SECTION1_END - ZONESIX_SECTION1_START) ); - sixthZone[ZONESIX_SECTION1_START + pos_SECTION1] = CRGB(red1,green1,blue1); - sixthZone[ZONESIX_SECTION1_END - pos_SECTION1] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONESIX_SECTION2_START - int pos_SECTION2 = beatsin16( raceSpeed, 0, (ZONESIX_SECTION2_END - ZONESIX_SECTION2_START) ); - sixthZone[ZONESIX_SECTION2_START + pos_SECTION2] = CRGB(red2,green2,blue2); - sixthZone[ZONESIX_SECTION2_END - pos_SECTION2] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONESIX_SECTION3_START - int pos_SECTION3 = beatsin16( raceSpeed, 0, (ZONESIX_SECTION3_END - ZONESIX_SECTION3_START) ); - sixthZone[ZONESIX_SECTION3_START + pos_SECTION3] = CRGB(red1,green1,blue1); - sixthZone[ZONESIX_SECTION3_END - pos_SECTION3] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONESIX_SECTION4_START - int pos_SECTION4 = beatsin16( raceSpeed, 0, (ZONESIX_SECTION4_END - ZONESIX_SECTION4_START) ); - sixthZone[ZONESIX_SECTION4_START + pos_SECTION4] = CRGB(red2,green2,blue2); - sixthZone[ZONESIX_SECTION4_END - pos_SECTION4] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONESIX_SECTION5_START - int pos_SECTION5 = beatsin16( raceSpeed, 0, (ZONESIX_SECTION5_END - ZONESIX_SECTION5_START) ); - sixthZone[ZONESIX_SECTION5_START + pos_SECTION5] = CRGB(red1,green1,blue1); - sixthZone[ZONESIX_SECTION5_END - pos_SECTION5] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONESIX_SECTION6_START - int pos_SECTION6 = beatsin16( raceSpeed, 0, (ZONESIX_SECTION6_END - ZONESIX_SECTION6_START) ); - sixthZone[ZONESIX_SECTION6_START + pos_SECTION6] = CRGB(red2,green2,blue2); - sixthZone[ZONESIX_SECTION6_END - pos_SECTION6] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONESIX_SECTION7_START - int pos_SECTION7 = beatsin16( raceSpeed, 0, (ZONESIX_SECTION7_END - ZONESIX_SECTION7_START) ); - sixthZone[ZONESIX_SECTION7_START + pos_SECTION7] = CRGB(red1,green1,blue1); - sixthZone[ZONESIX_SECTION7_END - pos_SECTION7] = CRGB(red2,green2,blue2); - #endif - - #ifdef ZONESIX_SECTION8_START - int pos_SECTION8 = beatsin16( raceSpeed, 0, (ZONESIX_SECTION8_END - ZONESIX_SECTION8_START) ); - sixthZone[ZONESIX_SECTION8_START + pos_SECTION8] = CRGB(red2,green2,blue2); - sixthZone[ZONESIX_SECTION8_END - pos_SECTION8] = CRGB(red1,green1,blue1); - #endif - - #ifdef ZONESIX_SECTION9_START - int pos_SECTION9 = beatsin16( raceSpeed, 0, (ZONESIX_SECTION9_END - ZONESIX_SECTION9_START) ); - sixthZone[ZONESIX_SECTION9_START + pos_SECTION9] = CRGB(red1,green1,blue1); - sixthZone[ZONESIX_SECTION9_END - pos_SECTION9] = CRGB(red2,green2,blue2); - #endif - -} - -void Rainbow_sixthZone() -{ - fill_rainbow( sixthZone, SIXTHZONE_LEDS, gHue, numberOfRainbows); -} - -void Blocked_sixthZone() -{ - fadeToBlackBy( sixthZone, SIXTHZONE_LEDS, 2); - for( int mark = 0; mark < SIXTHZONE_LEDS; mark+=30) - { - for( int i = 0; i < 9; i++) - { - if(startPosition == 0 || startPosition == 1) - { - if(i+mark <= SIXTHZONE_LEDS) - { - sixthZone[i+mark] = CRGB(red1,green1,blue1); - } - if(i+10+mark <= SIXTHZONE_LEDS) - { - sixthZone[i+10+mark] = CRGB(red2,green2,blue2); - } - if(i+20+mark <= SIXTHZONE_LEDS) - { - sixthZone[i+20+mark] = CRGB(red3,green3,blue3); - } - } - if(startPosition == 2 || startPosition == 3) - { - if(i+mark <= SIXTHZONE_LEDS) - { - sixthZone[i+mark] = CRGB(red2,green2,blue2); - } - if(i+10+mark <= SIXTHZONE_LEDS) - { - sixthZone[i+10+mark] = CRGB(red3,green3,blue3); - } - if(i+20+mark <= SIXTHZONE_LEDS) - { - sixthZone[i+20+mark] = CRGB(red1,green1,blue1); - } - } - if(startPosition == 4 || startPosition == 5) - { - if(i+mark <= SIXTHZONE_LEDS) - { - sixthZone[i+mark] = CRGB(red3,green3,blue3); - } - if(i+10+mark <= SIXTHZONE_LEDS) - { - sixthZone[i+10+mark] = CRGB(red1,green1,blue1); - } - if(i+20+mark <= SIXTHZONE_LEDS) - { - sixthZone[i+20+mark] = CRGB(red2,green2,blue2); - } - } - } - } -} - -void BPM_sixthZone() -{ - if((red1*2) > (green1 + blue1)) - { - CRGBPalette16 palette_sixthZone = LavaColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < SIXTHZONE_LEDS; i++) - { - sixthZone[i] = ColorFromPalette(palette_sixthZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((green1*2) > (red1 + blue1)) - { - CRGBPalette16 palette_sixthZone = ForestColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < SIXTHZONE_LEDS; i++) - { - sixthZone[i] = ColorFromPalette(palette_sixthZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((blue1*2) > (green1 + red1)) - { - CRGBPalette16 palette_sixthZone = CloudColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < SIXTHZONE_LEDS; i++) - { - sixthZone[i] = ColorFromPalette(palette_sixthZone, gHue+(i*2), beat-gHue+(i*10)); - } - } - if((blue1*2) == (green1 + red1)) - { - CRGBPalette16 palette_sixthZone = PartyColors_p; - uint8_t beat = beatsin16( BeatsPerMinute, 64, 255); - for( int i = 0; i < SIXTHZONE_LEDS; i++) - { - sixthZone[i] = ColorFromPalette(palette_sixthZone, gHue+(i*2), beat-gHue+(i*10)); - } - } -} - -void Twinkle_sixthZone() -{ - fadeToBlackBy( sixthZone, SIXTHZONE_LEDS, 80); - for( int i = 0; i < SIXTHZONE_LEDS-5; i+=5) - { - if(i <= SIXTHZONE_LEDS) - { - if (random8() > twinkleChance) - { - sixthZone[i] = CRGB( red1, green1, blue1); - } - else - { - sixthZone[i] = CRGB( 150, 100, 40); - } - } - } -} - -void Eyes_sixthZone() -{ - unsigned int chance = random8(); - if( chance > eyeChance) - { - unsigned int eye = random16(SIXTHZONE_LEDS); - sixthZone[eye] = CRGB(red1,green1,blue1); - sixthZone[eye-4] = CRGB(red1,green1,blue1); - } - if( chance > 39) - { - fadeToBlackBy( sixthZone, SIXTHZONE_LEDS, 10); - } -} - -void Solid_sixthZone() -{ - fill_solid(sixthZone, SIXTHZONE_LEDS, CRGB(red1, green1, blue1)); -} - -void Locator_sixthZone() -{ - if(locatorLED <= SIXTHZONE_LEDS) - { - fill_solid(sixthZone, SIXTHZONE_LEDS, CRGB::Black); - sixthZone[locatorLED]=CRGB(red1, green1, blue1); - } -} - -#ifdef ZONESIX_SECTION1_START -void fire_sixthZone_SECTION1() -{ - static byte heat[ZONESIX_SECTION1_END - ZONESIX_SECTION1_START]; - for( int i = 0; i < ZONESIX_SECTION1_END - ZONESIX_SECTION1_START; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / ZONESIX_SECTION1_END - ZONESIX_SECTION1_START) + 2)); - } - - for( int k= ZONESIX_SECTION1_END - ZONESIX_SECTION1_START - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < ZONESIX_SECTION1_END - ZONESIX_SECTION1_START; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (ZONESIX_SECTION1_END - ZONESIX_SECTION1_START -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONESIX_SECTION1_START_FIRE == 1 - if(thisFlame <= ZONESIX_SECTION1_END - ZONESIX_SECTION1_START ) - { - sixthZone[ZONESIX_SECTION1_START + thisFlame] = color; - } - #endif - - #if ZONESIX_SECTION1_END_FIRE == 1 - if(thisFlame <= ZONESIX_SECTION1_END - ZONESIX_SECTION1_START ) - { - sixthZone[ZONESIX_SECTION1_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONESIX_SECTION2_START -void fire_sixthZone_SECTION2() -{ - const int sizeOfSection = ZONESIX_SECTION2_END - ZONESIX_SECTION2_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONESIX_SECTION2_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION2_START + thisFlame] = color; - } - #endif - - #if ZONESIX_SECTION2_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION2_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONESIX_SECTION3_START -void fire_sixthZone_SECTION3() -{ - const int sizeOfSection = ZONESIX_SECTION3_END - ZONESIX_SECTION3_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONESIX_SECTION3_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION3_START + thisFlame] = color; - } - #endif - - #if ZONESIX_SECTION3_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION3_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONESIX_SECTION4_START -void fire_sixthZone_SECTION4() -{ - const int sizeOfSection = ZONESIX_SECTION4_END - ZONESIX_SECTION4_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONESIX_SECTION4_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION4_START + thisFlame] = color; - } - #endif - - #if ZONESIX_SECTION4_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION4_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONESIX_SECTION5_START -void fire_sixthZone_SECTION5() -{ - const int sizeOfSection = ZONESIX_SECTION5_END - ZONESIX_SECTION5_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONESIX_SECTION5_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION5_START + thisFlame] = color; - } - #endif - - #if ZONESIX_SECTION5_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION5_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONESIX_SECTION6_START -void fire_sixthZone_SECTION6() -{ - const int sizeOfSection = ZONESIX_SECTION6_END - ZONESIX_SECTION6_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONESIX_SECTION6_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION6_START + thisFlame] = color; - } - #endif - - #if ZONESIX_SECTION6_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION6_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONESIX_SECTION7_START -void fire_sixthZone_SECTION7() -{ - const int sizeOfSection = ZONESIX_SECTION7_END - ZONESIX_SECTION7_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONESIX_SECTION7_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION7_START + thisFlame] = color; - } - #endif - - #if ZONESIX_SECTION7_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION7_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONESIX_SECTION8_START -void fire_sixthZone_SECTION8() -{ - const int sizeOfSection = ZONESIX_SECTION8_END - ZONESIX_SECTION8_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONESIX_SECTION8_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION8_START + thisFlame] = color; - } - #endif - - #if ZONESIX_SECTION8_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION8_END - thisFlame] = color; - } - #endif - } -} -#endif - -#ifdef ZONESIX_SECTION9_START -void fire_sixthZone_SECTION9() -{ - const int sizeOfSection = ZONESIX_SECTION9_END - ZONESIX_SECTION9_START; - static byte heat[sizeOfSection]; - for( int i = 0; i < sizeOfSection; i++) - { - heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / sizeOfSection) + 2)); - } - - for( int k= sizeOfSection - 1; k >= 2; k--) - { - heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3; - } - if( random8() < SPARKING ) - { - int y = random8(7); - heat[y] = qadd8( heat[y], random8(160,255) ); - } - for( int j = 0; j < sizeOfSection; j++) - { - byte colorindex = scale8( heat[j], 240); - CRGB color = ColorFromPalette( gPal, colorindex); - int pixelnumber; - if( gReverseDirection ) { - pixelnumber = (sizeOfSection -1) - j; - } else { - pixelnumber = j; - } - int thisFlame = ((pixelnumber * firesize)/100); - - - #if ZONESIX_SECTION9_START_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION9_START + thisFlame] = color; - } - #endif - - #if ZONESIX_SECTION9_END_FIRE == 1 - if(thisFlame <= sizeOfSection ) - { - sixthZone[ZONESIX_SECTION9_END - thisFlame] = color; - } - #endif - } -} -#endif - -#endif From 94e46d186337b1ef7a72ee08901cce9a47a5e694 Mon Sep 17 00:00:00 2001 From: zskullz Date: Wed, 13 Nov 2019 18:19:46 -0700 Subject: [PATCH 2/7] Optimize Code Fix missed reference changes --- Holiday_LED_2.0_6_Zones.ino | 102 ++++++++++++++++++------------------ 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/Holiday_LED_2.0_6_Zones.ino b/Holiday_LED_2.0_6_Zones.ino index 4d8b538..3644945 100644 --- a/Holiday_LED_2.0_6_Zones.ino +++ b/Holiday_LED_2.0_6_Zones.ino @@ -1468,39 +1468,39 @@ void choosePattern() { #if ZONEONE == 1 #if FIRSTZONE_SECTIONS >= 1 - static byte z1s1heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z1s1heat[ZONEONE_SECTION1_END-ZONEONE_SECTION1_START]; fire(firstZone, z1s1heat, ZONEONE_SECTION1_START, ZONEONE_SECTION1_END, ZONEONE_SECTION1_START_FIRE, ZONEONE_SECTION1_END_FIRE); #endif #if FIRSTZONE_SECTIONS >= 2 - static byte z1s2heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z1s2heat[ZONEONE_SECTION2_END-ZONEONE_SECTION2_START]; fire(firstZone, z1s2heat, ZONEONE_SECTION2_START, ZONEONE_SECTION2_END, ZONEONE_SECTION2_START_FIRE, ZONEONE_SECTION2_END_FIRE); #endif #if FIRSTZONE_SECTIONS >= 3 - static byte z1s3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z1s3heat[ZONEONE_SECTION3_END-ZONEONE_SECTION3_START]; fire(firstZone, z1s3heat, ZONEONE_SECTION3_START, ZONEONE_SECTION3_END, ZONEONE_SECTION3_START_FIRE, ZONEONE_SECTION3_END_FIRE); #endif #if FIRSTZONE_SECTIONS >= 4 - static byte z1s4heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z1s4heat[ZONEONE_SECTION4_END-ZONEONE_SECTION4_START]; fire(firstZone, z1s4heat, ZONEONE_SECTION4_START, ZONEONE_SECTION4_END, ZONEONE_SECTION4_START_FIRE, ZONEONE_SECTION4_END_FIRE); #endif #if FIRSTZONE_SECTIONS >= 5 - static byte z1s5heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z1s5heat[ZONEONE_SECTION5_END-ZONEONE_SECTION5_START]; fire(firstZone, z1s5heat, ZONEONE_SECTION5_START, ZONEONE_SECTION5_END, ZONEONE_SECTION5_START_FIRE, ZONEONE_SECTION5_END_FIRE); #endif #if FIRSTZONE_SECTIONS >= 6 - static byte z1s6heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z1s6heat[ZONEONE_SECTION6_END-ZONEONE_SECTION6_START]; fire(firstZone, z1s6heat, ZONEONE_SECTION6_START, ZONEONE_SECTION6_END, ZONEONE_SECTION6_START_FIRE, ZONEONE_SECTION6_END_FIRE); #endif #if FIRSTZONE_SECTIONS >= 7 - static byte z1s7heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z1s7heat[ZONEONE_SECTION7_END-ZONEONE_SECTION7_START]; fire(firstZone, z1s7heat, ZONEONE_SECTION7_START, ZONEONE_SECTION7_END, ZONEONE_SECTION7_START_FIRE, ZONEONE_SECTION7_END_FIRE); #endif #if FIRSTZONE_SECTIONS >= 8 - static byte z1s8heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z1s8heat[ZONEONE_SECTION8_END-ZONEONE_SECTION8_START]; fire(firstZone, z1s8heat, ZONEONE_SECTION8_START, ZONEONE_SECTION8_END, ZONEONE_SECTION8_START_FIRE, ZONEONE_SECTION8_END_FIRE); #endif #if FIRSTZONE_SECTIONS >= 9 - static byte z1s9heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z1s9heat[ZONEONE_SECTION9_END-ZONEONE_SECTION9_START]; fire(firstZone, z1s9heat, ZONEONE_SECTION9_START, ZONEONE_SECTION9_END, ZONEONE_SECTION9_START_FIRE, ZONEONE_SECTION9_END_FIRE); #endif #endif @@ -1518,182 +1518,182 @@ void choosePattern() fire(secondZone, z2s3heat, ZONETWO_SECTION3_START, ZONETWO_SECTION3_END, ZONETWO_SECTION3_START_FIRE, ZONETWO_SECTION3_END_FIRE); #endif #if SECONDZONE_SECTIONS >= 4 - static byte z2s4heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z2s4heat[ZONETWO_SECTION4_END-ZONETWO_SECTION4_START]; fire(secondZone, z2s4heat, ZONETWO_SECTION4_START, ZONETWO_SECTION4_END, ZONETWO_SECTION4_START_FIRE, ZONETWO_SECTION4_END_FIRE); #endif #if SECONDZONE_SECTIONS >= 5 - static byte z2s5heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z2s5heat[ZONETWO_SECTION5_END-ZONETWO_SECTION5_START]; fire(secondZone, z2s5heat, ZONETWO_SECTION5_START, ZONETWO_SECTION5_END, ZONETWO_SECTION5_START_FIRE, ZONETWO_SECTION5_END_FIRE); #endif #if SECONDZONE_SECTIONS >= 6 - static byte z2s6heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z2s6heat[ZONETWO_SECTION6_END-ZONETWO_SECTION6_START]; fire(secondZone, z2s6heat, ZONETWO_SECTION6_START, ZONETWO_SECTION6_END, ZONETWO_SECTION6_START_FIRE, ZONETWO_SECTION6_END_FIRE); #endif #if SECONDZONE_SECTIONS >= 7 - static byte z2s7heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z2s7heat[ZONETWO_SECTION7_END-ZONETWO_SECTION7_START]; fire(secondZone, z2s7heat, ZONETWO_SECTION7_START, ZONETWO_SECTION7_END, ZONETWO_SECTION7_START_FIRE, ZONETWO_SECTION7_END_FIRE); #endif #if SECONDZONE_SECTIONS >= 8 - static byte z2s8heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z2s8heat[ZONETWO_SECTION8_END-ZONETWO_SECTION8_START]; fire(secondZone, z2s8heat, ZONETWO_SECTION8_START, ZONETWO_SECTION8_END, ZONETWO_SECTION8_START_FIRE, ZONETWO_SECTION8_END_FIRE); #endif #if SECONDZONE_SECTIONS >= 9 - static byte z2s9heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z2s9heat[ZONETWO_SECTION9_END-ZONETWO_SECTION9_START]; fire(secondZone, z2s9heat, ZONETWO_SECTION9_START, ZONETWO_SECTION9_END, ZONETWO_SECTION9_START_FIRE, ZONETWO_SECTION9_END_FIRE); #endif #endif #if ZONETHREE == 1 #if THIRDZONE_SECTIONS >= 1 - static byte z3s1heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z3s1heat[ZONETHREE_SECTION1_END-ZONETHREE_SECTION1_START]; fire(thirdZone, z3s1heat, ZONETHREE_SECTION1_START, ZONETHREE_SECTION1_END, ZONETHREE_SECTION1_START_FIRE, ZONETHREE_SECTION1_END_FIRE); #endif #if THIRDZONE_SECTIONS >= 2 - static byte z3s2heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z3s2heat[ZONETHREE_SECTION2_END-ZONETHREE_SECTION2_START]; fire(thirdZone, z3s2heat, ZONETHREE_SECTION2_START, ZONETHREE_SECTION2_END, ZONETHREE_SECTION2_START_FIRE, ZONETHREE_SECTION2_END_FIRE); #endif #if THIRDZONE_SECTIONS >= 3 - static byte z3s3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z3s3heat[ZONETHREE_SECTION3_END-ZONETHREE_SECTION3_START]; fire(thirdZone, z3s3heat, ZONETHREE_SECTION3_START, ZONETHREE_SECTION3_END, ZONETHREE_SECTION3_START_FIRE, ZONETHREE_SECTION3_END_FIRE); #endif #if THIRDZONE_SECTIONS >= 4 - static byte z3s4heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z3s4heat[ZONETHREE_SECTION4_END-ZONETHREE_SECTION4_START]; fire(thirdZone, z3s4heat, ZONETHREE_SECTION4_START, ZONETHREE_SECTION4_END, ZONETHREE_SECTION4_START_FIRE, ZONETHREE_SECTION4_END_FIRE); #endif #if THIRDZONE_SECTIONS >= 5 - static byte z3s5heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z3s5heat[ZONETHREE_SECTION5_END-ZONETHREE_SECTION5_START]; fire(thirdZone, z3s5heat, ZONETHREE_SECTION5_START, ZONETHREE_SECTION5_END, ZONETHREE_SECTION5_START_FIRE, ZONETHREE_SECTION5_END_FIRE); #endif #if THIRDZONE_SECTIONS >= 6 - static byte z3s6heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z3s6heat[ZONETHREE_SECTION6_END-ZONETHREE_SECTION6_START]; fire(thirdZone, z3s6heat, ZONETHREE_SECTION6_START, ZONETHREE_SECTION6_END, ZONETHREE_SECTION6_START_FIRE, ZONETHREE_SECTION6_END_FIRE); #endif #if THIRDZONE_SECTIONS >= 7 - static byte z3s7heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z3s7heat[ZONETHREE_SECTION7_END-ZONETHREE_SECTION7_START]; fire(thirdZone, z3s7heat, ZONETHREE_SECTION7_START, ZONETHREE_SECTION7_END, ZONETHREE_SECTION7_START_FIRE, ZONETHREE_SECTION7_END_FIRE); #endif #if THIRDZONE_SECTIONS >= 8 - static byte z3s8heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z3s8heat[ZONETHREE_SECTION8_END-ZONETHREE_SECTION8_START]; fire(thirdZone, z3s8heat, ZONETHREE_SECTION8_START, ZONETHREE_SECTION8_END, ZONETHREE_SECTION8_START_FIRE, ZONETHREE_SECTION8_END_FIRE); #endif #if THIRDZONE_SECTIONS >= 9 - static byte z3s9heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z3s9heat[ZONETHREE_SECTION9_END-ZONETHREE_SECTION9_START]; fire(thirdZone, z3s9heat, ZONETHREE_SECTION9_START, ZONETHREE_SECTION9_END, ZONETHREE_SECTION9_START_FIRE, ZONETHREE_SECTION9_END_FIRE); #endif #endif #if ZONEFOUR == 1 #if FOURTHZONE_SECTIONS >= 1 - static byte z4s1heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z4s1heat[ZONEFOUR_SECTION1_END-ZONEFOUR_SECTION1_START]; fire(fourthZone, z4s1heat, ZONEFOUR_SECTION1_START, ZONEFOUR_SECTION1_END, ZONEFOUR_SECTION1_START_FIRE, ZONEFOUR_SECTION1_END_FIRE); #endif #if FOURTHZONE_SECTIONS >= 2 - static byte z4s2heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z4s2heat[ZONEFOUR_SECTION2_END-ZONEFOUR_SECTION2_START]; fire(fourthZone, z4s2heat, ZONEFOUR_SECTION2_START, ZONEFOUR_SECTION2_END, ZONEFOUR_SECTION2_START_FIRE, ZONEFOUR_SECTION2_END_FIRE); #endif #if FOURTHZONE_SECTIONS >= 3 - static byte z4s3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z4s3heat[ZONEFOUR_SECTION3_END-ZONEFOUR_SECTION3_START]; fire(fourthZone, z4s3heat, ZONEFOUR_SECTION3_START, ZONEFOUR_SECTION3_END, ZONEFOUR_SECTION3_START_FIRE, ZONEFOUR_SECTION3_END_FIRE); #endif #if FOURTHZONE_SECTIONS >= 4 - static byte z4s4heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z4s4heat[ZONEFOUR_SECTION4_END-ZONEFOUR_SECTION4_START]; fire(fourthZone, z4s4heat, ZONEFOUR_SECTION4_START, ZONEFOUR_SECTION4_END, ZONEFOUR_SECTION4_START_FIRE, ZONEFOUR_SECTION4_END_FIRE); #endif #if FOURTHZONE_SECTIONS >= 5 - static byte z4s5heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z4s5heat[ZONEFOUR_SECTION5_END-ZONEFOUR_SECTION5_START]; fire(fourthZone, z4s5heat, ZONEFOUR_SECTION5_START, ZONEFOUR_SECTION5_END, ZONEFOUR_SECTION5_START_FIRE, ZONEFOUR_SECTION5_END_FIRE); #endif #if FOURTHZONE_SECTIONS >= 6 - static byte z4s6heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z4s6heat[ZONEFOUR_SECTION6_END-ZONEFOUR_SECTION6_START]; fire(fourthZone, z4s6heat, ZONEFOUR_SECTION6_START, ZONEFOUR_SECTION6_END, ZONEFOUR_SECTION6_START_FIRE, ZONEFOUR_SECTION6_END_FIRE); #endif #if FOURTHZONE_SECTIONS >= 7 - static byte z4s7heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z4s7heat[ZONEFOUR_SECTION7_END-ZONEFOUR_SECTION7_START]; fire(fourthZone, z4s7heat, ZONEFOUR_SECTION7_START, ZONEFOUR_SECTION7_END, ZONEFOUR_SECTION7_START_FIRE, ZONEFOUR_SECTION7_END_FIRE); #endif #if FOURTHZONE_SECTIONS >= 8 - static byte z4s8heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z4s8heat[ZONEFOUR_SECTION8_END-ZONEFOUR_SECTION8_START]; fire(fourthZone, z4s8heat, ZONEFOUR_SECTION8_START, ZONEFOUR_SECTION8_END, ZONEFOUR_SECTION8_START_FIRE, ZONEFOUR_SECTION8_END_FIRE); #endif #if FOURTHZONE_SECTIONS >= 9 - static byte z4s9heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z4s9heat[ZONEFOUR_SECTION9_END-ZONEFOUR_SECTION9_START]; fire(fourthZone, z4s9heat, ZONEFOUR_SECTION9_START, ZONEFOUR_SECTION9_END, ZONEFOUR_SECTION9_START_FIRE, ZONEFOUR_SECTION9_END_FIRE); #endif #endif #if ZONEFIVE == 1 #if FIFTHZONE_SECTIONS >= 1 - static byte z5s1heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z5s1heat[ZONEFIVE_SECTION1_END-ZONEFIVE_SECTION1_START]; fire(fifthZone, z5s1heat, ZONEFIVE_SECTION1_START, ZONEFIVE_SECTION1_END, ZONEFIVE_SECTION1_START_FIRE, ZONEFIVE_SECTION1_END_FIRE); #endif #if FIFTHZONE_SECTIONS >= 2 - static byte z5s2heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z5s2heat[ZONEFIVE_SECTION2_END-ZONEFIVE_SECTION2_START]; fire(fifthZone, z5s2heat, ZONEFIVE_SECTION2_START, ZONEFIVE_SECTION2_END, ZONEFIVE_SECTION2_START_FIRE, ZONEFIVE_SECTION2_END_FIRE); #endif #if FIFTHZONE_SECTIONS >= 3 - static byte z5s3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z5s3heat[ZONEFIVE_SECTION3_END-ZONEFIVE_SECTION3_START]; fire(fifthZone, z5s3heat, ZONEFIVE_SECTION3_START, ZONEFIVE_SECTION3_END, ZONEFIVE_SECTION3_START_FIRE, ZONEFIVE_SECTION3_END_FIRE); #endif #if FIFTHZONE_SECTIONS >= 4 - static byte z5s4heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z5s4heat[ZONEFIVE_SECTION4_END-ZONEFIVE_SECTION4_START]; fire(fifthZone, z5s4heat, ZONEFIVE_SECTION4_START, ZONEFIVE_SECTION4_END, ZONEFIVE_SECTION4_START_FIRE, ZONEFIVE_SECTION4_END_FIRE); #endif #if FIFTHZONE_SECTIONS >= 5 - static byte z5s5heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z5s5heat[ZONEFIVE_SECTION5_END-ZONEFIVE_SECTION5_START]; fire(fifthZone, z5s5heat, ZONEFIVE_SECTION5_START, ZONEFIVE_SECTION5_END, ZONEFIVE_SECTION5_START_FIRE, ZONEFIVE_SECTION5_END_FIRE); #endif #if FIFTHZONE_SECTIONS >= 6 - static byte z5s6heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z5s6heat[ZONEFIVE_SECTION6_END-ZONEFIVE_SECTION6_START]; fire(fifthZone, z5s6heat, ZONEFIVE_SECTION6_START, ZONEFIVE_SECTION6_END, ZONEFIVE_SECTION6_START_FIRE, ZONEFIVE_SECTION6_END_FIRE); #endif #if FIFTHZONE_SECTIONS >= 7 - static byte z5s7heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z5s7heat[ZONEFIVE_SECTION7_END-ZONEFIVE_SECTION7_START]; fire(fifthZone, z5s7heat, ZONEFIVE_SECTION7_START, ZONEFIVE_SECTION7_END, ZONEFIVE_SECTION7_START_FIRE, ZONEFIVE_SECTION7_END_FIRE); #endif #if FIFTHZONE_SECTIONS >= 8 - static byte z5s8heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z5s8heat[ZONEFIVE_SECTION8_END-ZONEFIVE_SECTION8_START]; fire(fifthZone, z5s8heat, ZONEFIVE_SECTION8_START, ZONEFIVE_SECTION8_END, ZONEFIVE_SECTION8_START_FIRE, ZONEFIVE_SECTION8_END_FIRE); #endif #if FIFTHZONE_SECTIONS >= 9 - static byte z5s9heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z5s9heat[ZONEFIVE_SECTION9_END-ZONEFIVE_SECTION9_START]; fire(fifthZone, z5s9heat, ZONEFIVE_SECTION9_START, ZONEFIVE_SECTION9_END, ZONEFIVE_SECTION9_START_FIRE, ZONEFIVE_SECTION9_END_FIRE); #endif #endif #if ZONESIX == 1 #if SIXTHZONE_SECTIONS >= 1 - static byte z6s1heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z6s1heat[ZONESIX_SECTION1_END-ZONESIX_SECTION1_START]; fire(sixthZone, z6s1heat, ZONESIX_SECTION1_START, ZONESIX_SECTION1_END, ZONESIX_SECTION1_START_FIRE, ZONESIX_SECTION1_END_FIRE); #endif #if SIXTHZONE_SECTIONS >= 2 - static byte z6s2heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z6s2heat[ZONESIX_SECTION2_END-ZONESIX_SECTION2_START]; fire(sixthZone, z6s2heat, ZONESIX_SECTION2_START, ZONESIX_SECTION2_END, ZONESIX_SECTION2_START_FIRE, ZONESIX_SECTION2_END_FIRE); #endif #if SIXTHZONE_SECTIONS >= 3 - static byte z6s3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z6s3heat[ZONESIX_SECTION3_END-ZONESIX_SECTION3_START]; fire(sixthZone, z6s3heat, ZONESIX_SECTION3_START, ZONESIX_SECTION3_END, ZONESIX_SECTION3_START_FIRE, ZONESIX_SECTION3_END_FIRE); #endif #if SIXTHZONE_SECTIONS >= 4 - static byte z6s4heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z6s4heat[ZONESIX_SECTION4_END-ZONESIX_SECTION4_START]; fire(sixthZone, z6s4heat, ZONESIX_SECTION4_START, ZONESIX_SECTION4_END, ZONESIX_SECTION4_START_FIRE, ZONESIX_SECTION4_END_FIRE); #endif #if SIXTHZONE_SECTIONS >= 5 - static byte z6s5heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z6s5heat[ZONESIX_SECTION5_END-ZONESIX_SECTION5_START]; fire(sixthZone, z6s5heat, ZONESIX_SECTION5_START, ZONESIX_SECTION5_END, ZONESIX_SECTION5_START_FIRE, ZONESIX_SECTION5_END_FIRE); #endif #if SIXTHZONE_SECTIONS >= 6 - static byte z6s6heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z6s6heat[ZONESIX_SECTION6_END-ZONESIX_SECTION6_START]; fire(sixthZone, z6s6heat, ZONESIX_SECTION6_START, ZONESIX_SECTION6_END, ZONESIX_SECTION6_START_FIRE, ZONESIX_SECTION6_END_FIRE); #endif #if SIXTHZONE_SECTIONS >= 7 - static byte z6s7heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z6s7heat[ZONESIX_SECTION7_END-ZONESIX_SECTION7_START]; fire(sixthZone, z6s7heat, ZONESIX_SECTION7_START, ZONESIX_SECTION7_END, ZONESIX_SECTION7_START_FIRE, ZONESIX_SECTION7_END_FIRE); #endif #if SIXTHZONE_SECTIONS >= 8 - static byte z6s8heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z6s8heat[ZONESIX_SECTION8_END-ZONESIX_SECTION8_START]; fire(sixthZone, z6s8heat, ZONESIX_SECTION8_START, ZONESIX_SECTION8_END, ZONESIX_SECTION8_START_FIRE, ZONESIX_SECTION8_END_FIRE); #endif #if SIXTHZONE_SECTIONS >= 9 - static byte z6s9heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + static byte z6s9heat[ZONESIX_SECTION9_END-ZONESIX_SECTION9_START]; fire(sixthZone, z6s9heat, ZONESIX_SECTION9_START, ZONESIX_SECTION9_END, ZONESIX_SECTION9_START_FIRE, ZONESIX_SECTION9_END_FIRE); #endif #endif From d685e8f91ddab5db49729982ae7de45c64bafda1 Mon Sep 17 00:00:00 2001 From: zskullz Date: Tue, 4 Feb 2020 21:20:05 -0700 Subject: [PATCH 3/7] Add valentine animation add fireworks - WIP --- Holiday_LED_2.0_6_Zones.ino | 964 ++++++++++++++---------------------- 1 file changed, 365 insertions(+), 599 deletions(-) diff --git a/Holiday_LED_2.0_6_Zones.ino b/Holiday_LED_2.0_6_Zones.ino index 3644945..2550d04 100644 --- a/Holiday_LED_2.0_6_Zones.ino +++ b/Holiday_LED_2.0_6_Zones.ino @@ -471,12 +471,23 @@ WiFiClient espClient; PubSubClient client(espClient); SimpleTimer timer; +struct Ball { + float position; + float velocity; + bool loaded; + bool reverse; + CRGB color; + int exploding; + float particlePosition; +}; + #if ZONEONE == 1 CRGB firstZone[FIRSTZONE_LEDS]; const int Pin_firstZone = 5; //marked as D1 on the board -int center_firstZone = 0; +int center_firstZone = 25; int step_firstZone = -1; int previousLED_firstZone = 0; +const int fireworkCount_firstZone = 1; #endif #if ZONETWO == 1 @@ -485,6 +496,7 @@ const int Pin_secondZone = 4; //marked as D2 on the board int center_secondZone = 0; int step_secondZone = -1; int previousLED_secondZone = 0; +const int fireworkCount_secondZone = 3; #endif #if ZONETHREE == 1 @@ -493,6 +505,7 @@ const int Pin_thirdZone = 0; //marked as D3 on the board int center_thirdZone = 0; int step_thirdZone = -1; int previousLED_thirdZone = 0; +const int fireworkCount_thirdZone = 1; #endif #if ZONEFOUR == 1 @@ -501,6 +514,7 @@ const int Pin_fourthZone = 14; //marked as D5 on the board int center_fourthZone = 0; int step_fourthZone = -1; int previousLED_fourthZone = 0; +const int fireworkCount_fourthZone = 1; #endif #if ZONEFIVE == 1 @@ -509,6 +523,7 @@ const int Pin_fifthZone = 12; //marked as D6 on the board int center_fifthZone = 0; int step_fifthZone = -1; int previousLED_fifthZone = 0; +const int fireworkCount_fifthZone = 1; #endif #if ZONESIX == 1 @@ -517,10 +532,10 @@ const int Pin_sixthZone = 13; //marked as D7 on the board int center_sixthZone = 0; int step_sixthZone = -1; int previousLED_sixthZone = 0; +const int fireworkCount_sixthZone = 1; #endif - /***************** GENERAL VARIABLES *************************************/ CRGBPalette16 gPal; @@ -534,6 +549,7 @@ uint8_t mark = 0; uint8_t gHue = 0; uint8_t startPosition = 0; uint8_t glitterChance = 250; +uint8_t fireworkChance = 3; int chaseDelay = 1000; int lastPosition = 1; int lightning = 1; @@ -710,6 +726,10 @@ void callback(char* topic, byte* payload, unsigned int length) chaseDelay = 100; } } + if(effect == "Heartbeat") + { + chaseDelay = map(intPayload, 0, 500, 150, 350); + } if(effect == "Color_Glitter") { glitterChance = (intPayload/2); @@ -730,6 +750,10 @@ void callback(char* topic, byte* payload, unsigned int length) { firesize = map(intPayload, 0, 500, 10, 120); } + if(effect == "Fireworks") + { + fireworkChance = map(intPayload, 0, 500, 0, 50); //max 255 since it is compared to a random8 number + } if(effect == "LED_Locator") { locatorDelay = map(intPayload, 0, 500, 500, 5000); @@ -974,730 +998,337 @@ void checkIn() timer.setTimeout(120000, checkIn); } -void choosePattern() +void setSectionPattern(CRGB zone[], int zoneLEDS, int sectionStart, int sectionEnd, byte heat[], int fireStart, int fireEnd) { - if(showLights == true) + if(effect == "Double_Crash") { - if(effect == "Color_Chase") - { - #if ZONEONE == 1 - rGB(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - rGB(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - rGB(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - rGB(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - rGB(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - rGB(sixthZone, SIXTHZONE_LEDS); - #endif - - } - if(effect == "Color_Glitter") - { - - #if ZONEONE == 1 - ColorGlitter(firstZone, FIRSTZONE_LEDS, glitterChance); - #endif - - #if ZONETWO == 1 - ColorGlitter(secondZone, SECONDZONE_LEDS, glitterChance); - #endif - - #if ZONETHREE == 1 - ColorGlitter(thirdZone, THIRDZONE_LEDS, glitterChance); - #endif - - #if ZONEFOUR == 1 - ColorGlitter(fourthZone, FOURTHZONE_LEDS, glitterChance); - #endif - - #if ZONEFIVE == 1 - ColorGlitter(fifthZone, FIFTHZONE_LEDS, glitterChance); - #endif - - #if ZONESIX == 1 - ColorGlitter(sixthZone, SIXTHZONE_LEDS, glitterChance); - #endif - } - if(effect == "Single_Race") - { - - #if ZONEONE == 1 - previousLED_firstZone = SingleRace(firstZone, FIRSTZONE_LEDS, previousLED_firstZone); - #endif - - #if ZONETWO == 1 - previousLED_secondZone = SingleRace(secondZone, SECONDZONE_LEDS, previousLED_secondZone); - #endif - - #if ZONETHREE == 1 - previousLED_thirdZone = SingleRace(thirdZone, THIRDZONE_LEDS, previousLED_thirdZone); - #endif + fadeToBlackBy(zone, zoneLEDS, 15); + Crash(zone, zoneLEDS, sectionStart, sectionEnd); + } + if(effect == "Fire") + { + fire(zone, heat, sectionStart, sectionEnd, fireStart, fireEnd); + } +} - #if ZONEFOUR == 1 - previousLED_fourthZone = SingleRace(fourthZone, FOURTHZONE_LEDS, previousLED_fourthZone); - #endif +void setZonePattern(CRGB zone[], int zoneLEDS, int previousZoneLED, Ball balls[], int fireworkCount, int zoneCenter, int zoneStep) +{ + if(effect == "Color_Chase") + { + rGB(zone, zoneLEDS); + } + if(effect == "Color_Glitter") + { + ColorGlitter(zone, zoneLEDS, glitterChance); + } + if(effect == "Single_Race") + { + previousZoneLED = SingleRace(zone, zoneLEDS, previousZoneLED); + } + if(effect == "Rainbow") + { + Rainbow(zone, zoneLEDS); + } + if(effect == "Blocked_Colors") + { + Blocked(zone, zoneLEDS); + } + if(effect == "BPM") + { + BPM(zone, zoneLEDS); + } + if(effect == "Twinkle") + { + Twinkle(zone, zoneLEDS); + } + if(effect == "Fill_Solid") + { + Solid(zone, zoneLEDS); + } + if(effect == "Spooky_Eyes") + { + Eyes(zone, zoneLEDS); + } + if(effect == "LED_Locator") + { + Locator(zone, zoneLEDS); + } + if(effect == "Ripple") + { + zoneStep = Ripple(zone, zoneLEDS, zoneCenter, zoneStep); + } + if(effect == "Fireworks") + { + fadeToBlackBy(zone, zoneLEDS, 8); + fireworks(zone, zoneLEDS, balls, fireworkCount, fireworkChance); + } + if(effect == "Heartbeat") + { + heartbeat(zone, zoneLEDS); + } +} - #if ZONEFIVE == 1 - previousLED_fifthZone = SingleRace(fifthZone, FIFTHZONE_LEDS, previousLED_fifthZone); - #endif - - #if ZONESIX == 1 - previousLED_sixthZone = SingleRace(sixthZone, SIXTHZONE_LEDS, previousLED_sixthZone); - #endif - } - if(effect == "Double_Crash") - { +void choosePattern() +{ + if(showLights == true) + { #if ZONEONE == 1 - fadeToBlackBy(firstZone, FIRSTZONE_LEDS, 15); + static Ball zone1balls[fireworkCount_firstZone]; + setZonePattern(firstZone, FIRSTZONE_LEDS, previousLED_firstZone, zone1balls, fireworkCount_firstZone, center_firstZone, step_firstZone); #ifdef ZONEONE_SECTION1_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION1_START, ZONEONE_SECTION1_END); + static byte zOneS1heat[ZONEONE_SECTION1_END-ZONEONE_SECTION1_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION1_START, ZONEONE_SECTION1_END, zOneS1heat, ZONEONE_SECTION1_START_FIRE, ZONEONE_SECTION1_END_FIRE); #endif #ifdef ZONEONE_SECTION2_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION2_START, ZONEONE_SECTION2_END); + static byte zOneS1heat[ZONEONE_SECTION2_END-ZONEONE_SECTION2_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION2_START, ZONEONE_SECTION2_END, zOneS1heat, ZONEONE_SECTION2_START_FIRE, ZONEONE_SECTION2_END_FIRE); #endif #ifdef ZONEONE_SECTION3_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION3_START, ZONEONE_SECTION3_END); + static byte zOneS1heat[ZONEONE_SECTION3_END-ZONEONE_SECTION3_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION3_START, ZONEONE_SECTION3_END, + zOneS1heat, ZONEONE_SECTION3_START_FIRE, ZONEONE_SECTION3_END_FIRE); #endif #ifdef ZONEONE_SECTION4_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION4_START, ZONEONE_SECTION4_END); + static byte zOneS1heat[ZONEONE_SECTION4_END-ZONEONE_SECTION4_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION4_START, ZONEONE_SECTION4_END, + zOneS1heat, ZONEONE_SECTION4_START_FIRE, ZONEONE_SECTION4_END_FIRE); #endif #ifdef ZONEONE_SECTION5_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION5_START, ZONEONE_SECTION5_END); + static byte zOneS1heat[ZONEONE_SECTION5_END-ZONEONE_SECTION5_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION5_START, ZONEONE_SECTION5_END, + zOneS1heat, ZONEONE_SECTION5_START_FIRE, ZONEONE_SECTION5_END_FIRE); #endif #ifdef ZONEONE_SECTION6_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION6_START, ZONEONE_SECTION6_END); + static byte zOneS1heat[ZONEONE_SECTION6_END-ZONEONE_SECTION6_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION6_START, ZONEONE_SECTION6_END, + zOneS1heat, ZONEONE_SECTION6_START_FIRE, ZONEONE_SECTION6_END_FIRE); #endif #ifdef ZONEONE_SECTION7_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION7_START, ZONEONE_SECTION7_END); + static byte zOneS1heat[ZONEONE_SECTION7_END-ZONEONE_SECTION7_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION7_START, ZONEONE_SECTION7_END, + zOneS1heat, ZONEONE_SECTION7_START_FIRE, ZONEONE_SECTION7_END_FIRE); #endif #ifdef ZONEONE_SECTION8_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION8_START, ZONEONE_SECTION8_END); + static byte zOneS1heat[ZONEONE_SECTION8_END-ZONEONE_SECTION8_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION8_START, ZONEONE_SECTION8_END, + zOneS1heat, ZONEONE_SECTION8_START_FIRE, ZONEONE_SECTION8_END_FIRE); #endif #ifdef ZONEONE_SECTION9_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION9_START, ZONEONE_SECTION9_END); + static byte zOneS1heat[ZONEONE_SECTION9_END-ZONEONE_SECTION9_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION9_START, ZONEONE_SECTION9_END, + zOneS1heat, ZONEONE_SECTION9_START_FIRE, ZONEONE_SECTION9_END_FIRE); #endif #endif #if ZONETWO == 1 - fadeToBlackBy(secondZone, SECONDZONE_LEDS, 15); + static Ball zone2balls[fireworkCount_secondZone]; + setZonePattern(secondZone, SECONDZONE_LEDS, previousLED_secondZone, zone2balls, fireworkCount_secondZone, center_secondZone, step_secondZone); + #ifdef ZONETWO_SECTION1_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION1_START, ZONETWO_SECTION1_END); + static byte zTwoS1heat[ZONETWO_SECTION1_END-ZONETWO_SECTION1_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION1_START, ZONETWO_SECTION1_END, zTwoS1heat, ZONETWO_SECTION1_START_FIRE, ZONETWO_SECTION1_END_FIRE); #endif #ifdef ZONETWO_SECTION2_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION2_START, ZONETWO_SECTION2_END); + static byte zTwoS2heat[ZONETWO_SECTION2_END-ZONETWO_SECTION2_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION2_START, ZONETWO_SECTION2_END, zTwoS2heat, ZONETWO_SECTION2_START_FIRE, ZONETWO_SECTION2_END_FIRE); #endif #ifdef ZONETWO_SECTION3_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION3_START, ZONETWO_SECTION3_END); + static byte zTwoS3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION3_START, ZONETWO_SECTION3_END, zTwoS3heat, ZONETWO_SECTION3_START_FIRE, ZONETWO_SECTION3_END_FIRE); #endif #ifdef ZONETWO_SECTION4_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION4_START, ZONETWO_SECTION4_END); + static byte zTwoS4heat[ZONETWO_SECTION4_END-ZONETWO_SECTION4_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION4_START, ZONETWO_SECTION4_END, zTwoS4heat, ZONETWO_SECTION4_START_FIRE, ZONETWO_SECTION4_END_FIRE); #endif #ifdef ZONETWO_SECTION5_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION5_START, ZONETWO_SECTION5_END); + static byte zTwoS5heat[ZONETWO_SECTION5_END-ZONETWO_SECTION5_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION5_START, ZONETWO_SECTION5_END, zTwoS5heat, ZONETWO_SECTION5_START_FIRE, ZONETWO_SECTION5_END_FIRE); #endif #ifdef ZONETWO_SECTION6_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION6_START, ZONETWO_SECTION6_END); + static byte zTwoS6heat[ZONETWO_SECTION6_END-ZONETWO_SECTION6_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION6_START, ZONETWO_SECTION6_END, zTwoS6heat, ZONETWO_SECTION6_START_FIRE, ZONETWO_SECTION6_END_FIRE); #endif #ifdef ZONETWO_SECTION7_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION7_START, ZONETWO_SECTION7_END); + static byte zTwoS7heat[ZONETWO_SECTION7_END-ZONETWO_SECTION7_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION7_START, ZONETWO_SECTION7_END, zTwoS7heat, ZONETWO_SECTION7_START_FIRE, ZONETWO_SECTION7_END_FIRE); #endif #ifdef ZONETWO_SECTION8_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION8_START, ZONETWO_SECTION8_END); + static byte zOneS8heat[ZONETWO_SECTION8_END-ZONETWO_SECTION8_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION8_START, ZONETWO_SECTION8_END, zTwoS8heat, ZONETWO_SECTION8_START_FIRE, ZONETWO_SECTION8_END_FIRE); #endif #ifdef ZONETWO_SECTION9_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION9_START, ZONETWO_SECTION9_END); + static byte zTwoS9heat[ZONETWO_SECTION9_END-ZONETWO_SECTION9_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION9_START, ZONETWO_SECTION9_END, zTwoS9heat, ZONETWO_SECTION9_START_FIRE, ZONETWO_SECTION9_END_FIRE); #endif #endif #if ZONETHREE == 1 - fadeToBlackBy(thirdZone, THIRDZONE_LEDS, 15); + static Ball zone3balls[fireworkCount_thirdZone]; + setZonePattern(thirdZone, THIRDZONE_LEDS, previousLED_thirdZone, zone3balls, fireworkCount_thirdZone, center_thirdZone, step_thirdZone); + #ifdef ZONETHREE_SECTION1_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION1_START, ZONETHREE_SECTION1_END); + static byte zThreeS1heat[ZONETHREE_SECTION1_END-ZONETHREE_SECTION1_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION1_START, ZONETHREE_SECTION1_END, zThreeS1heat, ZONETHREE_SECTION1_START_FIRE, ZONETHREE_SECTION1_END_FIRE); #endif #ifdef ZONETHREE_SECTION2_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION2_START, ZONETHREE_SECTION2_END); + static byte zThreeS2heat[ZONETHREE_SECTION2_END-ZONETHREE_SECTION2_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION2_START, ZONETHREE_SECTION2_END, zThreeS2heat, ZONETHREE_SECTION2_START_FIRE, ZONETHREE_SECTION2_END_FIRE); #endif #ifdef ZONETHREE_SECTION3_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION3_START, ZONETHREE_SECTION3_END); + static byte zThreeS3heat[ZONETHREE_SECTION3_END-ZONETHREE_SECTION3_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION3_START, ZONETHREE_SECTION3_END, zThreeS3heat, ZONETHREE_SECTION3_START_FIRE, ZONETHREE_SECTION3_END_FIRE); #endif #ifdef ZONETHREE_SECTION4_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION4_START, ZONETHREE_SECTION4_END); + static byte zThreeS4heat[ZONETHREE_SECTION4_END-ZONETHREE_SECTION4_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION4_START, ZONETHREE_SECTION4_END, zThreeS4heat, ZONETHREE_SECTION4_START_FIRE, ZONETHREE_SECTION4_END_FIRE); #endif #ifdef ZONETHREE_SECTION5_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION5_START, ZONETHREE_SECTION5_END); + static byte zThreeS5heat[ZONETHREE_SECTION5_END-ZONETHREE_SECTION5_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION5_START, ZONETHREE_SECTION5_END, zThreeS5heat, ZONETHREE_SECTION5_START_FIRE, ZONETHREE_SECTION5_END_FIRE); #endif #ifdef ZONETHREE_SECTION6_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION6_START, ZONETHREE_SECTION6_END); + static byte zThreeS6heat[ZONETHREE_SECTION6_END-ZONETHREE_SECTION6_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION6_START, ZONETHREE_SECTION6_END, zThreeS6heat, ZONETHREE_SECTION6_START_FIRE, ZONETHREE_SECTION6_END_FIRE); #endif #ifdef ZONETHREE_SECTION7_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION7_START, ZONETHREE_SECTION7_END); + static byte zThreeS7heat[ZONETHREE_SECTION7_END-ZONETHREE_SECTION7_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION7_START, ZONETHREE_SECTION7_END, zThreeS7heat, ZONETHREE_SECTION7_START_FIRE, ZONETHREE_SECTION7_END_FIRE); #endif #ifdef ZONETHREE_SECTION8_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION8_START, ZONETHREE_SECTION8_END); + static byte zThreeS8heat[ZONETHREE_SECTION8_END-ZONETHREE_SECTION8_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION8_START, ZONETHREE_SECTION8_END, zThreeS8heat, ZONETHREE_SECTION8_START_FIRE, ZONETHREE_SECTION8_END_FIRE); #endif #ifdef ZONETHREE_SECTION9_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION9_START, ZONETHREE_SECTION9_END); + static byte zThreeS9heat[ZONETHREE_SECTION9_END-ZONETHREE_SECTION9_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION9_START, ZONETHREE_SECTION9_END, zThreeS9heat, ZONETHREE_SECTION9_START_FIRE, ZONETHREE_SECTION9_END_FIRE); #endif #endif #if ZONEFOUR == 1 - fadeToBlackBy(fourthZone, FOURTHZONE_LEDS, 15); + static Ball zone4balls[fireworkCount_fourthZone]; + setZonePattern(fourthZone, FOURTHZONE_LEDS, previousLED_fourthZone, zone4balls, fireworkCount_fourthZone, center_fourthZone, step_fourthZone); + #ifdef ZONEFOUR_SECTION1_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION1_START, ZONEFOUR_SECTION1_END); + static byte zFourS1heat[ZONEFOUR_SECTION1_END-ZONEFOUR_SECTION1_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION1_START, ZONEFOUR_SECTION1_END, zFourS1heat, ZONEFOUR_SECTION1_START_FIRE, ZONEFOUR_SECTION1_END_FIRE); #endif #ifdef ZONEFOUR_SECTION2_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION2_START, ZONEFOUR_SECTION2_END); + static byte zFourS2heat[ZONEFOUR_SECTION2_END-ZONEFOUR_SECTION2_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION2_START, ZONEFOUR_SECTION2_END, zFourS2heat, ZONEFOUR_SECTION2_START_FIRE, ZONEFOUR_SECTION2_END_FIRE); #endif #ifdef ZONEFOUR_SECTION3_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION3_START, ZONEFOUR_SECTION3_END); + static byte zFourS3heat[ZONEFOUR_SECTION3_END-ZONEFOUR_SECTION3_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION3_START, ZONEFOUR_SECTION3_END, zFourS3heat, ZONEFOUR_SECTION3_START_FIRE, ZONEFOUR_SECTION3_END_FIRE); #endif #ifdef ZONEFOUR_SECTION4_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION4_START, ZONEFOUR_SECTION4_END); + static byte zFourS4heat[ZONEFOUR_SECTION4_END-ZONEFOUR_SECTION4_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION4_START, ZONEFOUR_SECTION4_END, zFourS4heat, ZONEFOUR_SECTION4_START_FIRE, ZONEFOUR_SECTION4_END_FIRE); #endif #ifdef ZONEFOUR_SECTION5_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION5_START, ZONEFOUR_SECTION5_END); + static byte zFourS5heat[ZONEFOUR_SECTION5_END-ZONEFOUR_SECTION5_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION5_START, ZONEFOUR_SECTION5_END, zFourS5heat, ZONEFOUR_SECTION5_START_FIRE, ZONEFOUR_SECTION5_END_FIRE); #endif #ifdef ZONEFOUR_SECTION6_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION6_START, ZONEFOUR_SECTION6_END); + static byte zFourS6heat[ZONEFOUR_SECTION6_END-ZONEFOUR_SECTION6_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION6_START, ZONEFOUR_SECTION6_END, zFourS6heat, ZONEFOUR_SECTION6_START_FIRE, ZONEFOUR_SECTION6_END_FIRE); #endif #ifdef ZONEFOUR_SECTION7_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION7_START, ZONEFOUR_SECTION7_END); + static byte zFourS7heat[ZONEFOUR_SECTION7_END-ZONEFOUR_SECTION7_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION7_START, ZONEFOUR_SECTION7_END, zFourS7heat, ZONEFOUR_SECTION7_START_FIRE, ZONEFOUR_SECTION7_END_FIRE); #endif #ifdef ZONEFOUR_SECTION8_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION8_START, ZONEFOUR_SECTION8_END); + static byte zFourS8heat[ZONEFOUR_SECTION8_END-ZONEFOUR_SECTION8_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION8_START, ZONEFOUR_SECTION8_END, zFourS8heat, ZONEFOUR_SECTION8_START_FIRE, ZONEFOUR_SECTION8_END_FIRE); #endif #ifdef ZONEFOUR_SECTION9_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION9_START, ZONEFOUR_SECTION9_END); + static byte zFourS9heat[ZONEFOUR_SECTION9_END-ZONEFOUR_SECTION9_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION9_START, ZONEFOUR_SECTION9_END, zFourS9heat, ZONEFOUR_SECTION9_START_FIRE, ZONEFOUR_SECTION9_END_FIRE); #endif #endif #if ZONEFIVE == 1 - fadeToBlackBy(fifthZone, FIFTHZONE_LEDS, 15); + static Ball zone5balls[fireworkCount_fifthZone]; + setZonePattern(fifthZone, FIFTHZONE_LEDS, previousLED_fifthZone, zone5balls, fireworkCount_fifthZone, center_fifthZone, step_fifthZone); + #ifdef ZONEFIVE_SECTION1_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION1_START, ZONEFIVE_SECTION1_END); + static byte zFiveS1heat[ZONEFIVE_SECTION1_END-ZONEFIVE_SECTION1_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION1_START, ZONEFIVE_SECTION1_END, zFiveS1heat, ZONEFIVE_SECTION1_START_FIRE, ZONEFIVE_SECTION1_END_FIRE); #endif #ifdef ZONEFIVE_SECTION2_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION2_START, ZONEFIVE_SECTION2_END); + static byte zFiveS2heat[ZONEFIVE_SECTION2_END-ZONEFIVE_SECTION2_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION2_START, ZONEFIVE_SECTION2_END, zFiveS2heat, ZONEFIVE_SECTION2_START_FIRE, ZONEFIVE_SECTION2_END_FIRE); #endif #ifdef ZONEFIVE_SECTION3_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION3_START, ZONEFIVE_SECTION3_END); + static byte zFiveS3heat[ZONEFIVE_SECTION3_END-ZONEFIVE_SECTION3_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION3_START, ZONEFIVE_SECTION3_END, zFiveS3heat, ZONEFIVE_SECTION3_START_FIRE, ZONEFIVE_SECTION3_END_FIRE); #endif #ifdef ZONEFIVE_SECTION4_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION4_START, ZONEFIVE_SECTION4_END); + static byte zFiveS4heat[ZONEFIVE_SECTION4_END-ZONEFIVE_SECTION4_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION4_START, ZONEFIVE_SECTION4_END, zFiveS4heat, ZONEFIVE_SECTION4_START_FIRE, ZONEFIVE_SECTION4_END_FIRE); #endif #ifdef ZONEFIVE_SECTION5_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION5_START, ZONEFIVE_SECTION5_END); + static byte zFiveS5heat[ZONEFIVE_SECTION5_END-ZONEFIVE_SECTION5_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION5_START, ZONEFIVE_SECTION5_END, zFiveS5heat, ZONEFIVE_SECTION5_START_FIRE, ZONEFIVE_SECTION5_END_FIRE); #endif #ifdef ZONEFIVE_SECTION6_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION6_START, ZONEFIVE_SECTION6_END); + static byte zFiveS6heat[ZONEFIVE_SECTION6_END-ZONEFIVE_SECTION6_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION6_START, ZONEFIVE_SECTION6_END, zFiveS6heat, ZONEFIVE_SECTION6_START_FIRE, ZONEFIVE_SECTION6_END_FIRE); #endif #ifdef ZONEFIVE_SECTION7_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION7_START, ZONEFIVE_SECTION7_END); + static byte zFiveS7heat[ZONEFIVE_SECTION7_END-ZONEFIVE_SECTION7_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION7_START, ZONEFIVE_SECTION7_END, zFiveS7heat, ZONEFIVE_SECTION7_START_FIRE, ZONEFIVE_SECTION7_END_FIRE); #endif #ifdef ZONEFIVE_SECTION8_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION8_START, ZONEFIVE_SECTION8_END); + static byte zFiveS8heat[ZONEFIVE_SECTION8_END-ZONEFIVE_SECTION8_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION8_START, ZONEFIVE_SECTION8_END, zFiveS8heat, ZONEFIVE_SECTION8_START_FIRE, ZONEFIVE_SECTION8_END_FIRE); #endif #ifdef ZONEFIVE_SECTION9_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION9_START, ZONEFIVE_SECTION9_END); - #endif + static byte zFiveS9heat[ZONEFIVE_SECTION9_END-ZONEFIVE_SECTION9_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION9_START, ZONEFIVE_SECTION9_END, zFiveS9heat, ZONEFIVE_SECTION9_START_FIRE, ZONEFIVE_SECTION9_END_FIRE); + #endif #endif #if ZONESIX == 1 - fadeToBlackBy(sixthZone, SIXTHZONE_LEDS, 15); + static Ball zone6balls[fireworkCount_sixthZone]; + setZonePattern(sixthZone, SIXTHZONE_LEDS, previousLED_sixthZone, zone6balls, fireworkCount_sixthZone, center_sixthZone, step_sixthZone); + #ifdef ZONESIX_SECTION1_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION1_START, ZONESIX_SECTION1_END); + static byte zSixS1heat[ZONESIX_SECTION1_END-ZONESIX_SECTION1_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION1_START, ZONESIX_SECTION1_END, zSixS1heat, ZONESIX_SECTION1_START_FIRE, ZONESIX_SECTION1_END_FIRE); #endif #ifdef ZONESIX_SECTION2_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION2_START, ZONESIX_SECTION2_END); + static byte zSixS2heat[ZONESIX_SECTION2_END-ZONESIX_SECTION2_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION2_START, ZONESIX_SECTION2_END, zSixS2heat, ZONESIX_SECTION2_START_FIRE, ZONESIX_SECTION2_END_FIRE); #endif #ifdef ZONESIX_SECTION3_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION3_START, ZONESIX_SECTION3_END); + static byte zSixS3heat[ZONESIX_SECTION3_END-ZONESIX_SECTION3_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION3_START, ZONESIX_SECTION3_END, zSixS3heat, ZONESIX_SECTION3_START_FIRE, ZONESIX_SECTION3_END_FIRE); #endif #ifdef ZONESIX_SECTION4_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION4_START, ZONESIX_SECTION4_END); + static byte zSixS4heat[ZONESIX_SECTION4_END-ZONESIX_SECTION4_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION4_START, ZONESIX_SECTION4_END, zSixS4heat, ZONESIX_SECTION4_START_FIRE, ZONESIX_SECTION4_END_FIRE); #endif #ifdef ZONESIX_SECTION5_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION5_START, ZONESIX_SECTION5_END); + static byte zSixS5heat[ZONESIX_SECTION5_END-ZONESIX_SECTION5_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION5_START, ZONESIX_SECTION5_END, zSixS5heat, ZONESIX_SECTION5_START_FIRE, ZONESIX_SECTION5_END_FIRE); #endif #ifdef ZONESIX_SECTION6_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION6_START, ZONESIX_SECTION6_END); + static byte zSixS6heat[ZONESIX_SECTION6_END-ZONESIX_SECTION6_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION6_START, ZONESIX_SECTION6_END, zSixS6heat, ZONESIX_SECTION6_START_FIRE, ZONESIX_SECTION6_END_FIRE); #endif #ifdef ZONESIX_SECTION7_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION7_START, ZONESIX_SECTION7_END); + static byte zSixS7heat[ZONESIX_SECTION7_END-ZONESIX_SECTION7_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION7_START, ZONESIX_SECTION7_END, zSixS7heat, ZONESIX_SECTION7_START_FIRE, ZONESIX_SECTION7_END_FIRE); #endif #ifdef ZONESIX_SECTION8_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION8_START, ZONESIX_SECTION8_END); + static byte zSixS8heat[ZONESIX_SECTION8_END-ZONESIX_SECTION8_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION8_START, ZONESIX_SECTION8_END, zSixS8heat, ZONESIX_SECTION8_START_FIRE, ZONESIX_SECTION8_END_FIRE); #endif #ifdef ZONESIX_SECTION9_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION9_START, ZONESIX_SECTION9_END); + static byte zSixS9heat[ZONESIX_SECTION9_END-ZONESIX_SECTION9_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION9_START, ZONESIX_SECTION9_END, zSixS9heat, ZONESIX_SECTION9_START_FIRE, ZONESIX_SECTION9_END_FIRE); #endif #endif - } - if(effect == "Rainbow") - { - #if ZONEONE == 1 - Rainbow(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - Rainbow(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - Rainbow(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - Rainbow(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - Rainbow(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - Rainbow(sixthZone, SIXTHZONE_LEDS); - #endif - } - if(effect == "Blocked_Colors") - { - #if ZONEONE == 1 - Blocked(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - Blocked(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - Blocked(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - Blocked(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - Blocked(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - Blocked(sixthZone, SIXTHZONE_LEDS); - #endif - - } - if(effect == "BPM") - { - - #if ZONEONE == 1 - BPM(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - BPM(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - BPM(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - BPM(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - BPM(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - BPM(sixthZone, SIXTHZONE_LEDS); - #endif - - } - if(effect == "Twinkle") - { - #if ZONEONE == 1 - Twinkle(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - Twinkle(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - Twinkle(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - Twinkle(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - Twinkle(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - Twinkle(sixthZone, SIXTHZONE_LEDS); - #endif - - } - if(effect == "Fill_Solid") - { - #if ZONEONE == 1 - Solid(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - Solid(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - Solid(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - Solid(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - Solid(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - Solid(sixthZone, SIXTHZONE_LEDS); - #endif - - } - if(effect == "Spooky_Eyes") - { - #if ZONEONE == 1 - Eyes(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - Eyes(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - Eyes(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - Eyes(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - Eyes(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - Eyes(sixthZone, SIXTHZONE_LEDS); - #endif - - } - - if(effect == "LED_Locator") - { - #if ZONEONE == 1 - Locator(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - Locator(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - Locator(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - Locator(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - Locator(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - Locator(sixthZone, SIXTHZONE_LEDS); - #endif - - } - if(effect == "Ripple") - { - - #if ZONEONE == 1 - Ripple(firstZone, FIRSTZONE_LEDS, center_firstZone, step_firstZone); - #endif - - #if ZONETWO == 1 - Ripple(secondZone, SECONDZONE_LEDS, center_secondZone, step_secondZone); - #endif - - #if ZONETHREE == 1 - Ripple(thirdZone, THIRDZONE_LEDS, center_thirdZone, step_thirdZone); - #endif - - #if ZONEFOUR == 1 - Ripple(fourthZone, FOURTHZONE_LEDS, center_fourthZone, step_fourthZone); - #endif - - #if ZONEFIVE == 1 - Ripple(fifthZone, FIFTHZONE_LEDS, center_fifthZone, step_fifthZone); - #endif - - #if ZONESIX == 1 - Ripple(sixthZone, SIXTHZONE_LEDS, center_sixthZone, step_sixthZone); - #endif - } - if(effect == "Fire") - { - #if ZONEONE == 1 - #if FIRSTZONE_SECTIONS >= 1 - static byte z1s1heat[ZONEONE_SECTION1_END-ZONEONE_SECTION1_START]; - fire(firstZone, z1s1heat, ZONEONE_SECTION1_START, ZONEONE_SECTION1_END, ZONEONE_SECTION1_START_FIRE, ZONEONE_SECTION1_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 2 - static byte z1s2heat[ZONEONE_SECTION2_END-ZONEONE_SECTION2_START]; - fire(firstZone, z1s2heat, ZONEONE_SECTION2_START, ZONEONE_SECTION2_END, ZONEONE_SECTION2_START_FIRE, ZONEONE_SECTION2_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 3 - static byte z1s3heat[ZONEONE_SECTION3_END-ZONEONE_SECTION3_START]; - fire(firstZone, z1s3heat, ZONEONE_SECTION3_START, ZONEONE_SECTION3_END, ZONEONE_SECTION3_START_FIRE, ZONEONE_SECTION3_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 4 - static byte z1s4heat[ZONEONE_SECTION4_END-ZONEONE_SECTION4_START]; - fire(firstZone, z1s4heat, ZONEONE_SECTION4_START, ZONEONE_SECTION4_END, ZONEONE_SECTION4_START_FIRE, ZONEONE_SECTION4_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 5 - static byte z1s5heat[ZONEONE_SECTION5_END-ZONEONE_SECTION5_START]; - fire(firstZone, z1s5heat, ZONEONE_SECTION5_START, ZONEONE_SECTION5_END, ZONEONE_SECTION5_START_FIRE, ZONEONE_SECTION5_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 6 - static byte z1s6heat[ZONEONE_SECTION6_END-ZONEONE_SECTION6_START]; - fire(firstZone, z1s6heat, ZONEONE_SECTION6_START, ZONEONE_SECTION6_END, ZONEONE_SECTION6_START_FIRE, ZONEONE_SECTION6_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 7 - static byte z1s7heat[ZONEONE_SECTION7_END-ZONEONE_SECTION7_START]; - fire(firstZone, z1s7heat, ZONEONE_SECTION7_START, ZONEONE_SECTION7_END, ZONEONE_SECTION7_START_FIRE, ZONEONE_SECTION7_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 8 - static byte z1s8heat[ZONEONE_SECTION8_END-ZONEONE_SECTION8_START]; - fire(firstZone, z1s8heat, ZONEONE_SECTION8_START, ZONEONE_SECTION8_END, ZONEONE_SECTION8_START_FIRE, ZONEONE_SECTION8_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 9 - static byte z1s9heat[ZONEONE_SECTION9_END-ZONEONE_SECTION9_START]; - fire(firstZone, z1s9heat, ZONEONE_SECTION9_START, ZONEONE_SECTION9_END, ZONEONE_SECTION9_START_FIRE, ZONEONE_SECTION9_END_FIRE); - #endif - #endif - #if ZONETWO == 1 - #if SECONDZONE_SECTIONS >= 1 - static byte z2s1heat[ZONETWO_SECTION1_END-ZONETWO_SECTION1_START]; - fire(secondZone, z2s1heat, ZONETWO_SECTION1_START, ZONETWO_SECTION1_END, ZONETWO_SECTION1_START_FIRE, ZONETWO_SECTION1_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 2 - static byte z2s2heat[ZONETWO_SECTION2_END-ZONETWO_SECTION2_START]; - fire(secondZone, z2s2heat, ZONETWO_SECTION2_START, ZONETWO_SECTION2_END, ZONETWO_SECTION2_START_FIRE, ZONETWO_SECTION2_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 3 - static byte z2s3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; - fire(secondZone, z2s3heat, ZONETWO_SECTION3_START, ZONETWO_SECTION3_END, ZONETWO_SECTION3_START_FIRE, ZONETWO_SECTION3_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 4 - static byte z2s4heat[ZONETWO_SECTION4_END-ZONETWO_SECTION4_START]; - fire(secondZone, z2s4heat, ZONETWO_SECTION4_START, ZONETWO_SECTION4_END, ZONETWO_SECTION4_START_FIRE, ZONETWO_SECTION4_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 5 - static byte z2s5heat[ZONETWO_SECTION5_END-ZONETWO_SECTION5_START]; - fire(secondZone, z2s5heat, ZONETWO_SECTION5_START, ZONETWO_SECTION5_END, ZONETWO_SECTION5_START_FIRE, ZONETWO_SECTION5_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 6 - static byte z2s6heat[ZONETWO_SECTION6_END-ZONETWO_SECTION6_START]; - fire(secondZone, z2s6heat, ZONETWO_SECTION6_START, ZONETWO_SECTION6_END, ZONETWO_SECTION6_START_FIRE, ZONETWO_SECTION6_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 7 - static byte z2s7heat[ZONETWO_SECTION7_END-ZONETWO_SECTION7_START]; - fire(secondZone, z2s7heat, ZONETWO_SECTION7_START, ZONETWO_SECTION7_END, ZONETWO_SECTION7_START_FIRE, ZONETWO_SECTION7_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 8 - static byte z2s8heat[ZONETWO_SECTION8_END-ZONETWO_SECTION8_START]; - fire(secondZone, z2s8heat, ZONETWO_SECTION8_START, ZONETWO_SECTION8_END, ZONETWO_SECTION8_START_FIRE, ZONETWO_SECTION8_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 9 - static byte z2s9heat[ZONETWO_SECTION9_END-ZONETWO_SECTION9_START]; - fire(secondZone, z2s9heat, ZONETWO_SECTION9_START, ZONETWO_SECTION9_END, ZONETWO_SECTION9_START_FIRE, ZONETWO_SECTION9_END_FIRE); - #endif - #endif - #if ZONETHREE == 1 - #if THIRDZONE_SECTIONS >= 1 - static byte z3s1heat[ZONETHREE_SECTION1_END-ZONETHREE_SECTION1_START]; - fire(thirdZone, z3s1heat, ZONETHREE_SECTION1_START, ZONETHREE_SECTION1_END, ZONETHREE_SECTION1_START_FIRE, ZONETHREE_SECTION1_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 2 - static byte z3s2heat[ZONETHREE_SECTION2_END-ZONETHREE_SECTION2_START]; - fire(thirdZone, z3s2heat, ZONETHREE_SECTION2_START, ZONETHREE_SECTION2_END, ZONETHREE_SECTION2_START_FIRE, ZONETHREE_SECTION2_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 3 - static byte z3s3heat[ZONETHREE_SECTION3_END-ZONETHREE_SECTION3_START]; - fire(thirdZone, z3s3heat, ZONETHREE_SECTION3_START, ZONETHREE_SECTION3_END, ZONETHREE_SECTION3_START_FIRE, ZONETHREE_SECTION3_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 4 - static byte z3s4heat[ZONETHREE_SECTION4_END-ZONETHREE_SECTION4_START]; - fire(thirdZone, z3s4heat, ZONETHREE_SECTION4_START, ZONETHREE_SECTION4_END, ZONETHREE_SECTION4_START_FIRE, ZONETHREE_SECTION4_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 5 - static byte z3s5heat[ZONETHREE_SECTION5_END-ZONETHREE_SECTION5_START]; - fire(thirdZone, z3s5heat, ZONETHREE_SECTION5_START, ZONETHREE_SECTION5_END, ZONETHREE_SECTION5_START_FIRE, ZONETHREE_SECTION5_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 6 - static byte z3s6heat[ZONETHREE_SECTION6_END-ZONETHREE_SECTION6_START]; - fire(thirdZone, z3s6heat, ZONETHREE_SECTION6_START, ZONETHREE_SECTION6_END, ZONETHREE_SECTION6_START_FIRE, ZONETHREE_SECTION6_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 7 - static byte z3s7heat[ZONETHREE_SECTION7_END-ZONETHREE_SECTION7_START]; - fire(thirdZone, z3s7heat, ZONETHREE_SECTION7_START, ZONETHREE_SECTION7_END, ZONETHREE_SECTION7_START_FIRE, ZONETHREE_SECTION7_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 8 - static byte z3s8heat[ZONETHREE_SECTION8_END-ZONETHREE_SECTION8_START]; - fire(thirdZone, z3s8heat, ZONETHREE_SECTION8_START, ZONETHREE_SECTION8_END, ZONETHREE_SECTION8_START_FIRE, ZONETHREE_SECTION8_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 9 - static byte z3s9heat[ZONETHREE_SECTION9_END-ZONETHREE_SECTION9_START]; - fire(thirdZone, z3s9heat, ZONETHREE_SECTION9_START, ZONETHREE_SECTION9_END, ZONETHREE_SECTION9_START_FIRE, ZONETHREE_SECTION9_END_FIRE); - #endif - #endif - - #if ZONEFOUR == 1 - #if FOURTHZONE_SECTIONS >= 1 - static byte z4s1heat[ZONEFOUR_SECTION1_END-ZONEFOUR_SECTION1_START]; - fire(fourthZone, z4s1heat, ZONEFOUR_SECTION1_START, ZONEFOUR_SECTION1_END, ZONEFOUR_SECTION1_START_FIRE, ZONEFOUR_SECTION1_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 2 - static byte z4s2heat[ZONEFOUR_SECTION2_END-ZONEFOUR_SECTION2_START]; - fire(fourthZone, z4s2heat, ZONEFOUR_SECTION2_START, ZONEFOUR_SECTION2_END, ZONEFOUR_SECTION2_START_FIRE, ZONEFOUR_SECTION2_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 3 - static byte z4s3heat[ZONEFOUR_SECTION3_END-ZONEFOUR_SECTION3_START]; - fire(fourthZone, z4s3heat, ZONEFOUR_SECTION3_START, ZONEFOUR_SECTION3_END, ZONEFOUR_SECTION3_START_FIRE, ZONEFOUR_SECTION3_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 4 - static byte z4s4heat[ZONEFOUR_SECTION4_END-ZONEFOUR_SECTION4_START]; - fire(fourthZone, z4s4heat, ZONEFOUR_SECTION4_START, ZONEFOUR_SECTION4_END, ZONEFOUR_SECTION4_START_FIRE, ZONEFOUR_SECTION4_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 5 - static byte z4s5heat[ZONEFOUR_SECTION5_END-ZONEFOUR_SECTION5_START]; - fire(fourthZone, z4s5heat, ZONEFOUR_SECTION5_START, ZONEFOUR_SECTION5_END, ZONEFOUR_SECTION5_START_FIRE, ZONEFOUR_SECTION5_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 6 - static byte z4s6heat[ZONEFOUR_SECTION6_END-ZONEFOUR_SECTION6_START]; - fire(fourthZone, z4s6heat, ZONEFOUR_SECTION6_START, ZONEFOUR_SECTION6_END, ZONEFOUR_SECTION6_START_FIRE, ZONEFOUR_SECTION6_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 7 - static byte z4s7heat[ZONEFOUR_SECTION7_END-ZONEFOUR_SECTION7_START]; - fire(fourthZone, z4s7heat, ZONEFOUR_SECTION7_START, ZONEFOUR_SECTION7_END, ZONEFOUR_SECTION7_START_FIRE, ZONEFOUR_SECTION7_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 8 - static byte z4s8heat[ZONEFOUR_SECTION8_END-ZONEFOUR_SECTION8_START]; - fire(fourthZone, z4s8heat, ZONEFOUR_SECTION8_START, ZONEFOUR_SECTION8_END, ZONEFOUR_SECTION8_START_FIRE, ZONEFOUR_SECTION8_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 9 - static byte z4s9heat[ZONEFOUR_SECTION9_END-ZONEFOUR_SECTION9_START]; - fire(fourthZone, z4s9heat, ZONEFOUR_SECTION9_START, ZONEFOUR_SECTION9_END, ZONEFOUR_SECTION9_START_FIRE, ZONEFOUR_SECTION9_END_FIRE); - #endif - #endif - - #if ZONEFIVE == 1 - #if FIFTHZONE_SECTIONS >= 1 - static byte z5s1heat[ZONEFIVE_SECTION1_END-ZONEFIVE_SECTION1_START]; - fire(fifthZone, z5s1heat, ZONEFIVE_SECTION1_START, ZONEFIVE_SECTION1_END, ZONEFIVE_SECTION1_START_FIRE, ZONEFIVE_SECTION1_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 2 - static byte z5s2heat[ZONEFIVE_SECTION2_END-ZONEFIVE_SECTION2_START]; - fire(fifthZone, z5s2heat, ZONEFIVE_SECTION2_START, ZONEFIVE_SECTION2_END, ZONEFIVE_SECTION2_START_FIRE, ZONEFIVE_SECTION2_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 3 - static byte z5s3heat[ZONEFIVE_SECTION3_END-ZONEFIVE_SECTION3_START]; - fire(fifthZone, z5s3heat, ZONEFIVE_SECTION3_START, ZONEFIVE_SECTION3_END, ZONEFIVE_SECTION3_START_FIRE, ZONEFIVE_SECTION3_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 4 - static byte z5s4heat[ZONEFIVE_SECTION4_END-ZONEFIVE_SECTION4_START]; - fire(fifthZone, z5s4heat, ZONEFIVE_SECTION4_START, ZONEFIVE_SECTION4_END, ZONEFIVE_SECTION4_START_FIRE, ZONEFIVE_SECTION4_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 5 - static byte z5s5heat[ZONEFIVE_SECTION5_END-ZONEFIVE_SECTION5_START]; - fire(fifthZone, z5s5heat, ZONEFIVE_SECTION5_START, ZONEFIVE_SECTION5_END, ZONEFIVE_SECTION5_START_FIRE, ZONEFIVE_SECTION5_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 6 - static byte z5s6heat[ZONEFIVE_SECTION6_END-ZONEFIVE_SECTION6_START]; - fire(fifthZone, z5s6heat, ZONEFIVE_SECTION6_START, ZONEFIVE_SECTION6_END, ZONEFIVE_SECTION6_START_FIRE, ZONEFIVE_SECTION6_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 7 - static byte z5s7heat[ZONEFIVE_SECTION7_END-ZONEFIVE_SECTION7_START]; - fire(fifthZone, z5s7heat, ZONEFIVE_SECTION7_START, ZONEFIVE_SECTION7_END, ZONEFIVE_SECTION7_START_FIRE, ZONEFIVE_SECTION7_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 8 - static byte z5s8heat[ZONEFIVE_SECTION8_END-ZONEFIVE_SECTION8_START]; - fire(fifthZone, z5s8heat, ZONEFIVE_SECTION8_START, ZONEFIVE_SECTION8_END, ZONEFIVE_SECTION8_START_FIRE, ZONEFIVE_SECTION8_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 9 - static byte z5s9heat[ZONEFIVE_SECTION9_END-ZONEFIVE_SECTION9_START]; - fire(fifthZone, z5s9heat, ZONEFIVE_SECTION9_START, ZONEFIVE_SECTION9_END, ZONEFIVE_SECTION9_START_FIRE, ZONEFIVE_SECTION9_END_FIRE); - #endif - #endif - - #if ZONESIX == 1 - #if SIXTHZONE_SECTIONS >= 1 - static byte z6s1heat[ZONESIX_SECTION1_END-ZONESIX_SECTION1_START]; - fire(sixthZone, z6s1heat, ZONESIX_SECTION1_START, ZONESIX_SECTION1_END, ZONESIX_SECTION1_START_FIRE, ZONESIX_SECTION1_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 2 - static byte z6s2heat[ZONESIX_SECTION2_END-ZONESIX_SECTION2_START]; - fire(sixthZone, z6s2heat, ZONESIX_SECTION2_START, ZONESIX_SECTION2_END, ZONESIX_SECTION2_START_FIRE, ZONESIX_SECTION2_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 3 - static byte z6s3heat[ZONESIX_SECTION3_END-ZONESIX_SECTION3_START]; - fire(sixthZone, z6s3heat, ZONESIX_SECTION3_START, ZONESIX_SECTION3_END, ZONESIX_SECTION3_START_FIRE, ZONESIX_SECTION3_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 4 - static byte z6s4heat[ZONESIX_SECTION4_END-ZONESIX_SECTION4_START]; - fire(sixthZone, z6s4heat, ZONESIX_SECTION4_START, ZONESIX_SECTION4_END, ZONESIX_SECTION4_START_FIRE, ZONESIX_SECTION4_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 5 - static byte z6s5heat[ZONESIX_SECTION5_END-ZONESIX_SECTION5_START]; - fire(sixthZone, z6s5heat, ZONESIX_SECTION5_START, ZONESIX_SECTION5_END, ZONESIX_SECTION5_START_FIRE, ZONESIX_SECTION5_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 6 - static byte z6s6heat[ZONESIX_SECTION6_END-ZONESIX_SECTION6_START]; - fire(sixthZone, z6s6heat, ZONESIX_SECTION6_START, ZONESIX_SECTION6_END, ZONESIX_SECTION6_START_FIRE, ZONESIX_SECTION6_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 7 - static byte z6s7heat[ZONESIX_SECTION7_END-ZONESIX_SECTION7_START]; - fire(sixthZone, z6s7heat, ZONESIX_SECTION7_START, ZONESIX_SECTION7_END, ZONESIX_SECTION7_START_FIRE, ZONESIX_SECTION7_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 8 - static byte z6s8heat[ZONESIX_SECTION8_END-ZONESIX_SECTION8_START]; - fire(sixthZone, z6s8heat, ZONESIX_SECTION8_START, ZONESIX_SECTION8_END, ZONESIX_SECTION8_START_FIRE, ZONESIX_SECTION8_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 9 - static byte z6s9heat[ZONESIX_SECTION9_END-ZONESIX_SECTION9_START]; - fire(sixthZone, z6s9heat, ZONESIX_SECTION9_START, ZONESIX_SECTION9_END, ZONESIX_SECTION9_START_FIRE, ZONESIX_SECTION9_END_FIRE); - #endif - #endif - } } if(showLights == false) { @@ -2109,7 +1740,7 @@ void loop() /***************** Animation Functions ****************************************/ -void Ripple(CRGB zone[], int ledCount, int zoneCenter, int zoneStep) +int Ripple(CRGB zone[], int ledCount, int zoneCenter, int zoneStep) { for (int i = 0; i < ledCount; i++) { @@ -2134,6 +1765,7 @@ void Ripple(CRGB zone[], int ledCount, int zoneCenter, int zoneStep) zoneStep ++; break; } + return zoneStep; } void rGB(CRGB zone[], int zoneLEDS) @@ -2448,3 +2080,137 @@ void fire(CRGB zone[], byte heat[], int sectionStart, int sectionEnd, int fireSt } } } + + +void heartbeat(CRGB zone[], int zoneLEDS) { + if(startPosition == 1 || startPosition == 3) { + fill_solid(zone, zoneLEDS, CRGB(red1, green1, blue1)); + } else { + fill_solid(zone, zoneLEDS, CRGB(red1/2, green1/2, blue1/2)); + } +} + +void fireworks(CRGB zone[], int zoneLEDS, Ball balls[], int fireworkCount, uint8_t chance) { + + const float ballVelocityDecay = 0.0036; + + for (uint8_t i = 0; i < fireworkCount; i++) { + // initialize if not loaded + if(!balls[i].loaded) + { + balls[i].position = -1; + balls[i].exploding = 0; + switch(random8(3)) + { + case 0: + balls[i].color = CRGB(red1,green1,blue1); + break; + case 1: + balls[i].color = CRGB(red2,green2,blue2); + break; + case 2: + balls[i].color = CRGB(red3,green3,blue3); + break; + } + balls[i].reverse = random8(2) == 0; + balls[i].loaded = true; + } + + // launch firework + if(balls[i].position < 0 && random8() < chance) { + if(balls[i].reverse) + { + zone[zoneLEDS] += CHSV(0, 0, 128); + balls[i].position = zoneLEDS; + balls[i].velocity = -1.0; + } + else { + zone[0] += CHSV(0, 0, 128); + balls[i].position = 0; + balls[i].velocity = 1.0; + } + } + else if (balls[i].exploding < 1 && balls[i].position > 15 + && balls[i].position < zoneLEDS - 15 && random8(1,80) == 2) { + // detonate firework + balls[i].exploding = 1; + } + + // update + if (balls[i].position >= 0) { + uint8_t exploding = balls[i].exploding; + + if (exploding == 0) { + balls[i].position += balls[i].velocity; + balls[i].velocity -= ballVelocityDecay; + if (balls[i].position >= zoneLEDS) { + balls[i].velocity *= -1.0; + balls[i].position = zoneLEDS - 1; + } + else if (balls[i].position <= 0) { + balls[i].velocity = 1.0; + balls[i].position = 1; + } + } + + // draw + if (exploding == 0) { + zone[(uint8_t) balls[i].position] += CHSV(0, 0, 16); + } + else if (exploding == 1) { + zone[(uint8_t) balls[i].position] += CRGB::White; + balls[i].exploding++; + balls[i].velocity = 1; + balls[i].particlePosition = 50; + } + else if (exploding == 2) { + int16_t explosionPosition = balls[i].position; + int pos = map(balls[i].particlePosition, 50, 0, 1, 5); + int particles = 2; + if(pos > 3) { particles = 4; } + for (uint8_t j = 0; j < particles; j++) { + + int topPos = explosionPosition+(j*pos); + if(topPos <= zoneLEDS) + { + zone[topPos] = balls[i].color; + } + int bottomPos = explosionPosition-(j*pos); + if(bottomPos >= 0) + { + zone[bottomPos] = balls[i].color; + } + } + if( balls[i].particlePosition >= 0) + { + balls[i].particlePosition -= balls[i].velocity; + } + else + { + balls[i].exploding++; + } + if(balls[i].velocity > 0) + { + balls[i].velocity -= .01; + } + } + else { + balls[i].exploding = 0; + balls[i].position = -1; + balls[i].reverse = random8(2) == 0; + switch(random8(3)) + { + case 0: + balls[i].color = CRGB(red1,green1,blue1); + break; + case 1: + balls[i].color = CRGB(red2,green2,blue2); + break; + case 2: + balls[i].color = CRGB(red3,green3,blue3); + break; + } + } + } + } +} From eecf7427d4752adff76f0f87b309bd06c2955f28 Mon Sep 17 00:00:00 2001 From: zskullz Date: Thu, 24 Sep 2020 23:01:07 -0600 Subject: [PATCH 4/7] Set effect by zone Update mqtt status topics on reconnect New traditional solid lights --- Holiday_LED_2.0_6_Zones.ino | 1638 +++++++++++++++++------------------ 1 file changed, 805 insertions(+), 833 deletions(-) diff --git a/Holiday_LED_2.0_6_Zones.ino b/Holiday_LED_2.0_6_Zones.ino index 3644945..c7ad6ec 100644 --- a/Holiday_LED_2.0_6_Zones.ino +++ b/Holiday_LED_2.0_6_Zones.ino @@ -471,12 +471,23 @@ WiFiClient espClient; PubSubClient client(espClient); SimpleTimer timer; +struct Ball { + float position; + float velocity; + bool loaded; + bool reverse; + CRGB color; + int exploding; + float particlePosition; +}; + #if ZONEONE == 1 CRGB firstZone[FIRSTZONE_LEDS]; const int Pin_firstZone = 5; //marked as D1 on the board -int center_firstZone = 0; +int center_firstZone = 25; int step_firstZone = -1; int previousLED_firstZone = 0; +const int fireworkCount_firstZone = 1; #endif #if ZONETWO == 1 @@ -485,6 +496,7 @@ const int Pin_secondZone = 4; //marked as D2 on the board int center_secondZone = 0; int step_secondZone = -1; int previousLED_secondZone = 0; +const int fireworkCount_secondZone = 3; #endif #if ZONETHREE == 1 @@ -493,6 +505,7 @@ const int Pin_thirdZone = 0; //marked as D3 on the board int center_thirdZone = 0; int step_thirdZone = -1; int previousLED_thirdZone = 0; +const int fireworkCount_thirdZone = 1; #endif #if ZONEFOUR == 1 @@ -501,6 +514,7 @@ const int Pin_fourthZone = 14; //marked as D5 on the board int center_fourthZone = 0; int step_fourthZone = -1; int previousLED_fourthZone = 0; +const int fireworkCount_fourthZone = 1; #endif #if ZONEFIVE == 1 @@ -509,6 +523,7 @@ const int Pin_fifthZone = 12; //marked as D6 on the board int center_fifthZone = 0; int step_fifthZone = -1; int previousLED_fifthZone = 0; +const int fireworkCount_fifthZone = 1; #endif #if ZONESIX == 1 @@ -517,37 +532,26 @@ const int Pin_sixthZone = 13; //marked as D7 on the board int center_sixthZone = 0; int step_sixthZone = -1; int previousLED_sixthZone = 0; +const int fireworkCount_sixthZone = 1; #endif - /***************** GENERAL VARIABLES *************************************/ CRGBPalette16 gPal; int glitterFrequency = 100; int lightningChance = 65280; -int firesize = 40; int SPARKING = 85; int COOLING = 120; bool gReverseDirection = false; uint8_t mark = 0; uint8_t gHue = 0; -uint8_t startPosition = 0; -uint8_t glitterChance = 250; -int chaseDelay = 1000; int lastPosition = 1; int lightning = 1; -int raceSpeed = 12; -int BeatsPerMinute = 62; -uint8_t numberOfRainbows = 7; -int twinkleChance = 250; -int eyeChance = 248; bool boot = true; -String effect = "None"; bool showGlitter = false; bool showLightning = false; bool audioEffects = false; -bool showLights = false; byte red1 = 255; byte green1 = 0; byte blue1 = 0; @@ -566,6 +570,10 @@ int maxLEDs = 500; int locatorLED = 0; char MQTT_locatorLED[50]; int locatorDelay = 1000; +String zoneEffects[6] = {"None","None","None","None","None","None"}; +int zoneModifer[6] = { 100, 100, 100, 100, 100, 100 }; +uint8_t zoneStartPosition[6] = { 0, 0, 0, 0, 0, 0 }; +bool showZoneLights[6] = { false, false, false, false, false, false }; /***************** SYSTEM FUNCTIONS *************************************/ @@ -620,17 +628,22 @@ void reconnect() // ... and resubscribe client.subscribe(USER_MQTT_CLIENT_NAME"/configure"); client.subscribe(USER_MQTT_CLIENT_NAME"/modifier"); + client.subscribe(USER_MQTT_CLIENT_NAME"/modifier/+"); client.subscribe(USER_MQTT_CLIENT_NAME"/effect"); + client.subscribe(USER_MQTT_CLIENT_NAME"/effect/+"); client.subscribe(USER_MQTT_CLIENT_NAME"/state"); client.subscribe(USER_MQTT_CLIENT_NAME"/color1"); client.subscribe(USER_MQTT_CLIENT_NAME"/color2"); client.subscribe(USER_MQTT_CLIENT_NAME"/color3"); client.subscribe(USER_MQTT_CLIENT_NAME"/power"); + client.subscribe(USER_MQTT_CLIENT_NAME"/power/+"); client.subscribe(USER_MQTT_CLIENT_NAME"/brightness"); client.subscribe(USER_MQTT_CLIENT_NAME"/addEffects"); client.subscribe(USER_MQTT_CLIENT_NAME"/lightningChance"); client.subscribe(USER_MQTT_CLIENT_NAME"/glitterChance"); client.subscribe(USER_MQTT_CLIENT_NAME"/glitterColor"); + + publishStates(); } else { @@ -676,6 +689,42 @@ void calculateMax() #endif } +void publishStates() +{ + char buff[50]; + client.publish(USER_MQTT_CLIENT_NAME"/modifierState", itoa(zoneModifer[0], buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone1", itoa(zoneModifer[0], buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone2", itoa(zoneModifer[1], buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone3", itoa(zoneModifer[2], buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone4", itoa(zoneModifer[3], buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone5", itoa(zoneModifer[4], buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone6", itoa(zoneModifer[5], buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME"/audio/state", String(audioEffects).c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/glitter/state", String(showGlitter).c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/lightning/state", String(showLightning).c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/effectState", zoneEffects[0].c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone1", zoneEffects[0].c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone2", zoneEffects[1].c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone3", zoneEffects[2].c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone4", zoneEffects[3].c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone5", zoneEffects[4].c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone6", zoneEffects[5].c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/color1State", String(String(red1) + "," + String(green1) + "," + String(blue1)).c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/color2State", String(String(red2) + "," + String(green2) + "," + String(blue2)).c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/color3State", String(String(red3) + "," + String(green3) + "," + String(blue3)).c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/glitterColorState", String(String(redG) + "," + String(greenG) + "," + String(blueG)).c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/glitterChanceState", itoa(glitterFrequency, buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME "/lightningChanceState", itoa(65535-lightningChance, buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME "/brightnessState", itoa(brightness, buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME "/powerState", String(showZoneLights[0]).c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone1", String(showZoneLights[0]).c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone2", String(showZoneLights[1]).c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone3", String(showZoneLights[2]).c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone4", String(showZoneLights[3]).c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone5", String(showZoneLights[4]).c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone6", String(showZoneLights[5]).c_str()); +} + /************************** MQTT CALLBACK ***********************/ @@ -693,48 +742,55 @@ void callback(char* topic, byte* payload, unsigned int length) newPayload.toCharArray(charPayload, newPayload.length() + 1); if (newTopic == USER_MQTT_CLIENT_NAME"/modifier") { - client.publish(USER_MQTT_CLIENT_NAME"/modifierState", charPayload); - if(effect == "Double_Crash" || effect == "Single_Race") - { - raceSpeed = (intPayload/20); - } - if(effect == "BPM") - { - BeatsPerMinute = (intPayload/4); - } - if(effect == "Color_Chase" || effect == "Blocked_Colors") - { - chaseDelay = (intPayload*5); - if(chaseDelay < 100) - { - chaseDelay = 100; - } - } - if(effect == "Color_Glitter") - { - glitterChance = (intPayload/2); - } - if(effect == "Rainbow") - { - numberOfRainbows = (intPayload/30); - } - if(effect == "Twinkle") - { - twinkleChance = map(intPayload, 0, 500, 0, 255); - } - if(effect == "Spooky_Eyes") - { - eyeChance = map(intPayload, 0, 500, 200, 255); - } - if(effect == "Fire") - { - firesize = map(intPayload, 0, 500, 10, 120); - } - if(effect == "LED_Locator") - { - locatorDelay = map(intPayload, 0, 500, 500, 5000); + for (byte i = 0; i < 6; i = i + 1) { + zoneModifer[i] = intPayload; } + client.publish(USER_MQTT_CLIENT_NAME"/modifierState", charPayload); + + locatorDelay = map(intPayload, 0, 500, 500, 5000); } + #if ZONEONE == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/modifier/Zone1") + { + zoneModifer[0] = intPayload; + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone1", charPayload); + } + #endif + #if ZONETWO == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/modifier/Zone2") + { + zoneModifer[1] = intPayload; + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone2", charPayload); + } + #endif + #if ZONETHREE == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/modifier/Zone3") + { + zoneModifer[2] = intPayload; + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone3", charPayload); + } + #endif + #if ZONEFOUR == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/modifier/Zone4") + { + zoneModifer[3] = intPayload; + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone4", charPayload); + } + #endif + #if ZONEFIVE == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/modifier/Zone5") + { + zoneModifer[4] = intPayload; + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone5", charPayload); + } + #endif + #if ZONESIX == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/modifier/Zone6") + { + zoneModifer[5] = intPayload; + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone6", charPayload); + } + #endif if (newTopic == USER_MQTT_CLIENT_NAME"/addEffects") { if(newPayload == "Audio On") @@ -770,38 +826,68 @@ void callback(char* topic, byte* payload, unsigned int length) } if (newTopic == USER_MQTT_CLIENT_NAME"/effect") { - effect = newPayload; + zoneEffects[0] = newPayload; client.publish(USER_MQTT_CLIENT_NAME"/effectState", charPayload); - #if ZONEONE == 1 + if(newPayload == "LED_Locator") + { + locator_Move(); + } + } + + #if ZONEONE == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/effect/Zone1" || newTopic == USER_MQTT_CLIENT_NAME"/effect") + { + zoneEffects[0] = newPayload; fill_solid(firstZone, FIRSTZONE_LEDS, CRGB::Black); - #endif + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone1", charPayload); + } + #endif - #if ZONETWO == 1 - fill_solid(secondZone, SECONDZONE_LEDS, CRGB::Black); - #endif + #if ZONETWO == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/effect/Zone2" || newTopic == USER_MQTT_CLIENT_NAME"/effect") + { + zoneEffects[1] = newPayload; + fill_solid(secondZone, SECONDZONE_LEDS, CRGB::Black); + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone2", charPayload); + } + #endif - #if ZONETHREE == 1 + #if ZONETHREE == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/effect/Zone3" || newTopic == USER_MQTT_CLIENT_NAME"/effect") + { + zoneEffects[2] = newPayload; fill_solid(thirdZone, THIRDZONE_LEDS, CRGB::Black); - #endif + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone3", charPayload); + } + #endif - #if ZONEFOUR == 1 + #if ZONEFOUR == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/effect/Zone4" || newTopic == USER_MQTT_CLIENT_NAME"/effect") + { + zoneEffects[3] = newPayload; fill_solid(fourthZone, FOURTHZONE_LEDS, CRGB::Black); - #endif + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone4", charPayload); + } + #endif - #if ZONEFIVE == 1 - fill_solid(fifthZone, FIFTHZONE_LEDS, CRGB::Black); - #endif + #if ZONEFIVE == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/effect/Zone5" || newTopic == USER_MQTT_CLIENT_NAME"/effect") + { + zoneEffects[4] = newPayload; + fill_solid(fifthZone, FIFTHZONE_LEDS, CRGB::Black); + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone5", charPayload); + } + #endif - #if ZONESIX == 1 + #if ZONESIX == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/effect/Zone6" || newTopic == USER_MQTT_CLIENT_NAME"/effect") + { + zoneEffects[5] = newPayload; fill_solid(sixthZone, SIXTHZONE_LEDS, CRGB::Black); - #endif - - if(effect == "LED_Locator") - { - locator_Move(); - } + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone6", charPayload); } + #endif if (newTopic == USER_MQTT_CLIENT_NAME "/color1") { @@ -939,33 +1025,85 @@ void callback(char* topic, byte* payload, unsigned int length) if (newTopic == USER_MQTT_CLIENT_NAME"/power") { - client.publish(USER_MQTT_CLIENT_NAME "/powerState", charPayload); - if(newPayload == "ON") - { - showLights = true; - } - if(newPayload == "OFF") - { - showLights = false; - } + showZoneLights[0] = newPayload == "ON"; + client.publish(USER_MQTT_CLIENT_NAME "/powerState", charPayload); + } + #if ZONEONE == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/power/Zone1" || newTopic == USER_MQTT_CLIENT_NAME"/power") + { + showZoneLights[0] = newPayload == "ON"; + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone1", charPayload); + } + #endif + #if ZONETWO == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/power/Zone2" || newTopic == USER_MQTT_CLIENT_NAME"/power") + { + showZoneLights[1] = newPayload == "ON"; + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone2", charPayload); + } + #endif + #if ZONETHREE == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/power/Zone3" || newTopic == USER_MQTT_CLIENT_NAME"/power") + { + showZoneLights[2] = newPayload == "ON"; + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone3", charPayload); + } + #endif + #if ZONEFOUR == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/power/Zone4" || newTopic == USER_MQTT_CLIENT_NAME"/power") + { + showZoneLights[3] = newPayload == "ON"; + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone4", charPayload); + } + #endif + #if ZONEFIVE == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/power/Zone5" || newTopic == USER_MQTT_CLIENT_NAME"/power") + { + showZoneLights[4] = newPayload == "ON"; + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone5", charPayload); + } + #endif + #if ZONESIX == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/power/Zone6" || newTopic == USER_MQTT_CLIENT_NAME"/power") + { + showZoneLights[5] = newPayload == "ON"; + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone6", charPayload); } + #endif } /***************** GLOBAL LIGHT FUNCTIONS *******************************/ -void chase() +void chase(void* args) { - if(startPosition == 5) + int i = (int)args; + if(zoneStartPosition[i] == 5) { - startPosition = 0; + zoneStartPosition[i] = 0; } else { - startPosition++; + zoneStartPosition[i] = zoneStartPosition[i] + 1; + } + + int chaseDelay = 1000; + + if (zoneEffects[i] == "Color_Chase" || zoneEffects[i] == "Blocked_Colors") + { + chaseDelay = (zoneModifer[i]*5); + if(chaseDelay < 100) + { + chaseDelay = 100; + } + } + else if (zoneEffects[i] == "Heartbeat") + { + chaseDelay = map(zoneModifer[i], 0, 500, 150, 350); } - timer.setTimeout(chaseDelay, chase); + + timer.setTimeout(chaseDelay, chase, args); } void checkIn() @@ -974,757 +1112,430 @@ void checkIn() timer.setTimeout(120000, checkIn); } -void choosePattern() +void setSectionPattern(CRGB zone[], int zoneLEDS, int sectionStart, int sectionEnd, byte heat[], int fireStart, int fireEnd, int zoneIndex) { - if(showLights == true) + String effect = zoneEffects[zoneIndex]; + int modifier = zoneModifer[zoneIndex]; + if(effect == "Double_Crash") { - if(effect == "Color_Chase") - { - #if ZONEONE == 1 - rGB(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - rGB(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - rGB(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - rGB(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - rGB(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - rGB(sixthZone, SIXTHZONE_LEDS); - #endif - - } - if(effect == "Color_Glitter") - { - - #if ZONEONE == 1 - ColorGlitter(firstZone, FIRSTZONE_LEDS, glitterChance); - #endif - - #if ZONETWO == 1 - ColorGlitter(secondZone, SECONDZONE_LEDS, glitterChance); - #endif - - #if ZONETHREE == 1 - ColorGlitter(thirdZone, THIRDZONE_LEDS, glitterChance); - #endif - - #if ZONEFOUR == 1 - ColorGlitter(fourthZone, FOURTHZONE_LEDS, glitterChance); - #endif - - #if ZONEFIVE == 1 - ColorGlitter(fifthZone, FIFTHZONE_LEDS, glitterChance); - #endif - - #if ZONESIX == 1 - ColorGlitter(sixthZone, SIXTHZONE_LEDS, glitterChance); - #endif - } - if(effect == "Single_Race") - { - - #if ZONEONE == 1 - previousLED_firstZone = SingleRace(firstZone, FIRSTZONE_LEDS, previousLED_firstZone); - #endif - - #if ZONETWO == 1 - previousLED_secondZone = SingleRace(secondZone, SECONDZONE_LEDS, previousLED_secondZone); - #endif - - #if ZONETHREE == 1 - previousLED_thirdZone = SingleRace(thirdZone, THIRDZONE_LEDS, previousLED_thirdZone); - #endif + fadeToBlackBy(zone, zoneLEDS, 15); + Crash(zone, zoneLEDS, sectionStart, sectionEnd, (modifier/20)); + } + if(effect == "Fire") + { + fire(zone, heat, sectionStart, sectionEnd, fireStart, fireEnd, map(modifier, 0, 500, 10, 120)); + } +} - #if ZONEFOUR == 1 - previousLED_fourthZone = SingleRace(fourthZone, FOURTHZONE_LEDS, previousLED_fourthZone); - #endif +void setZonePattern(CRGB zone[], int zoneLEDS, int previousZoneLED, Ball balls[], int fireworkCount, int zoneCenter, int zoneStep, int zoneIndex) +{ + String effect = zoneEffects[zoneIndex]; + int modifier = zoneModifer[zoneIndex]; + uint8_t startPosition = zoneStartPosition[zoneIndex]; + + if(effect == "Color_Chase") + { + rGB(zone, zoneLEDS, startPosition); + } + if(effect == "Color_Glitter") + { + ColorGlitter(zone, zoneLEDS, (modifier/2), startPosition); + } + if(effect == "Single_Race") + { + previousZoneLED = SingleRace(zone, zoneLEDS, previousZoneLED, (modifier/20)); + } + if(effect == "Rainbow") + { + Rainbow(zone, zoneLEDS, (modifier/30)); + } + if(effect == "Blocked_Colors") + { + Blocked(zone, zoneLEDS, startPosition); + } + if(effect == "BPM") + { + BPM(zone, zoneLEDS,(modifier/4)); + } + if(effect == "Twinkle") + { + Twinkle(zone, zoneLEDS, map(modifier, 0, 500, 0, 255)); + } + if(effect == "Fill_Solid") + { + Solid(zone, zoneLEDS); + } + if(effect == "Spooky_Eyes") + { + Eyes(zone, zoneLEDS, map(modifier, 0, 500, 200, 255)); + } + if(effect == "LED_Locator") + { + Locator(zone, zoneLEDS); + } + if(effect == "Ripple") + { + zoneStep = Ripple(zone, zoneLEDS, zoneCenter, zoneStep); + } + if(effect == "Fireworks") + { + fadeToBlackBy(zone, zoneLEDS, 8); + fireworks(zone, zoneLEDS, balls, fireworkCount, map(modifier, 0, 500, 0, 50)); + } + if(effect == "Heartbeat") + { + heartbeat(zone, zoneLEDS, startPosition); + } + if(effect == "Three_Solid") + { + threeSolid(zone, zoneLEDS); + } +} - #if ZONEFIVE == 1 - previousLED_fifthZone = SingleRace(fifthZone, FIFTHZONE_LEDS, previousLED_fifthZone); - #endif - - #if ZONESIX == 1 - previousLED_sixthZone = SingleRace(sixthZone, SIXTHZONE_LEDS, previousLED_sixthZone); - #endif - } - if(effect == "Double_Crash") - { - #if ZONEONE == 1 - fadeToBlackBy(firstZone, FIRSTZONE_LEDS, 15); +void choosePattern() +{ + #if ZONEONE == 1 + if(showZoneLights[0] == true) + { + static Ball zone1balls[fireworkCount_firstZone]; + setZonePattern(firstZone, FIRSTZONE_LEDS, previousLED_firstZone, zone1balls, fireworkCount_firstZone, center_firstZone, step_firstZone, 0); #ifdef ZONEONE_SECTION1_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION1_START, ZONEONE_SECTION1_END); + static byte zOneS1heat[ZONEONE_SECTION1_END-ZONEONE_SECTION1_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION1_START, ZONEONE_SECTION1_END, + zOneS1heat, ZONEONE_SECTION1_START_FIRE, ZONEONE_SECTION1_END_FIRE, 0); #endif #ifdef ZONEONE_SECTION2_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION2_START, ZONEONE_SECTION2_END); + static byte zOneS1heat[ZONEONE_SECTION2_END-ZONEONE_SECTION2_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION2_START, ZONEONE_SECTION2_END, + zOneS1heat, ZONEONE_SECTION2_START_FIRE, ZONEONE_SECTION2_END_FIRE, 0); #endif #ifdef ZONEONE_SECTION3_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION3_START, ZONEONE_SECTION3_END); + static byte zOneS1heat[ZONEONE_SECTION3_END-ZONEONE_SECTION3_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION3_START, ZONEONE_SECTION3_END, + zOneS1heat, ZONEONE_SECTION3_START_FIRE, ZONEONE_SECTION3_END_FIRE , 0); #endif #ifdef ZONEONE_SECTION4_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION4_START, ZONEONE_SECTION4_END); + static byte zOneS1heat[ZONEONE_SECTION4_END-ZONEONE_SECTION4_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION4_START, ZONEONE_SECTION4_END, + zOneS1heat, ZONEONE_SECTION4_START_FIRE, ZONEONE_SECTION4_END_FIRE, 0); #endif #ifdef ZONEONE_SECTION5_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION5_START, ZONEONE_SECTION5_END); + static byte zOneS1heat[ZONEONE_SECTION5_END-ZONEONE_SECTION5_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION5_START, ZONEONE_SECTION5_END, + zOneS1heat, ZONEONE_SECTION5_START_FIRE, ZONEONE_SECTION5_END_FIRE, 0); #endif #ifdef ZONEONE_SECTION6_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION6_START, ZONEONE_SECTION6_END); + static byte zOneS1heat[ZONEONE_SECTION6_END-ZONEONE_SECTION6_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION6_START, ZONEONE_SECTION6_END, + zOneS1heat, ZONEONE_SECTION6_START_FIRE, ZONEONE_SECTION6_END_FIRE, 0); #endif #ifdef ZONEONE_SECTION7_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION7_START, ZONEONE_SECTION7_END); + static byte zOneS1heat[ZONEONE_SECTION7_END-ZONEONE_SECTION7_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION7_START, ZONEONE_SECTION7_END, + zOneS1heat, ZONEONE_SECTION7_START_FIRE, ZONEONE_SECTION7_END_FIRE, 0); #endif #ifdef ZONEONE_SECTION8_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION8_START, ZONEONE_SECTION8_END); - #endif - #ifdef ZONEONE_SECTION9_START - Crash(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION9_START, ZONEONE_SECTION9_END); - #endif - #endif - - #if ZONETWO == 1 - fadeToBlackBy(secondZone, SECONDZONE_LEDS, 15); - #ifdef ZONETWO_SECTION1_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION1_START, ZONETWO_SECTION1_END); - #endif - #ifdef ZONETWO_SECTION2_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION2_START, ZONETWO_SECTION2_END); - #endif - #ifdef ZONETWO_SECTION3_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION3_START, ZONETWO_SECTION3_END); - #endif - #ifdef ZONETWO_SECTION4_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION4_START, ZONETWO_SECTION4_END); - #endif - #ifdef ZONETWO_SECTION5_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION5_START, ZONETWO_SECTION5_END); - #endif - #ifdef ZONETWO_SECTION6_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION6_START, ZONETWO_SECTION6_END); - #endif - #ifdef ZONETWO_SECTION7_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION7_START, ZONETWO_SECTION7_END); - #endif - #ifdef ZONETWO_SECTION8_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION8_START, ZONETWO_SECTION8_END); - #endif - #ifdef ZONETWO_SECTION9_START - Crash(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION9_START, ZONETWO_SECTION9_END); - #endif - #endif - - #if ZONETHREE == 1 - fadeToBlackBy(thirdZone, THIRDZONE_LEDS, 15); - #ifdef ZONETHREE_SECTION1_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION1_START, ZONETHREE_SECTION1_END); - #endif - #ifdef ZONETHREE_SECTION2_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION2_START, ZONETHREE_SECTION2_END); - #endif - #ifdef ZONETHREE_SECTION3_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION3_START, ZONETHREE_SECTION3_END); - #endif - #ifdef ZONETHREE_SECTION4_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION4_START, ZONETHREE_SECTION4_END); - #endif - #ifdef ZONETHREE_SECTION5_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION5_START, ZONETHREE_SECTION5_END); - #endif - #ifdef ZONETHREE_SECTION6_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION6_START, ZONETHREE_SECTION6_END); - #endif - #ifdef ZONETHREE_SECTION7_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION7_START, ZONETHREE_SECTION7_END); - #endif - #ifdef ZONETHREE_SECTION8_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION8_START, ZONETHREE_SECTION8_END); - #endif - #ifdef ZONETHREE_SECTION9_START - Crash(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION9_START, ZONETHREE_SECTION9_END); - #endif - #endif - - #if ZONEFOUR == 1 - fadeToBlackBy(fourthZone, FOURTHZONE_LEDS, 15); - #ifdef ZONEFOUR_SECTION1_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION1_START, ZONEFOUR_SECTION1_END); - #endif - #ifdef ZONEFOUR_SECTION2_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION2_START, ZONEFOUR_SECTION2_END); - #endif - #ifdef ZONEFOUR_SECTION3_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION3_START, ZONEFOUR_SECTION3_END); - #endif - #ifdef ZONEFOUR_SECTION4_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION4_START, ZONEFOUR_SECTION4_END); - #endif - #ifdef ZONEFOUR_SECTION5_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION5_START, ZONEFOUR_SECTION5_END); - #endif - #ifdef ZONEFOUR_SECTION6_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION6_START, ZONEFOUR_SECTION6_END); - #endif - #ifdef ZONEFOUR_SECTION7_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION7_START, ZONEFOUR_SECTION7_END); - #endif - #ifdef ZONEFOUR_SECTION8_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION8_START, ZONEFOUR_SECTION8_END); - #endif - #ifdef ZONEFOUR_SECTION9_START - Crash(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION9_START, ZONEFOUR_SECTION9_END); - #endif - #endif - - #if ZONEFIVE == 1 - fadeToBlackBy(fifthZone, FIFTHZONE_LEDS, 15); - #ifdef ZONEFIVE_SECTION1_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION1_START, ZONEFIVE_SECTION1_END); - #endif - #ifdef ZONEFIVE_SECTION2_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION2_START, ZONEFIVE_SECTION2_END); - #endif - #ifdef ZONEFIVE_SECTION3_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION3_START, ZONEFIVE_SECTION3_END); - #endif - #ifdef ZONEFIVE_SECTION4_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION4_START, ZONEFIVE_SECTION4_END); - #endif - #ifdef ZONEFIVE_SECTION5_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION5_START, ZONEFIVE_SECTION5_END); - #endif - #ifdef ZONEFIVE_SECTION6_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION6_START, ZONEFIVE_SECTION6_END); - #endif - #ifdef ZONEFIVE_SECTION7_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION7_START, ZONEFIVE_SECTION7_END); - #endif - #ifdef ZONEFIVE_SECTION8_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION8_START, ZONEFIVE_SECTION8_END); - #endif - #ifdef ZONEFIVE_SECTION9_START - Crash(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION9_START, ZONEFIVE_SECTION9_END); - #endif - #endif - - #if ZONESIX == 1 - fadeToBlackBy(sixthZone, SIXTHZONE_LEDS, 15); - #ifdef ZONESIX_SECTION1_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION1_START, ZONESIX_SECTION1_END); - #endif - #ifdef ZONESIX_SECTION2_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION2_START, ZONESIX_SECTION2_END); - #endif - #ifdef ZONESIX_SECTION3_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION3_START, ZONESIX_SECTION3_END); - #endif - #ifdef ZONESIX_SECTION4_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION4_START, ZONESIX_SECTION4_END); - #endif - #ifdef ZONESIX_SECTION5_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION5_START, ZONESIX_SECTION5_END); - #endif - #ifdef ZONESIX_SECTION6_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION6_START, ZONESIX_SECTION6_END); - #endif - #ifdef ZONESIX_SECTION7_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION7_START, ZONESIX_SECTION7_END); - #endif - #ifdef ZONESIX_SECTION8_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION8_START, ZONESIX_SECTION8_END); - #endif - #ifdef ZONESIX_SECTION9_START - Crash(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION9_START, ZONESIX_SECTION9_END); - #endif - #endif - } - if(effect == "Rainbow") - { - #if ZONEONE == 1 - Rainbow(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - Rainbow(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - Rainbow(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - Rainbow(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - Rainbow(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - Rainbow(sixthZone, SIXTHZONE_LEDS); - #endif - } - if(effect == "Blocked_Colors") - { - #if ZONEONE == 1 - Blocked(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - Blocked(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - Blocked(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - Blocked(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - Blocked(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - Blocked(sixthZone, SIXTHZONE_LEDS); - #endif - - } - if(effect == "BPM") - { - - #if ZONEONE == 1 - BPM(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - BPM(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - BPM(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - BPM(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - BPM(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - BPM(sixthZone, SIXTHZONE_LEDS); - #endif - - } - if(effect == "Twinkle") - { - #if ZONEONE == 1 - Twinkle(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - Twinkle(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - Twinkle(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - Twinkle(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - Twinkle(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - Twinkle(sixthZone, SIXTHZONE_LEDS); - #endif - - } - if(effect == "Fill_Solid") - { - #if ZONEONE == 1 - Solid(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - Solid(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - Solid(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - Solid(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - Solid(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - Solid(sixthZone, SIXTHZONE_LEDS); - #endif - - } - if(effect == "Spooky_Eyes") - { - #if ZONEONE == 1 - Eyes(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - Eyes(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - Eyes(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - Eyes(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - Eyes(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - Eyes(sixthZone, SIXTHZONE_LEDS); - #endif - - } - - if(effect == "LED_Locator") - { - #if ZONEONE == 1 - Locator(firstZone, FIRSTZONE_LEDS); - #endif - - #if ZONETWO == 1 - Locator(secondZone, SECONDZONE_LEDS); - #endif - - #if ZONETHREE == 1 - Locator(thirdZone, THIRDZONE_LEDS); - #endif - - #if ZONEFOUR == 1 - Locator(fourthZone, FOURTHZONE_LEDS); - #endif - - #if ZONEFIVE == 1 - Locator(fifthZone, FIFTHZONE_LEDS); - #endif - - #if ZONESIX == 1 - Locator(sixthZone, SIXTHZONE_LEDS); - #endif - - } - if(effect == "Ripple") - { - - #if ZONEONE == 1 - Ripple(firstZone, FIRSTZONE_LEDS, center_firstZone, step_firstZone); - #endif - - #if ZONETWO == 1 - Ripple(secondZone, SECONDZONE_LEDS, center_secondZone, step_secondZone); - #endif - - #if ZONETHREE == 1 - Ripple(thirdZone, THIRDZONE_LEDS, center_thirdZone, step_thirdZone); - #endif - - #if ZONEFOUR == 1 - Ripple(fourthZone, FOURTHZONE_LEDS, center_fourthZone, step_fourthZone); - #endif + static byte zOneS1heat[ZONEONE_SECTION8_END-ZONEONE_SECTION8_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION8_START, ZONEONE_SECTION8_END, + zOneS1heat, ZONEONE_SECTION8_START_FIRE, ZONEONE_SECTION8_END_FIRE, 0); + #endif + #ifdef ZONEONE_SECTION9_START + static byte zOneS1heat[ZONEONE_SECTION9_END-ZONEONE_SECTION9_START]; + setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION9_START, ZONEONE_SECTION9_END, + zOneS1heat, ZONEONE_SECTION9_START_FIRE, ZONEONE_SECTION9_END_FIRE, 0); + #endif + } + else { + fill_solid(firstZone, FIRSTZONE_LEDS, CRGB::Black); + } + #endif - #if ZONEFIVE == 1 - Ripple(fifthZone, FIFTHZONE_LEDS, center_fifthZone, step_fifthZone); - #endif - - #if ZONESIX == 1 - Ripple(sixthZone, SIXTHZONE_LEDS, center_sixthZone, step_sixthZone); - #endif - } - if(effect == "Fire") - { - #if ZONEONE == 1 - #if FIRSTZONE_SECTIONS >= 1 - static byte z1s1heat[ZONEONE_SECTION1_END-ZONEONE_SECTION1_START]; - fire(firstZone, z1s1heat, ZONEONE_SECTION1_START, ZONEONE_SECTION1_END, ZONEONE_SECTION1_START_FIRE, ZONEONE_SECTION1_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 2 - static byte z1s2heat[ZONEONE_SECTION2_END-ZONEONE_SECTION2_START]; - fire(firstZone, z1s2heat, ZONEONE_SECTION2_START, ZONEONE_SECTION2_END, ZONEONE_SECTION2_START_FIRE, ZONEONE_SECTION2_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 3 - static byte z1s3heat[ZONEONE_SECTION3_END-ZONEONE_SECTION3_START]; - fire(firstZone, z1s3heat, ZONEONE_SECTION3_START, ZONEONE_SECTION3_END, ZONEONE_SECTION3_START_FIRE, ZONEONE_SECTION3_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 4 - static byte z1s4heat[ZONEONE_SECTION4_END-ZONEONE_SECTION4_START]; - fire(firstZone, z1s4heat, ZONEONE_SECTION4_START, ZONEONE_SECTION4_END, ZONEONE_SECTION4_START_FIRE, ZONEONE_SECTION4_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 5 - static byte z1s5heat[ZONEONE_SECTION5_END-ZONEONE_SECTION5_START]; - fire(firstZone, z1s5heat, ZONEONE_SECTION5_START, ZONEONE_SECTION5_END, ZONEONE_SECTION5_START_FIRE, ZONEONE_SECTION5_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 6 - static byte z1s6heat[ZONEONE_SECTION6_END-ZONEONE_SECTION6_START]; - fire(firstZone, z1s6heat, ZONEONE_SECTION6_START, ZONEONE_SECTION6_END, ZONEONE_SECTION6_START_FIRE, ZONEONE_SECTION6_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 7 - static byte z1s7heat[ZONEONE_SECTION7_END-ZONEONE_SECTION7_START]; - fire(firstZone, z1s7heat, ZONEONE_SECTION7_START, ZONEONE_SECTION7_END, ZONEONE_SECTION7_START_FIRE, ZONEONE_SECTION7_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 8 - static byte z1s8heat[ZONEONE_SECTION8_END-ZONEONE_SECTION8_START]; - fire(firstZone, z1s8heat, ZONEONE_SECTION8_START, ZONEONE_SECTION8_END, ZONEONE_SECTION8_START_FIRE, ZONEONE_SECTION8_END_FIRE); - #endif - #if FIRSTZONE_SECTIONS >= 9 - static byte z1s9heat[ZONEONE_SECTION9_END-ZONEONE_SECTION9_START]; - fire(firstZone, z1s9heat, ZONEONE_SECTION9_START, ZONEONE_SECTION9_END, ZONEONE_SECTION9_START_FIRE, ZONEONE_SECTION9_END_FIRE); - #endif + #if ZONETWO == 1 + if(showZoneLights[1] == true) + { + static Ball zone2balls[fireworkCount_secondZone]; + setZonePattern(secondZone, SECONDZONE_LEDS, previousLED_secondZone, zone2balls, fireworkCount_secondZone, center_secondZone, step_secondZone, 1); + + #ifdef ZONETWO_SECTION1_START + static byte zTwoS1heat[ZONETWO_SECTION1_END-ZONETWO_SECTION1_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION1_START, ZONETWO_SECTION1_END, + zTwoS1heat, ZONETWO_SECTION1_START_FIRE, ZONETWO_SECTION1_END_FIRE, 1); #endif - #if ZONETWO == 1 - #if SECONDZONE_SECTIONS >= 1 - static byte z2s1heat[ZONETWO_SECTION1_END-ZONETWO_SECTION1_START]; - fire(secondZone, z2s1heat, ZONETWO_SECTION1_START, ZONETWO_SECTION1_END, ZONETWO_SECTION1_START_FIRE, ZONETWO_SECTION1_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 2 - static byte z2s2heat[ZONETWO_SECTION2_END-ZONETWO_SECTION2_START]; - fire(secondZone, z2s2heat, ZONETWO_SECTION2_START, ZONETWO_SECTION2_END, ZONETWO_SECTION2_START_FIRE, ZONETWO_SECTION2_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 3 - static byte z2s3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; - fire(secondZone, z2s3heat, ZONETWO_SECTION3_START, ZONETWO_SECTION3_END, ZONETWO_SECTION3_START_FIRE, ZONETWO_SECTION3_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 4 - static byte z2s4heat[ZONETWO_SECTION4_END-ZONETWO_SECTION4_START]; - fire(secondZone, z2s4heat, ZONETWO_SECTION4_START, ZONETWO_SECTION4_END, ZONETWO_SECTION4_START_FIRE, ZONETWO_SECTION4_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 5 - static byte z2s5heat[ZONETWO_SECTION5_END-ZONETWO_SECTION5_START]; - fire(secondZone, z2s5heat, ZONETWO_SECTION5_START, ZONETWO_SECTION5_END, ZONETWO_SECTION5_START_FIRE, ZONETWO_SECTION5_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 6 - static byte z2s6heat[ZONETWO_SECTION6_END-ZONETWO_SECTION6_START]; - fire(secondZone, z2s6heat, ZONETWO_SECTION6_START, ZONETWO_SECTION6_END, ZONETWO_SECTION6_START_FIRE, ZONETWO_SECTION6_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 7 - static byte z2s7heat[ZONETWO_SECTION7_END-ZONETWO_SECTION7_START]; - fire(secondZone, z2s7heat, ZONETWO_SECTION7_START, ZONETWO_SECTION7_END, ZONETWO_SECTION7_START_FIRE, ZONETWO_SECTION7_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 8 - static byte z2s8heat[ZONETWO_SECTION8_END-ZONETWO_SECTION8_START]; - fire(secondZone, z2s8heat, ZONETWO_SECTION8_START, ZONETWO_SECTION8_END, ZONETWO_SECTION8_START_FIRE, ZONETWO_SECTION8_END_FIRE); - #endif - #if SECONDZONE_SECTIONS >= 9 - static byte z2s9heat[ZONETWO_SECTION9_END-ZONETWO_SECTION9_START]; - fire(secondZone, z2s9heat, ZONETWO_SECTION9_START, ZONETWO_SECTION9_END, ZONETWO_SECTION9_START_FIRE, ZONETWO_SECTION9_END_FIRE); - #endif + #ifdef ZONETWO_SECTION2_START + static byte zTwoS2heat[ZONETWO_SECTION2_END-ZONETWO_SECTION2_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION2_START, ZONETWO_SECTION2_END, + zTwoS2heat, ZONETWO_SECTION2_START_FIRE, ZONETWO_SECTION2_END_FIRE, 1); #endif - #if ZONETHREE == 1 - #if THIRDZONE_SECTIONS >= 1 - static byte z3s1heat[ZONETHREE_SECTION1_END-ZONETHREE_SECTION1_START]; - fire(thirdZone, z3s1heat, ZONETHREE_SECTION1_START, ZONETHREE_SECTION1_END, ZONETHREE_SECTION1_START_FIRE, ZONETHREE_SECTION1_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 2 - static byte z3s2heat[ZONETHREE_SECTION2_END-ZONETHREE_SECTION2_START]; - fire(thirdZone, z3s2heat, ZONETHREE_SECTION2_START, ZONETHREE_SECTION2_END, ZONETHREE_SECTION2_START_FIRE, ZONETHREE_SECTION2_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 3 - static byte z3s3heat[ZONETHREE_SECTION3_END-ZONETHREE_SECTION3_START]; - fire(thirdZone, z3s3heat, ZONETHREE_SECTION3_START, ZONETHREE_SECTION3_END, ZONETHREE_SECTION3_START_FIRE, ZONETHREE_SECTION3_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 4 - static byte z3s4heat[ZONETHREE_SECTION4_END-ZONETHREE_SECTION4_START]; - fire(thirdZone, z3s4heat, ZONETHREE_SECTION4_START, ZONETHREE_SECTION4_END, ZONETHREE_SECTION4_START_FIRE, ZONETHREE_SECTION4_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 5 - static byte z3s5heat[ZONETHREE_SECTION5_END-ZONETHREE_SECTION5_START]; - fire(thirdZone, z3s5heat, ZONETHREE_SECTION5_START, ZONETHREE_SECTION5_END, ZONETHREE_SECTION5_START_FIRE, ZONETHREE_SECTION5_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 6 - static byte z3s6heat[ZONETHREE_SECTION6_END-ZONETHREE_SECTION6_START]; - fire(thirdZone, z3s6heat, ZONETHREE_SECTION6_START, ZONETHREE_SECTION6_END, ZONETHREE_SECTION6_START_FIRE, ZONETHREE_SECTION6_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 7 - static byte z3s7heat[ZONETHREE_SECTION7_END-ZONETHREE_SECTION7_START]; - fire(thirdZone, z3s7heat, ZONETHREE_SECTION7_START, ZONETHREE_SECTION7_END, ZONETHREE_SECTION7_START_FIRE, ZONETHREE_SECTION7_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 8 - static byte z3s8heat[ZONETHREE_SECTION8_END-ZONETHREE_SECTION8_START]; - fire(thirdZone, z3s8heat, ZONETHREE_SECTION8_START, ZONETHREE_SECTION8_END, ZONETHREE_SECTION8_START_FIRE, ZONETHREE_SECTION8_END_FIRE); - #endif - #if THIRDZONE_SECTIONS >= 9 - static byte z3s9heat[ZONETHREE_SECTION9_END-ZONETHREE_SECTION9_START]; - fire(thirdZone, z3s9heat, ZONETHREE_SECTION9_START, ZONETHREE_SECTION9_END, ZONETHREE_SECTION9_START_FIRE, ZONETHREE_SECTION9_END_FIRE); - #endif + #ifdef ZONETWO_SECTION3_START + static byte zTwoS3heat[ZONETWO_SECTION3_END-ZONETWO_SECTION3_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION3_START, ZONETWO_SECTION3_END, + zTwoS3heat, ZONETWO_SECTION3_START_FIRE, ZONETWO_SECTION3_END_FIRE, 1); #endif - - #if ZONEFOUR == 1 - #if FOURTHZONE_SECTIONS >= 1 - static byte z4s1heat[ZONEFOUR_SECTION1_END-ZONEFOUR_SECTION1_START]; - fire(fourthZone, z4s1heat, ZONEFOUR_SECTION1_START, ZONEFOUR_SECTION1_END, ZONEFOUR_SECTION1_START_FIRE, ZONEFOUR_SECTION1_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 2 - static byte z4s2heat[ZONEFOUR_SECTION2_END-ZONEFOUR_SECTION2_START]; - fire(fourthZone, z4s2heat, ZONEFOUR_SECTION2_START, ZONEFOUR_SECTION2_END, ZONEFOUR_SECTION2_START_FIRE, ZONEFOUR_SECTION2_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 3 - static byte z4s3heat[ZONEFOUR_SECTION3_END-ZONEFOUR_SECTION3_START]; - fire(fourthZone, z4s3heat, ZONEFOUR_SECTION3_START, ZONEFOUR_SECTION3_END, ZONEFOUR_SECTION3_START_FIRE, ZONEFOUR_SECTION3_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 4 - static byte z4s4heat[ZONEFOUR_SECTION4_END-ZONEFOUR_SECTION4_START]; - fire(fourthZone, z4s4heat, ZONEFOUR_SECTION4_START, ZONEFOUR_SECTION4_END, ZONEFOUR_SECTION4_START_FIRE, ZONEFOUR_SECTION4_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 5 - static byte z4s5heat[ZONEFOUR_SECTION5_END-ZONEFOUR_SECTION5_START]; - fire(fourthZone, z4s5heat, ZONEFOUR_SECTION5_START, ZONEFOUR_SECTION5_END, ZONEFOUR_SECTION5_START_FIRE, ZONEFOUR_SECTION5_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 6 - static byte z4s6heat[ZONEFOUR_SECTION6_END-ZONEFOUR_SECTION6_START]; - fire(fourthZone, z4s6heat, ZONEFOUR_SECTION6_START, ZONEFOUR_SECTION6_END, ZONEFOUR_SECTION6_START_FIRE, ZONEFOUR_SECTION6_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 7 - static byte z4s7heat[ZONEFOUR_SECTION7_END-ZONEFOUR_SECTION7_START]; - fire(fourthZone, z4s7heat, ZONEFOUR_SECTION7_START, ZONEFOUR_SECTION7_END, ZONEFOUR_SECTION7_START_FIRE, ZONEFOUR_SECTION7_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 8 - static byte z4s8heat[ZONEFOUR_SECTION8_END-ZONEFOUR_SECTION8_START]; - fire(fourthZone, z4s8heat, ZONEFOUR_SECTION8_START, ZONEFOUR_SECTION8_END, ZONEFOUR_SECTION8_START_FIRE, ZONEFOUR_SECTION8_END_FIRE); - #endif - #if FOURTHZONE_SECTIONS >= 9 - static byte z4s9heat[ZONEFOUR_SECTION9_END-ZONEFOUR_SECTION9_START]; - fire(fourthZone, z4s9heat, ZONEFOUR_SECTION9_START, ZONEFOUR_SECTION9_END, ZONEFOUR_SECTION9_START_FIRE, ZONEFOUR_SECTION9_END_FIRE); - #endif + #ifdef ZONETWO_SECTION4_START + static byte zTwoS4heat[ZONETWO_SECTION4_END-ZONETWO_SECTION4_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION4_START, ZONETWO_SECTION4_END, + zTwoS4heat, ZONETWO_SECTION4_START_FIRE, ZONETWO_SECTION4_END_FIRE, 1); #endif - - #if ZONEFIVE == 1 - #if FIFTHZONE_SECTIONS >= 1 - static byte z5s1heat[ZONEFIVE_SECTION1_END-ZONEFIVE_SECTION1_START]; - fire(fifthZone, z5s1heat, ZONEFIVE_SECTION1_START, ZONEFIVE_SECTION1_END, ZONEFIVE_SECTION1_START_FIRE, ZONEFIVE_SECTION1_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 2 - static byte z5s2heat[ZONEFIVE_SECTION2_END-ZONEFIVE_SECTION2_START]; - fire(fifthZone, z5s2heat, ZONEFIVE_SECTION2_START, ZONEFIVE_SECTION2_END, ZONEFIVE_SECTION2_START_FIRE, ZONEFIVE_SECTION2_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 3 - static byte z5s3heat[ZONEFIVE_SECTION3_END-ZONEFIVE_SECTION3_START]; - fire(fifthZone, z5s3heat, ZONEFIVE_SECTION3_START, ZONEFIVE_SECTION3_END, ZONEFIVE_SECTION3_START_FIRE, ZONEFIVE_SECTION3_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 4 - static byte z5s4heat[ZONEFIVE_SECTION4_END-ZONEFIVE_SECTION4_START]; - fire(fifthZone, z5s4heat, ZONEFIVE_SECTION4_START, ZONEFIVE_SECTION4_END, ZONEFIVE_SECTION4_START_FIRE, ZONEFIVE_SECTION4_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 5 - static byte z5s5heat[ZONEFIVE_SECTION5_END-ZONEFIVE_SECTION5_START]; - fire(fifthZone, z5s5heat, ZONEFIVE_SECTION5_START, ZONEFIVE_SECTION5_END, ZONEFIVE_SECTION5_START_FIRE, ZONEFIVE_SECTION5_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 6 - static byte z5s6heat[ZONEFIVE_SECTION6_END-ZONEFIVE_SECTION6_START]; - fire(fifthZone, z5s6heat, ZONEFIVE_SECTION6_START, ZONEFIVE_SECTION6_END, ZONEFIVE_SECTION6_START_FIRE, ZONEFIVE_SECTION6_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 7 - static byte z5s7heat[ZONEFIVE_SECTION7_END-ZONEFIVE_SECTION7_START]; - fire(fifthZone, z5s7heat, ZONEFIVE_SECTION7_START, ZONEFIVE_SECTION7_END, ZONEFIVE_SECTION7_START_FIRE, ZONEFIVE_SECTION7_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 8 - static byte z5s8heat[ZONEFIVE_SECTION8_END-ZONEFIVE_SECTION8_START]; - fire(fifthZone, z5s8heat, ZONEFIVE_SECTION8_START, ZONEFIVE_SECTION8_END, ZONEFIVE_SECTION8_START_FIRE, ZONEFIVE_SECTION8_END_FIRE); - #endif - #if FIFTHZONE_SECTIONS >= 9 - static byte z5s9heat[ZONEFIVE_SECTION9_END-ZONEFIVE_SECTION9_START]; - fire(fifthZone, z5s9heat, ZONEFIVE_SECTION9_START, ZONEFIVE_SECTION9_END, ZONEFIVE_SECTION9_START_FIRE, ZONEFIVE_SECTION9_END_FIRE); - #endif + #ifdef ZONETWO_SECTION5_START + static byte zTwoS5heat[ZONETWO_SECTION5_END-ZONETWO_SECTION5_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION5_START, ZONETWO_SECTION5_END, + zTwoS5heat, ZONETWO_SECTION5_START_FIRE, ZONETWO_SECTION5_END_FIRE, 1); #endif - - #if ZONESIX == 1 - #if SIXTHZONE_SECTIONS >= 1 - static byte z6s1heat[ZONESIX_SECTION1_END-ZONESIX_SECTION1_START]; - fire(sixthZone, z6s1heat, ZONESIX_SECTION1_START, ZONESIX_SECTION1_END, ZONESIX_SECTION1_START_FIRE, ZONESIX_SECTION1_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 2 - static byte z6s2heat[ZONESIX_SECTION2_END-ZONESIX_SECTION2_START]; - fire(sixthZone, z6s2heat, ZONESIX_SECTION2_START, ZONESIX_SECTION2_END, ZONESIX_SECTION2_START_FIRE, ZONESIX_SECTION2_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 3 - static byte z6s3heat[ZONESIX_SECTION3_END-ZONESIX_SECTION3_START]; - fire(sixthZone, z6s3heat, ZONESIX_SECTION3_START, ZONESIX_SECTION3_END, ZONESIX_SECTION3_START_FIRE, ZONESIX_SECTION3_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 4 - static byte z6s4heat[ZONESIX_SECTION4_END-ZONESIX_SECTION4_START]; - fire(sixthZone, z6s4heat, ZONESIX_SECTION4_START, ZONESIX_SECTION4_END, ZONESIX_SECTION4_START_FIRE, ZONESIX_SECTION4_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 5 - static byte z6s5heat[ZONESIX_SECTION5_END-ZONESIX_SECTION5_START]; - fire(sixthZone, z6s5heat, ZONESIX_SECTION5_START, ZONESIX_SECTION5_END, ZONESIX_SECTION5_START_FIRE, ZONESIX_SECTION5_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 6 - static byte z6s6heat[ZONESIX_SECTION6_END-ZONESIX_SECTION6_START]; - fire(sixthZone, z6s6heat, ZONESIX_SECTION6_START, ZONESIX_SECTION6_END, ZONESIX_SECTION6_START_FIRE, ZONESIX_SECTION6_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 7 - static byte z6s7heat[ZONESIX_SECTION7_END-ZONESIX_SECTION7_START]; - fire(sixthZone, z6s7heat, ZONESIX_SECTION7_START, ZONESIX_SECTION7_END, ZONESIX_SECTION7_START_FIRE, ZONESIX_SECTION7_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 8 - static byte z6s8heat[ZONESIX_SECTION8_END-ZONESIX_SECTION8_START]; - fire(sixthZone, z6s8heat, ZONESIX_SECTION8_START, ZONESIX_SECTION8_END, ZONESIX_SECTION8_START_FIRE, ZONESIX_SECTION8_END_FIRE); - #endif - #if SIXTHZONE_SECTIONS >= 9 - static byte z6s9heat[ZONESIX_SECTION9_END-ZONESIX_SECTION9_START]; - fire(sixthZone, z6s9heat, ZONESIX_SECTION9_START, ZONESIX_SECTION9_END, ZONESIX_SECTION9_START_FIRE, ZONESIX_SECTION9_END_FIRE); - #endif + #ifdef ZONETWO_SECTION6_START + static byte zTwoS6heat[ZONETWO_SECTION6_END-ZONETWO_SECTION6_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION6_START, ZONETWO_SECTION6_END, + zTwoS6heat, ZONETWO_SECTION6_START_FIRE, ZONETWO_SECTION6_END_FIRE, 1); + #endif + #ifdef ZONETWO_SECTION7_START + static byte zTwoS7heat[ZONETWO_SECTION7_END-ZONETWO_SECTION7_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION7_START, ZONETWO_SECTION7_END, + zTwoS7heat, ZONETWO_SECTION7_START_FIRE, ZONETWO_SECTION7_END_FIRE, 1); + #endif + #ifdef ZONETWO_SECTION8_START + static byte zOneS8heat[ZONETWO_SECTION8_END-ZONETWO_SECTION8_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION8_START, ZONETWO_SECTION8_END, + zTwoS8heat, ZONETWO_SECTION8_START_FIRE, ZONETWO_SECTION8_END_FIRE, 1); + #endif + #ifdef ZONETWO_SECTION9_START + static byte zTwoS9heat[ZONETWO_SECTION9_END-ZONETWO_SECTION9_START]; + setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION9_START, ZONETWO_SECTION9_END, + zTwoS9heat, ZONETWO_SECTION9_START_FIRE, ZONETWO_SECTION9_END_FIRE, 1); #endif } - } - if(showLights == false) - { - #if ZONEONE == 1 - fill_solid(firstZone, FIRSTZONE_LEDS, CRGB::Black); - #endif + else { + fill_solid(secondZone, SECONDZONE_LEDS, CRGB::Black); + } + #endif - #if ZONETWO == 1 - fill_solid(secondZone, SECONDZONE_LEDS, CRGB::Black); - #endif + #if ZONETHREE == 1 + if(showZoneLights[2] == true) + { + static Ball zone3balls[fireworkCount_thirdZone]; + setZonePattern(thirdZone, THIRDZONE_LEDS, previousLED_thirdZone, zone3balls, fireworkCount_thirdZone, center_thirdZone, step_thirdZone, 2); - #if ZONETHREE == 1 - fill_solid(thirdZone, THIRDZONE_LEDS, CRGB::Black); - #endif + #ifdef ZONETHREE_SECTION1_START + static byte zThreeS1heat[ZONETHREE_SECTION1_END-ZONETHREE_SECTION1_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION1_START, ZONETHREE_SECTION1_END, + zThreeS1heat, ZONETHREE_SECTION1_START_FIRE, ZONETHREE_SECTION1_END_FIRE, 2); + #endif + #ifdef ZONETHREE_SECTION2_START + static byte zThreeS2heat[ZONETHREE_SECTION2_END-ZONETHREE_SECTION2_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION2_START, ZONETHREE_SECTION2_END, + zThreeS2heat, ZONETHREE_SECTION2_START_FIRE, ZONETHREE_SECTION2_END_FIRE, 2); + #endif + #ifdef ZONETHREE_SECTION3_START + static byte zThreeS3heat[ZONETHREE_SECTION3_END-ZONETHREE_SECTION3_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION3_START, ZONETHREE_SECTION3_END, + zThreeS3heat, ZONETHREE_SECTION3_START_FIRE, ZONETHREE_SECTION3_END_FIRE, 2); + #endif + #ifdef ZONETHREE_SECTION4_START + static byte zThreeS4heat[ZONETHREE_SECTION4_END-ZONETHREE_SECTION4_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION4_START, ZONETHREE_SECTION4_END, + zThreeS4heat, ZONETHREE_SECTION4_START_FIRE, ZONETHREE_SECTION4_END_FIRE, 2); + #endif + #ifdef ZONETHREE_SECTION5_START + static byte zThreeS5heat[ZONETHREE_SECTION5_END-ZONETHREE_SECTION5_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION5_START, ZONETHREE_SECTION5_END, + zThreeS5heat, ZONETHREE_SECTION5_START_FIRE, ZONETHREE_SECTION5_END_FIRE, 2); + #endif + #ifdef ZONETHREE_SECTION6_START + static byte zThreeS6heat[ZONETHREE_SECTION6_END-ZONETHREE_SECTION6_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION6_START, ZONETHREE_SECTION6_END, + zThreeS6heat, ZONETHREE_SECTION6_START_FIRE, ZONETHREE_SECTION6_END_FIRE, 2); + #endif + #ifdef ZONETHREE_SECTION7_START + static byte zThreeS7heat[ZONETHREE_SECTION7_END-ZONETHREE_SECTION7_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION7_START, ZONETHREE_SECTION7_END, + zThreeS7heat, ZONETHREE_SECTION7_START_FIRE, ZONETHREE_SECTION7_END_FIRE, 2); + #endif + #ifdef ZONETHREE_SECTION8_START + static byte zThreeS8heat[ZONETHREE_SECTION8_END-ZONETHREE_SECTION8_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION8_START, ZONETHREE_SECTION8_END, + zThreeS8heat, ZONETHREE_SECTION8_START_FIRE, ZONETHREE_SECTION8_END_FIRE, 2); + #endif + #ifdef ZONETHREE_SECTION9_START + static byte zThreeS9heat[ZONETHREE_SECTION9_END-ZONETHREE_SECTION9_START]; + setSectionPattern(thirdZone, THIRDZONE_LEDS, ZONETHREE_SECTION9_START, ZONETHREE_SECTION9_END, + zThreeS9heat, ZONETHREE_SECTION9_START_FIRE, ZONETHREE_SECTION9_END_FIRE, 2); + #endif + } + else { + fill_solid(thirdZone, THIRDZONE_LEDS, CRGB::Black); + } + #endif - #if ZONEFOUR == 1 - fill_solid(fourthZone, FOURTHZONE_LEDS, CRGB::Black); - #endif + #if ZONEFOUR == 1 + if(showZoneLights[3] == true) + { + static Ball zone4balls[fireworkCount_fourthZone]; + setZonePattern(fourthZone, FOURTHZONE_LEDS, previousLED_fourthZone, zone4balls, fireworkCount_fourthZone, center_fourthZone, step_fourthZone, 3); + + #ifdef ZONEFOUR_SECTION1_START + static byte zFourS1heat[ZONEFOUR_SECTION1_END-ZONEFOUR_SECTION1_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION1_START, ZONEFOUR_SECTION1_END, + zFourS1heat, ZONEFOUR_SECTION1_START_FIRE, ZONEFOUR_SECTION1_END_FIRE, 3); + #endif + #ifdef ZONEFOUR_SECTION2_START + static byte zFourS2heat[ZONEFOUR_SECTION2_END-ZONEFOUR_SECTION2_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION2_START, ZONEFOUR_SECTION2_END, + zFourS2heat, ZONEFOUR_SECTION2_START_FIRE, ZONEFOUR_SECTION2_END_FIRE, 3); + #endif + #ifdef ZONEFOUR_SECTION3_START + static byte zFourS3heat[ZONEFOUR_SECTION3_END-ZONEFOUR_SECTION3_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION3_START, ZONEFOUR_SECTION3_END, + zFourS3heat, ZONEFOUR_SECTION3_START_FIRE, ZONEFOUR_SECTION3_END_FIRE, 3); + #endif + #ifdef ZONEFOUR_SECTION4_START + static byte zFourS4heat[ZONEFOUR_SECTION4_END-ZONEFOUR_SECTION4_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION4_START, ZONEFOUR_SECTION4_END, + zFourS4heat, ZONEFOUR_SECTION4_START_FIRE, ZONEFOUR_SECTION4_END_FIRE, 3); + #endif + #ifdef ZONEFOUR_SECTION5_START + static byte zFourS5heat[ZONEFOUR_SECTION5_END-ZONEFOUR_SECTION5_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION5_START, ZONEFOUR_SECTION5_END, + zFourS5heat, ZONEFOUR_SECTION5_START_FIRE, ZONEFOUR_SECTION5_END_FIRE, 3); + #endif + #ifdef ZONEFOUR_SECTION6_START + static byte zFourS6heat[ZONEFOUR_SECTION6_END-ZONEFOUR_SECTION6_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION6_START, ZONEFOUR_SECTION6_END, + zFourS6heat, ZONEFOUR_SECTION6_START_FIRE, ZONEFOUR_SECTION6_END_FIRE, 3); + #endif + #ifdef ZONEFOUR_SECTION7_START + static byte zFourS7heat[ZONEFOUR_SECTION7_END-ZONEFOUR_SECTION7_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION7_START, ZONEFOUR_SECTION7_END, + zFourS7heat, ZONEFOUR_SECTION7_START_FIRE, ZONEFOUR_SECTION7_END_FIRE, 3); + #endif + #ifdef ZONEFOUR_SECTION8_START + static byte zFourS8heat[ZONEFOUR_SECTION8_END-ZONEFOUR_SECTION8_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION8_START, ZONEFOUR_SECTION8_END, + zFourS8heat, ZONEFOUR_SECTION8_START_FIRE, ZONEFOUR_SECTION8_END_FIRE, 3); + #endif + #ifdef ZONEFOUR_SECTION9_START + static byte zFourS9heat[ZONEFOUR_SECTION9_END-ZONEFOUR_SECTION9_START]; + setSectionPattern(fourthZone, FOURTHZONE_LEDS, ZONEFOUR_SECTION9_START, ZONEFOUR_SECTION9_END, + zFourS9heat, ZONEFOUR_SECTION9_START_FIRE, ZONEFOUR_SECTION9_END_FIRE, 3); + #endif + } + else { + fill_solid(fourthZone, FOURTHZONE_LEDS, CRGB::Black); + } + #endif - #if ZONEFIVE == 1 - fill_solid(fifthZone, FIFTHZONE_LEDS, CRGB::Black); - #endif + #if ZONEFIVE == 1 + if(showZoneLights[4] == true) + { + static Ball zone5balls[fireworkCount_fifthZone]; + setZonePattern(fifthZone, FIFTHZONE_LEDS, previousLED_fifthZone, zone5balls, fireworkCount_fifthZone, center_fifthZone, step_fifthZone, 4); + + #ifdef ZONEFIVE_SECTION1_START + static byte zFiveS1heat[ZONEFIVE_SECTION1_END-ZONEFIVE_SECTION1_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION1_START, ZONEFIVE_SECTION1_END, + zFiveS1heat, ZONEFIVE_SECTION1_START_FIRE, ZONEFIVE_SECTION1_END_FIRE, 4); + #endif + #ifdef ZONEFIVE_SECTION2_START + static byte zFiveS2heat[ZONEFIVE_SECTION2_END-ZONEFIVE_SECTION2_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION2_START, ZONEFIVE_SECTION2_END, + zFiveS2heat, ZONEFIVE_SECTION2_START_FIRE, ZONEFIVE_SECTION2_END_FIRE, 4); + #endif + #ifdef ZONEFIVE_SECTION3_START + static byte zFiveS3heat[ZONEFIVE_SECTION3_END-ZONEFIVE_SECTION3_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION3_START, ZONEFIVE_SECTION3_END, + zFiveS3heat, ZONEFIVE_SECTION3_START_FIRE, ZONEFIVE_SECTION3_END_FIRE, 4); + #endif + #ifdef ZONEFIVE_SECTION4_START + static byte zFiveS4heat[ZONEFIVE_SECTION4_END-ZONEFIVE_SECTION4_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION4_START, ZONEFIVE_SECTION4_END, + zFiveS4heat, ZONEFIVE_SECTION4_START_FIRE, ZONEFIVE_SECTION4_END_FIRE, 4); + #endif + #ifdef ZONEFIVE_SECTION5_START + static byte zFiveS5heat[ZONEFIVE_SECTION5_END-ZONEFIVE_SECTION5_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION5_START, ZONEFIVE_SECTION5_END, + zFiveS5heat, ZONEFIVE_SECTION5_START_FIRE, ZONEFIVE_SECTION5_END_FIRE, 4); + #endif + #ifdef ZONEFIVE_SECTION6_START + static byte zFiveS6heat[ZONEFIVE_SECTION6_END-ZONEFIVE_SECTION6_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION6_START, ZONEFIVE_SECTION6_END, + zFiveS6heat, ZONEFIVE_SECTION6_START_FIRE, ZONEFIVE_SECTION6_END_FIRE, 4); + #endif + #ifdef ZONEFIVE_SECTION7_START + static byte zFiveS7heat[ZONEFIVE_SECTION7_END-ZONEFIVE_SECTION7_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION7_START, ZONEFIVE_SECTION7_END, + zFiveS7heat, ZONEFIVE_SECTION7_START_FIRE, ZONEFIVE_SECTION7_END_FIRE, 4); + #endif + #ifdef ZONEFIVE_SECTION8_START + static byte zFiveS8heat[ZONEFIVE_SECTION8_END-ZONEFIVE_SECTION8_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION8_START, ZONEFIVE_SECTION8_END, + zFiveS8heat, ZONEFIVE_SECTION8_START_FIRE, ZONEFIVE_SECTION8_END_FIRE, 4); + #endif + #ifdef ZONEFIVE_SECTION9_START + static byte zFiveS9heat[ZONEFIVE_SECTION9_END-ZONEFIVE_SECTION9_START]; + setSectionPattern(fifthZone, FIFTHZONE_LEDS, ZONEFIVE_SECTION9_START, ZONEFIVE_SECTION9_END, + zFiveS9heat, ZONEFIVE_SECTION9_START_FIRE, ZONEFIVE_SECTION9_END_FIRE, 4); + #endif + } + else { + fill_solid(fifthZone, FIFTHZONE_LEDS, CRGB::Black); + } + #endif - #if ZONESIX == 1 - fill_solid(sixthZone, SIXTHZONE_LEDS, CRGB::Black); - #endif - } + #if ZONESIX == 1 + if(showZoneLights[5] == true) + { + static Ball zone6balls[fireworkCount_sixthZone]; + setZonePattern(sixthZone, SIXTHZONE_LEDS, previousLED_sixthZone, zone6balls, fireworkCount_sixthZone, center_sixthZone, step_sixthZone, 5); + + #ifdef ZONESIX_SECTION1_START + static byte zSixS1heat[ZONESIX_SECTION1_END-ZONESIX_SECTION1_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION1_START, ZONESIX_SECTION1_END, + zSixS1heat, ZONESIX_SECTION1_START_FIRE, ZONESIX_SECTION1_END_FIRE, 5); + #endif + #ifdef ZONESIX_SECTION2_START + static byte zSixS2heat[ZONESIX_SECTION2_END-ZONESIX_SECTION2_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION2_START, ZONESIX_SECTION2_END, + zSixS2heat, ZONESIX_SECTION2_START_FIRE, ZONESIX_SECTION2_END_FIRE, 5); + #endif + #ifdef ZONESIX_SECTION3_START + static byte zSixS3heat[ZONESIX_SECTION3_END-ZONESIX_SECTION3_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION3_START, ZONESIX_SECTION3_END, + zSixS3heat, ZONESIX_SECTION3_START_FIRE, ZONESIX_SECTION3_END_FIRE, 5); + #endif + #ifdef ZONESIX_SECTION4_START + static byte zSixS4heat[ZONESIX_SECTION4_END-ZONESIX_SECTION4_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION4_START, ZONESIX_SECTION4_END, + zSixS4heat, ZONESIX_SECTION4_START_FIRE, ZONESIX_SECTION4_END_FIRE, 5); + #endif + #ifdef ZONESIX_SECTION5_START + static byte zSixS5heat[ZONESIX_SECTION5_END-ZONESIX_SECTION5_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION5_START, ZONESIX_SECTION5_END, + zSixS5heat, ZONESIX_SECTION5_START_FIRE, ZONESIX_SECTION5_END_FIRE, 5); + #endif + #ifdef ZONESIX_SECTION6_START + static byte zSixS6heat[ZONESIX_SECTION6_END-ZONESIX_SECTION6_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION6_START, ZONESIX_SECTION6_END, + zSixS6heat, ZONESIX_SECTION6_START_FIRE, ZONESIX_SECTION6_END_FIRE, 5); + #endif + #ifdef ZONESIX_SECTION7_START + static byte zSixS7heat[ZONESIX_SECTION7_END-ZONESIX_SECTION7_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION7_START, ZONESIX_SECTION7_END, + zSixS7heat, ZONESIX_SECTION7_START_FIRE, ZONESIX_SECTION7_END_FIRE, 5); + #endif + #ifdef ZONESIX_SECTION8_START + static byte zSixS8heat[ZONESIX_SECTION8_END-ZONESIX_SECTION8_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION8_START, ZONESIX_SECTION8_END, + zSixS8heat, ZONESIX_SECTION8_START_FIRE, ZONESIX_SECTION8_END_FIRE, 5); + #endif + #ifdef ZONESIX_SECTION9_START + static byte zSixS9heat[ZONESIX_SECTION9_END-ZONESIX_SECTION9_START]; + setSectionPattern(sixthZone, SIXTHZONE_LEDS, ZONESIX_SECTION9_START, ZONESIX_SECTION9_END, + zSixS9heat, ZONESIX_SECTION9_START_FIRE, ZONESIX_SECTION9_END_FIRE, 5); + #endif + } + else + { + fill_solid(sixthZone, SIXTHZONE_LEDS, CRGB::Black); + } + #endif + addGlitter(); addLightning(); } @@ -1993,47 +1804,56 @@ void setupZones() { #if ZONEONE == 1 FastLED.addLeds(firstZone, FIRSTZONE_LEDS); + timer.setTimeout(10000, chase, (void *)0); #endif #if ZONETWO == 1 FastLED.addLeds(secondZone, SECONDZONE_LEDS); + timer.setTimeout(10000, chase, (void *)1); #endif #if ZONETHREE == 1 FastLED.addLeds(thirdZone, THIRDZONE_LEDS); + timer.setTimeout(10000, chase, (void *)2); #endif #if ZONEFOUR == 1 FastLED.addLeds(fourthZone, FOURTHZONE_LEDS); + timer.setTimeout(10000, chase, (void *)3); #endif #if ZONEFIVE == 1 FastLED.addLeds(fifthZone, FIFTHZONE_LEDS); + timer.setTimeout(10000, chase, (void *)4); #endif #if ZONESIX == 1 FastLED.addLeds(sixthZone, SIXTHZONE_LEDS); + timer.setTimeout(10000, chase, (void *)5); #endif } void locator_Move() { - if(effect == "LED_Locator") + if(locatorLED <= maxLEDs) { - if(locatorLED <= maxLEDs) - { - String temp_str = String(locatorLED); - temp_str.toCharArray(MQTT_locatorLED, temp_str.length() + 1); - client.publish(USER_MQTT_CLIENT_NAME"/locator", MQTT_locatorLED); - locatorLED++; - } - else - { - locatorLED = 0; - } - timer.setTimeout(locatorDelay, locator_Move); + String temp_str = String(locatorLED); + temp_str.toCharArray(MQTT_locatorLED, temp_str.length() + 1); + client.publish(USER_MQTT_CLIENT_NAME"/locator", MQTT_locatorLED); + locatorLED++; + } + else + { + locatorLED = 0; + } + for (byte i = 0; i < 6; i = i + 1) { + if(zoneEffects[i] != "LED_Locator") + { + return; + } } + timer.setTimeout(locatorDelay, locator_Move); } @@ -2056,9 +1876,7 @@ void setup() { gPal = HeatColors_p; - timer.setTimeout(10000, chase); timer.setTimeout(120000, checkIn); - } @@ -2072,7 +1890,16 @@ void loop() reconnect(); } client.loop(); - if(showLights == false) + + bool canUpdate = true; + for (byte i = 0; i < 6; i = i + 1) { + if (showZoneLights[i] == true) + { + canUpdate = false; + } + } + + if(canUpdate == true) { ArduinoOTA.handle(); } @@ -2109,7 +1936,7 @@ void loop() /***************** Animation Functions ****************************************/ -void Ripple(CRGB zone[], int ledCount, int zoneCenter, int zoneStep) +int Ripple(CRGB zone[], int ledCount, int zoneCenter, int zoneStep) { for (int i = 0; i < ledCount; i++) { @@ -2134,9 +1961,10 @@ void Ripple(CRGB zone[], int ledCount, int zoneCenter, int zoneStep) zoneStep ++; break; } + return zoneStep; } -void rGB(CRGB zone[], int zoneLEDS) +void rGB(CRGB zone[], int zoneLEDS, uint8_t startPosition) { if(startPosition < 6) { @@ -2189,7 +2017,7 @@ void rGB(CRGB zone[], int zoneLEDS) } } -void ColorGlitter(CRGB zone[], int zoneLEDS, fract8 chanceOfGlitter) +void ColorGlitter(CRGB zone[], int zoneLEDS, fract8 chanceOfGlitter, uint8_t startPosition) { fadeToBlackBy( zone, zoneLEDS, 2); if(startPosition == 0) @@ -2236,7 +2064,7 @@ void ColorGlitter(CRGB zone[], int zoneLEDS, fract8 chanceOfGlitter) } } -int SingleRace(CRGB zone[], int zoneLEDS, int previousZoneLED) +int SingleRace(CRGB zone[], int zoneLEDS, int previousZoneLED, int raceSpeed) { fadeToBlackBy( zone, zoneLEDS, 1); int pos = beatsin16( raceSpeed, 0, zoneLEDS); @@ -2251,19 +2079,19 @@ int SingleRace(CRGB zone[], int zoneLEDS, int previousZoneLED) return pos; } -void Crash(CRGB zone[], int zoneLEDS, int sectionStart, int sectionEnd) +void Crash(CRGB zone[], int zoneLEDS, int sectionStart, int sectionEnd, int raceSpeed) { int pos = beatsin16( raceSpeed, 0, (sectionEnd - sectionStart) ); zone[sectionStart + pos] = CRGB(red1,green1,blue1); zone[sectionEnd - pos] = CRGB(red2,green2,blue2); } -void Rainbow(CRGB zone[], int zoneLEDS) +void Rainbow(CRGB zone[], int zoneLEDS, uint8_t numberOfRainbows) { fill_rainbow( zone, zoneLEDS, gHue, numberOfRainbows); } -void Blocked(CRGB zone[], int zoneLEDS) +void Blocked(CRGB zone[], int zoneLEDS, uint8_t startPosition) { fadeToBlackBy( zone, zoneLEDS, 2); for( int mark = 0; mark < zoneLEDS; mark+=30) @@ -2319,7 +2147,7 @@ void Blocked(CRGB zone[], int zoneLEDS) } } -void BPM(CRGB zone[], int zoneLEDS) +void BPM(CRGB zone[], int zoneLEDS, int BeatsPerMinute) { if((red1*2) > (green1 + blue1)) { @@ -2359,7 +2187,7 @@ void BPM(CRGB zone[], int zoneLEDS) } } -void Twinkle(CRGB zone[], int zoneLEDS) +void Twinkle(CRGB zone[], int zoneLEDS, int twinkleChance) { fadeToBlackBy( zone, zoneLEDS, 80); for( int i = 0; i < zoneLEDS-5; i+=5) @@ -2378,7 +2206,7 @@ void Twinkle(CRGB zone[], int zoneLEDS) } } -void Eyes(CRGB zone[], int zoneLEDS) +void Eyes(CRGB zone[], int zoneLEDS, int eyeChance) { unsigned int chance = random8(); if( chance > eyeChance) @@ -2407,7 +2235,7 @@ void Locator(CRGB zone[], int zoneLEDS) } } -void fire(CRGB zone[], byte heat[], int sectionStart, int sectionEnd, int fireStart, int fireEnd) +void fire(CRGB zone[], byte heat[], int sectionStart, int sectionEnd, int fireStart, int fireEnd, int firesize) { int sizeOfSection = sectionEnd - sectionStart; for( int i = 0; i < sizeOfSection; i++) @@ -2448,3 +2276,147 @@ void fire(CRGB zone[], byte heat[], int sectionStart, int sectionEnd, int fireSt } } } + +void heartbeat(CRGB zone[], int zoneLEDS, uint8_t startPosition) { + if(startPosition == 1 || startPosition == 3) { + fill_solid(zone, zoneLEDS, CRGB(red1, green1, blue1)); + } else { + fill_solid(zone, zoneLEDS, CRGB(red1/2, green1/2, blue1/2)); + } +} + +void threeSolid(CRGB zone[], int zoneLEDS) +{ + for(int pixel = 0; pixel < zoneLEDS; pixel+=12) + { + if(pixel <= zoneLEDS) + zone[pixel] = CRGB(red1,green1,blue1); + if(pixel+4 <= zoneLEDS) + zone[pixel+3] = CRGB(red2,green2,blue2); + if(pixel+8 <= zoneLEDS) + zone[pixel+6] = CRGB(red3,green3,blue3); + } +} + +void fireworks(CRGB zone[], int zoneLEDS, Ball balls[], int fireworkCount, uint8_t chance) { + + const float ballVelocityDecay = 0.0036; + + for (uint8_t i = 0; i < fireworkCount; i++) { + // initialize if not loaded + if(!balls[i].loaded) + { + balls[i].position = -1; + balls[i].exploding = 0; + switch(random8(3)) + { + case 0: + balls[i].color = CRGB(red1,green1,blue1); + break; + case 1: + balls[i].color = CRGB(red2,green2,blue2); + break; + case 2: + balls[i].color = CRGB(red3,green3,blue3); + break; + } + balls[i].reverse = random8(2) == 0; + balls[i].loaded = true; + } + + // launch firework + if(balls[i].position < 0 && random8() < chance) { + if(balls[i].reverse) + { + zone[zoneLEDS] += CHSV(0, 0, 128); + balls[i].position = zoneLEDS; + balls[i].velocity = -1.0; + } + else { + zone[0] += CHSV(0, 0, 128); + balls[i].position = 0; + balls[i].velocity = 1.0; + } + } + else if (balls[i].exploding < 1 && balls[i].position > 15 + && balls[i].position < zoneLEDS - 15 && random8(1,80) == 2) { + // detonate firework + balls[i].exploding = 1; + } + + // update + if (balls[i].position >= 0) { + uint8_t exploding = balls[i].exploding; + + if (exploding == 0) { + balls[i].position += balls[i].velocity; + balls[i].velocity -= ballVelocityDecay; + if (balls[i].position >= zoneLEDS) { + balls[i].velocity *= -1.0; + balls[i].position = zoneLEDS - 1; + } + else if (balls[i].position <= 0) { + balls[i].velocity = 1.0; + balls[i].position = 1; + } + } + + // draw + if (exploding == 0) { + zone[(uint8_t) balls[i].position] += CHSV(0, 0, 16); + } + else if (exploding == 1) { + zone[(uint8_t) balls[i].position] += CRGB::White; + balls[i].exploding++; + balls[i].velocity = 1; + balls[i].particlePosition = 50; + } + else if (exploding == 2) { + int16_t explosionPosition = balls[i].position; + int pos = map(balls[i].particlePosition, 50, 0, 1, 5); + int particles = 2; + if(pos > 3) { particles = 4; } + for (uint8_t j = 0; j < particles; j++) { + + int topPos = explosionPosition+(j*pos); + if(topPos <= zoneLEDS) + { + zone[topPos] = balls[i].color; + } + int bottomPos = explosionPosition-(j*pos); + if(bottomPos >= 0) + { + zone[bottomPos] = balls[i].color; + } + } + if( balls[i].particlePosition >= 0) + { + balls[i].particlePosition -= balls[i].velocity; + } + else + { + balls[i].exploding++; + } + if(balls[i].velocity > 0) + { + balls[i].velocity -= .01; + } + } + else { + balls[i].exploding = 0; + balls[i].position = -1; + balls[i].reverse = random8(2) == 0; + switch(random8(3)) + { + case 0: + balls[i].color = CRGB(red1,green1,blue1); + break; + case 1: + balls[i].color = CRGB(red2,green2,blue2); + break; + case 2: + balls[i].color = CRGB(red3,green3,blue3); + break; + } + } + } From bcd6841005b3fa20ea1c939fe1981127882323a4 Mon Sep 17 00:00:00 2001 From: zskullz Date: Thu, 24 Sep 2020 23:10:42 -0600 Subject: [PATCH 5/7] Add HA YAML example for zone control --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/README.md b/README.md index ddef65c..4d1cb03 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,58 @@ light: white_value_state_topic: "[MQTT_CLIENT_ID]/lightningChanceState" white_value_scale: 500 retain: true + - platform: mqtt + name: "Holiday Lights Zone 1" + command_topic: "[MQTT_CLIENT_ID]/power/Zone1" + state_topic: "[MQTT_CLIENT_ID]/powerState/Zone1" + brightness_command_topic: "[MQTT_CLIENT_ID]/brightness/Zone1" + brightness_state_topic: "[MQTT_CLIENT_ID]/brightnessState/Zone1" + brightness_scale: 255 + white_value_command_topic: "[MQTT_CLIENT_ID]/modifier/Zone1" + white_value_state_topic: "[MQTT_CLIENT_ID]/modifierState/Zone1" + white_value_scale: 500 + effect_command_topic: "[MQTT_CLIENT_ID]/effect/Zone1" + effect_state_topic: "[MQTT_CLIENT_ID]/effectState/Zone1" + effect_list: + - Color_Chase + - Color_Glitter + - Single_Race + - Double_Crash + - Rainbow + - Blocked_Colors + - BPM + - Twinkle + - Fire + - Fill_Solid + - Spooky_Eyes + - LED_Locator + retain: true + - platform: mqtt + name: "Holiday Lights Zone 2" + command_topic: "[MQTT_CLIENT_ID]/power/Zone2" + state_topic: "[MQTT_CLIENT_ID]/powerState/Zone2" + brightness_command_topic: "[MQTT_CLIENT_ID]/brightness/Zone2" + brightness_state_topic: "[MQTT_CLIENT_ID]/brightnessState/Zone2" + brightness_scale: 255 + white_value_command_topic: "[MQTT_CLIENT_ID]/modifier/Zone2" + white_value_state_topic: "[MQTT_CLIENT_ID]/modifierState/Zone2" + white_value_scale: 500 + effect_command_topic: "[MQTT_CLIENT_ID]/effect/Zone2" + effect_state_topic: "[MQTT_CLIENT_ID]/effectState/Zone2" + effect_list: + - Color_Chase + - Color_Glitter + - Single_Race + - Double_Crash + - Rainbow + - Blocked_Colors + - BPM + - Twinkle + - Fire + - Fill_Solid + - Spooky_Eyes + - LED_Locator + retain: true ``` ## OpenHAB Support From aa0693ec6058883e2bda3a507a7e8d1f4e6373c0 Mon Sep 17 00:00:00 2001 From: zskullz Date: Fri, 25 Sep 2020 20:38:26 -0600 Subject: [PATCH 6/7] Dynamically add and remove colors --- Holiday_LED_2.0_6_Zones.ino | 474 +++++++++++++++++++++++++----------- README.md | 35 ++- 2 files changed, 357 insertions(+), 152 deletions(-) diff --git a/Holiday_LED_2.0_6_Zones.ino b/Holiday_LED_2.0_6_Zones.ino index 72514c8..0a26c0e 100644 --- a/Holiday_LED_2.0_6_Zones.ino +++ b/Holiday_LED_2.0_6_Zones.ino @@ -564,7 +564,6 @@ byte blue3 = 255; byte redG = 255; byte greenG = 255; byte blueG = 255; -byte brightness = 255; char charPayload[50]; int maxLEDs = 500; int locatorLED = 0; @@ -572,8 +571,14 @@ char MQTT_locatorLED[50]; int locatorDelay = 1000; String zoneEffects[6] = {"None","None","None","None","None","None"}; int zoneModifer[6] = { 100, 100, 100, 100, 100, 100 }; +byte zoneBrightness[6] = {255,255,255,255,255,255}; uint8_t zoneStartPosition[6] = { 0, 0, 0, 0, 0, 0 }; bool showZoneLights[6] = { false, false, false, false, false, false }; +const int colorsCount = 5; +String colorStates[colorsCount+1] = { "broken", "ON", "ON", "ON", "OFF", "OFF" }; +byte rgbArray[colorsCount][3] = {{255,0,0},{255,0,0},{255,0,0},{255,0,0},{255,0,0}}; +uint8_t colorsEnabled = 3; +CRGB availableColors[5] = {}; /***************** SYSTEM FUNCTIONS *************************************/ @@ -625,6 +630,7 @@ void reconnect() { client.publish(USER_MQTT_CLIENT_NAME"/checkIn","Reconnected"); } + publishStates(); // ... and resubscribe client.subscribe(USER_MQTT_CLIENT_NAME"/configure"); client.subscribe(USER_MQTT_CLIENT_NAME"/modifier"); @@ -632,18 +638,20 @@ void reconnect() client.subscribe(USER_MQTT_CLIENT_NAME"/effect"); client.subscribe(USER_MQTT_CLIENT_NAME"/effect/+"); client.subscribe(USER_MQTT_CLIENT_NAME"/state"); + client.subscribe(USER_MQTT_CLIENT_NAME"/ColorSelector/+/Toggle"); client.subscribe(USER_MQTT_CLIENT_NAME"/color1"); client.subscribe(USER_MQTT_CLIENT_NAME"/color2"); client.subscribe(USER_MQTT_CLIENT_NAME"/color3"); + client.subscribe(USER_MQTT_CLIENT_NAME"/color4"); + client.subscribe(USER_MQTT_CLIENT_NAME"/color5"); client.subscribe(USER_MQTT_CLIENT_NAME"/power"); client.subscribe(USER_MQTT_CLIENT_NAME"/power/+"); client.subscribe(USER_MQTT_CLIENT_NAME"/brightness"); + client.subscribe(USER_MQTT_CLIENT_NAME"/brightness/+"); client.subscribe(USER_MQTT_CLIENT_NAME"/addEffects"); client.subscribe(USER_MQTT_CLIENT_NAME"/lightningChance"); client.subscribe(USER_MQTT_CLIENT_NAME"/glitterChance"); client.subscribe(USER_MQTT_CLIENT_NAME"/glitterColor"); - - publishStates(); } else { @@ -689,40 +697,70 @@ void calculateMax() #endif } +String boolToOnOff(bool setting) +{ + String state = "OFF"; + if(setting == true) + { + state = ("ON"); + } + + return state; +} + void publishStates() { char buff[50]; client.publish(USER_MQTT_CLIENT_NAME"/modifierState", itoa(zoneModifer[0], buff, 10)); - client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone1", itoa(zoneModifer[0], buff, 10)); - client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone2", itoa(zoneModifer[1], buff, 10)); - client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone3", itoa(zoneModifer[2], buff, 10)); - client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone4", itoa(zoneModifer[3], buff, 10)); - client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone5", itoa(zoneModifer[4], buff, 10)); - client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone6", itoa(zoneModifer[5], buff, 10)); - client.publish(USER_MQTT_CLIENT_NAME"/audio/state", String(audioEffects).c_str()); - client.publish(USER_MQTT_CLIENT_NAME"/glitter/state", String(showGlitter).c_str()); - client.publish(USER_MQTT_CLIENT_NAME"/lightning/state", String(showLightning).c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/audio/state", boolToOnOff(audioEffects).c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/glitter/state", boolToOnOff(showGlitter).c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/lightning/state", boolToOnOff(showLightning).c_str()); client.publish(USER_MQTT_CLIENT_NAME"/effectState", zoneEffects[0].c_str()); - client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone1", zoneEffects[0].c_str()); - client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone2", zoneEffects[1].c_str()); - client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone3", zoneEffects[2].c_str()); - client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone4", zoneEffects[3].c_str()); - client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone5", zoneEffects[4].c_str()); - client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone6", zoneEffects[5].c_str()); client.publish(USER_MQTT_CLIENT_NAME "/color1State", String(String(red1) + "," + String(green1) + "," + String(blue1)).c_str()); client.publish(USER_MQTT_CLIENT_NAME "/color2State", String(String(red2) + "," + String(green2) + "," + String(blue2)).c_str()); client.publish(USER_MQTT_CLIENT_NAME "/color3State", String(String(red3) + "," + String(green3) + "," + String(blue3)).c_str()); client.publish(USER_MQTT_CLIENT_NAME "/glitterColorState", String(String(redG) + "," + String(greenG) + "," + String(blueG)).c_str()); client.publish(USER_MQTT_CLIENT_NAME "/glitterChanceState", itoa(glitterFrequency, buff, 10)); client.publish(USER_MQTT_CLIENT_NAME "/lightningChanceState", itoa(65535-lightningChance, buff, 10)); - client.publish(USER_MQTT_CLIENT_NAME "/brightnessState", itoa(brightness, buff, 10)); - client.publish(USER_MQTT_CLIENT_NAME "/powerState", String(showZoneLights[0]).c_str()); - client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone1", String(showZoneLights[0]).c_str()); - client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone2", String(showZoneLights[1]).c_str()); - client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone3", String(showZoneLights[2]).c_str()); - client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone4", String(showZoneLights[3]).c_str()); - client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone5", String(showZoneLights[4]).c_str()); - client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone6", String(showZoneLights[5]).c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/brightnessState", itoa(zoneBrightness[0], buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME "/powerState", boolToOnOff(showZoneLights[0]).c_str()); + + #if ZONEONE == 1 + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone1", itoa(zoneModifer[0], buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone1", boolToOnOff(showZoneLights[0]).c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone1", zoneEffects[0].c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/brightnessStateZone1", itoa(zoneBrightness[0], buff, 10)); + #endif + #if ZONETWO == 1 + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone2", itoa(zoneModifer[1], buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone2", boolToOnOff(showZoneLights[1]).c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone2", zoneEffects[1].c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/brightnessStateZone2", itoa(zoneBrightness[1], buff, 10)); + #endif + #if ZONETHREE == 1 + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone3", itoa(zoneModifer[2], buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone3", boolToOnOff(showZoneLights[2]).c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone3", zoneEffects[2].c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/brightnessStateZone3", itoa(zoneBrightness[2], buff, 10)); + #endif + #if ZONEFOUR == 1 + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone4", itoa(zoneModifer[3], buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone4", boolToOnOff(showZoneLights[3]).c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone4", zoneEffects[3].c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/brightnessStateZone4", itoa(zoneBrightness[3], buff, 10)); + #endif + #if ZONEFIVE == 1 + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone5", itoa(zoneModifer[4], buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone5", boolToOnOff(showZoneLights[4]).c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone5", zoneEffects[4].c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/brightnessStateZone5", itoa(zoneBrightness[4], buff, 10)); + #endif + #if ZONESIX == 1 + client.publish(USER_MQTT_CLIENT_NAME"/modifierState/Zone6", itoa(zoneModifer[5], buff, 10)); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone6", boolToOnOff(showZoneLights[5]).c_str()); + client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone6", zoneEffects[5].c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/brightnessStateZone6", itoa(zoneBrightness[5], buff, 10)); + #endif } /************************** MQTT CALLBACK ***********************/ @@ -887,7 +925,37 @@ void callback(char* topic, byte* payload, unsigned int length) fill_solid(sixthZone, SIXTHZONE_LEDS, CRGB::Black); client.publish(USER_MQTT_CLIENT_NAME"/effectState/Zone6", charPayload); } - #endif + #endif + + if (newTopic == USER_MQTT_CLIENT_NAME "/ColorSelector/1/Toggle") + { + colorStates[1] = newPayload; + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/1/ToggleState", colorStates[1].c_str()); + } + + if (newTopic == USER_MQTT_CLIENT_NAME "/ColorSelector/2/Toggle") + { + colorStates[2] = newPayload; + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/2/ToggleState", colorStates[2].c_str()); + } + + if (newTopic == USER_MQTT_CLIENT_NAME "/ColorSelector/3/Toggle") + { + colorStates[3] = newPayload; + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/3/ToggleState", colorStates[3].c_str()); + } + + if (newTopic == USER_MQTT_CLIENT_NAME "/ColorSelector/4/Toggle") + { + colorStates[4] = newPayload; + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/4/ToggleState", colorStates[4].c_str()); + } + + if (newTopic == USER_MQTT_CLIENT_NAME "/ColorSelector/5/Toggle") + { + colorStates[5] = newPayload; + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/5/ToggleState", colorStates[5].c_str()); + } if (newTopic == USER_MQTT_CLIENT_NAME "/color1") { @@ -901,6 +969,7 @@ void callback(char* topic, byte* payload, unsigned int length) return; } else { red1 = rgb_red; + rgbArray[0][0] = rgb_red; } uint8_t rgb_green = newPayload.substring(firstIndex + 1, lastIndex).toInt(); @@ -908,6 +977,7 @@ void callback(char* topic, byte* payload, unsigned int length) return; } else { green1 = rgb_green; + rgbArray[0][1] = rgb_green; } uint8_t rgb_blue = newPayload.substring(lastIndex + 1).toInt(); @@ -915,6 +985,7 @@ void callback(char* topic, byte* payload, unsigned int length) return; } else { blue1 = rgb_blue; + rgbArray[0][2] = rgb_blue; } } @@ -930,6 +1001,7 @@ void callback(char* topic, byte* payload, unsigned int length) return; } else { red2 = rgb_red; + rgbArray[1][0] = rgb_red; } uint8_t rgb_green = newPayload.substring(firstIndex + 1, lastIndex).toInt(); @@ -937,6 +1009,7 @@ void callback(char* topic, byte* payload, unsigned int length) return; } else { green2 = rgb_green; + rgbArray[1][1] = rgb_green; } uint8_t rgb_blue = newPayload.substring(lastIndex + 1).toInt(); @@ -944,6 +1017,7 @@ void callback(char* topic, byte* payload, unsigned int length) return; } else { blue2 = rgb_blue; + rgbArray[1][2] = rgb_blue; } } @@ -959,6 +1033,7 @@ void callback(char* topic, byte* payload, unsigned int length) return; } else { red3 = rgb_red; + rgbArray[2][0] = rgb_red; } uint8_t rgb_green = newPayload.substring(firstIndex + 1, lastIndex).toInt(); @@ -966,6 +1041,7 @@ void callback(char* topic, byte* payload, unsigned int length) return; } else { green3 = rgb_green; + rgbArray[2][1] = rgb_green; } uint8_t rgb_blue = newPayload.substring(lastIndex + 1).toInt(); @@ -973,6 +1049,65 @@ void callback(char* topic, byte* payload, unsigned int length) return; } else { blue3 = rgb_blue; + rgbArray[2][2] = rgb_blue; + } + } + + if (newTopic == USER_MQTT_CLIENT_NAME "/color4") + { + client.publish(USER_MQTT_CLIENT_NAME "/color4State", charPayload); + // get the position of the first and second commas + uint8_t firstIndex = newPayload.indexOf(','); + uint8_t lastIndex = newPayload.lastIndexOf(','); + + uint8_t rgb_red = newPayload.substring(0, firstIndex).toInt(); + if (rgb_red < 0 || rgb_red > 255) { + return; + } else { + rgbArray[3][0] = rgb_red; + } + + uint8_t rgb_green = newPayload.substring(firstIndex + 1, lastIndex).toInt(); + if (rgb_green < 0 || rgb_green > 255) { + return; + } else { + rgbArray[3][1] = rgb_green; + } + + uint8_t rgb_blue = newPayload.substring(lastIndex + 1).toInt(); + if (rgb_blue < 0 || rgb_blue > 255) { + return; + } else { + rgbArray[3][2] = rgb_blue; + } + } + + if (newTopic == USER_MQTT_CLIENT_NAME "/color5") + { + client.publish(USER_MQTT_CLIENT_NAME "/color5State", charPayload); + // get the position of the first and second commas + uint8_t firstIndex = newPayload.indexOf(','); + uint8_t lastIndex = newPayload.lastIndexOf(','); + + uint8_t rgb_red = newPayload.substring(0, firstIndex).toInt(); + if (rgb_red < 0 || rgb_red > 255) { + return; + } else { + rgbArray[4][0] = rgb_red; + } + + uint8_t rgb_green = newPayload.substring(firstIndex + 1, lastIndex).toInt(); + if (rgb_green < 0 || rgb_green > 255) { + return; + } else { + rgbArray[4][1] = rgb_green; + } + + uint8_t rgb_blue = newPayload.substring(lastIndex + 1).toInt(); + if (rgb_blue < 0 || rgb_blue > 255) { + return; + } else { + rgbArray[4][2] = rgb_blue; } } @@ -1019,55 +1154,113 @@ void callback(char* topic, byte* payload, unsigned int length) if (newTopic == USER_MQTT_CLIENT_NAME"/brightness") { - client.publish(USER_MQTT_CLIENT_NAME "/brightnessState", charPayload); - brightness = intPayload; + zoneBrightness[0] = intPayload; + client.publish(USER_MQTT_CLIENT_NAME "/brightnessState", itoa(zoneBrightness[0], charPayload, 10)); + } + #if ZONEONE == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/brightness/Zone1" || newTopic == USER_MQTT_CLIENT_NAME"/brightness") + { + zoneBrightness[0] = intPayload; + client.publish(USER_MQTT_CLIENT_NAME "/brightnessState/Zone1", itoa(zoneBrightness[0], charPayload, 10)); + } + #endif + #if ZONETWO == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/brightness/Zone2" || newTopic == USER_MQTT_CLIENT_NAME"/brightness") + { + zoneBrightness[1] = intPayload; + client.publish(USER_MQTT_CLIENT_NAME "/brightnessState/Zone2", itoa(zoneBrightness[1], charPayload, 10)); + } + #endif + #if ZONETHREE == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/brightness/Zone3" || newTopic == USER_MQTT_CLIENT_NAME"/brightness") + { + zoneBrightness[2] = intPayload; + client.publish(USER_MQTT_CLIENT_NAME "/brightnessState/Zone3", itoa(zoneBrightness[2], charPayload, 10)); + } + #endif + #if ZONEFOUR == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/brightness/Zone4" || newTopic == USER_MQTT_CLIENT_NAME"/brightness") + { + zoneBrightness[3] = intPayload; + client.publish(USER_MQTT_CLIENT_NAME "/brightnessState/Zone4", itoa(zoneBrightness[3], charPayload, 10)); + } + #endif + #if ZONEFIVE == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/brightness/Zone5" || newTopic == USER_MQTT_CLIENT_NAME"/brightness") + { + zoneBrightness[4] = intPayload; + client.publish(USER_MQTT_CLIENT_NAME "/brightnessState/Zone5", itoa(zoneBrightness[4], charPayload, 10)); + } + #endif + #if ZONESIX == 1 + if (newTopic == USER_MQTT_CLIENT_NAME"/brightness/Zone6" || newTopic == USER_MQTT_CLIENT_NAME"/brightness") + { + zoneBrightness[5] = intPayload; + client.publish(USER_MQTT_CLIENT_NAME "/brightnessState/Zone6", itoa(zoneBrightness[5], charPayload, 10)); } + #endif if (newTopic == USER_MQTT_CLIENT_NAME"/power") { showZoneLights[0] = newPayload == "ON"; - client.publish(USER_MQTT_CLIENT_NAME "/powerState", charPayload); + client.publish(USER_MQTT_CLIENT_NAME "/powerState", boolToOnOff(showZoneLights[0]).c_str()); + if(newPayload == "OFF") + { + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/1/ToggleState", charPayload); + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/2/ToggleState", charPayload); + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/3/ToggleState", charPayload); + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/4/ToggleState", charPayload); + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/5/ToggleState", charPayload); + } + if(newPayload == "ON") + { + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/1/ToggleState", colorStates[1].c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/2/ToggleState", colorStates[2].c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/3/ToggleState", colorStates[3].c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/4/ToggleState", colorStates[4].c_str()); + client.publish(USER_MQTT_CLIENT_NAME "/ColorSelector/5/ToggleState", colorStates[5].c_str()); + } } #if ZONEONE == 1 if (newTopic == USER_MQTT_CLIENT_NAME"/power/Zone1" || newTopic == USER_MQTT_CLIENT_NAME"/power") { showZoneLights[0] = newPayload == "ON"; - client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone1", charPayload); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone1", boolToOnOff(showZoneLights[0]).c_str()); } #endif #if ZONETWO == 1 if (newTopic == USER_MQTT_CLIENT_NAME"/power/Zone2" || newTopic == USER_MQTT_CLIENT_NAME"/power") { showZoneLights[1] = newPayload == "ON"; - client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone2", charPayload); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone2", boolToOnOff(showZoneLights[1]).c_str()); } #endif #if ZONETHREE == 1 if (newTopic == USER_MQTT_CLIENT_NAME"/power/Zone3" || newTopic == USER_MQTT_CLIENT_NAME"/power") { showZoneLights[2] = newPayload == "ON"; - client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone3", charPayload); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone3", boolToOnOff(showZoneLights[2]).c_str()); } #endif #if ZONEFOUR == 1 if (newTopic == USER_MQTT_CLIENT_NAME"/power/Zone4" || newTopic == USER_MQTT_CLIENT_NAME"/power") { showZoneLights[3] = newPayload == "ON"; - client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone4", charPayload); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone4", boolToOnOff(showZoneLights[3]).c_str()); } #endif #if ZONEFIVE == 1 if (newTopic == USER_MQTT_CLIENT_NAME"/power/Zone5" || newTopic == USER_MQTT_CLIENT_NAME"/power") { showZoneLights[4] = newPayload == "ON"; - client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone5", charPayload); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone5", boolToOnOff(showZoneLights[4]).c_str()); } #endif #if ZONESIX == 1 if (newTopic == USER_MQTT_CLIENT_NAME"/power/Zone6" || newTopic == USER_MQTT_CLIENT_NAME"/power") { showZoneLights[5] = newPayload == "ON"; - client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone6", charPayload); + client.publish(USER_MQTT_CLIENT_NAME "/powerState/Zone6", boolToOnOff(showZoneLights[5]).c_str()); } #endif } @@ -1078,8 +1271,9 @@ void callback(char* topic, byte* payload, unsigned int length) void chase(void* args) { + int i = (int)args; - if(zoneStartPosition[i] == 5) + if(zoneStartPosition[i] == ((colorsEnabled*2)-1)) { zoneStartPosition[i] = 0; } @@ -1112,6 +1306,35 @@ void checkIn() timer.setTimeout(120000, checkIn); } +void updateColorsEnabled() +{ + uint8_t count = 0; + availableColors[5] = {}; + for(uint8_t i = 1; i <= colorsCount; i++) + { + if(colorStates[i] == "ON") + { + availableColors[count] = CRGB(rgbArray[i-1][0],rgbArray[i-1][1],rgbArray[i-1][2]); + count++; + } + } + + if(colorsEnabled != count) + { + colorsEnabled = count; + for(uint8_t i = 0; i < 5; i++) + { + zoneStartPosition[i] = 0; + } + } + + if(colorsEnabled == 0) + { + availableColors[0] = CRGB(255,0,0); + colorsEnabled = 1; + } +} + void setSectionPattern(CRGB zone[], int zoneLEDS, int sectionStart, int sectionEnd, byte heat[], int fireStart, int fireEnd, int zoneIndex) { String effect = zoneEffects[zoneIndex]; @@ -1186,9 +1409,9 @@ void setZonePattern(CRGB zone[], int zoneLEDS, int previousZoneLED, Ball balls[] { heartbeat(zone, zoneLEDS, startPosition); } - if(effect == "Three_Solid") + if(effect == "Traditional") { - threeSolid(zone, zoneLEDS); + traditionalSolid(zone, zoneLEDS); } } @@ -1905,30 +2128,31 @@ void loop() } timer.run(); EVERY_N_MILLISECONDS( 20 ) { gHue++; } + updateColorsEnabled(); choosePattern(); #if ZONEONE == 1 - FastLED[0].showLeds(brightness); + FastLED[0].showLeds(zoneBrightness[0]); #endif #if ZONETWO == 1 - FastLED[1].showLeds(brightness); + FastLED[1].showLeds(zoneBrightness[1]); #endif #if ZONETHREE == 1 - FastLED[2].showLeds(brightness); + FastLED[2].showLeds(zoneBrightness[2]); #endif #if ZONEFOUR == 1 - FastLED[3].showLeds(brightness); + FastLED[3].showLeds(zoneBrightness[3]); #endif #if ZONEFIVE == 1 - FastLED[4].showLeds(brightness); + FastLED[4].showLeds(zoneBrightness[4]); #endif #if ZONESIX == 1 - FastLED[5].showLeds(brightness); + FastLED[5].showLeds(zoneBrightness[5]); #endif } @@ -1966,54 +2190,28 @@ int Ripple(CRGB zone[], int ledCount, int zoneCenter, int zoneStep) void rGB(CRGB zone[], int zoneLEDS, uint8_t startPosition) { - if(startPosition < 6) + int squenceLength = colorsEnabled*2; + if(startPosition < squenceLength) { fadeToBlackBy( zone, zoneLEDS, 80); - for(int pixel = startPosition+1; pixel < zoneLEDS; pixel+=6) - { - if(pixel <= zoneLEDS) - { - zone[pixel] = CRGB(red1,green1,blue1); - } - } - for(int pixel = startPosition+3; pixel < zoneLEDS; pixel+=6) + for(int skip = 1; skip < squenceLength; skip+=2) { - if(pixel <= zoneLEDS) + for(int pixel = startPosition+skip; pixel < zoneLEDS; pixel+=squenceLength) { - zone[pixel] = CRGB(red2,green2,blue2); - } - } - for(int pixel = startPosition+5; pixel < zoneLEDS; pixel+=6) - { - if(pixel <= zoneLEDS) - { - zone[pixel] = CRGB(red3,green3,blue3); - } + if(pixel <= zoneLEDS) + { + int currentColor = ((skip+1)/2)-1; + zone[pixel] = availableColors[currentColor]; + } + } } } - if(startPosition == 1) - { - zone[0]=CRGB(red3,green3,blue3); - } - if(startPosition == 2) - { - zone[1]=CRGB(red3,green3,blue3); - } - if(startPosition == 3) - { - zone[2]=CRGB(red3,green3,blue3); - zone[0]=CRGB(red2,green2,blue2); - } - if(startPosition == 4) - { - zone[3]=CRGB(red3,green3,blue3); - zone[1]=CRGB(red2,green2,blue2); - } - if(startPosition == 5) + + int colorIndex = colorsEnabled-1; + for(int pos = startPosition-1; pos >= 0; pos-=2) { - zone[4]=CRGB(red3,green3,blue3); - zone[2]=CRGB(red2,green2,blue2); - zone[0]=CRGB(red1,green1,blue1); + zone[pos] = availableColors[colorIndex]; + colorIndex--; } } @@ -2094,53 +2292,25 @@ void Rainbow(CRGB zone[], int zoneLEDS, uint8_t numberOfRainbows) void Blocked(CRGB zone[], int zoneLEDS, uint8_t startPosition) { fadeToBlackBy( zone, zoneLEDS, 2); - for( int mark = 0; mark < zoneLEDS; mark+=30) + uint8_t startColorIndex = map(startPosition, 0, (colorsEnabled*2)-1, 0, colorsEnabled-1); + + for( int mark = 0; mark < zoneLEDS; mark+=(colorsEnabled*10)) //repeat color block sequence { - for( int i = 0; i < 9; i++) + for( int i = 0; i < 9; i++) // repeat for each pixel in color block size { - if(startPosition == 0 || startPosition == 1) - { - if(i+mark <= zoneLEDS) - { - zone[i+mark] = CRGB(red1,green1,blue1); - } - if(i+10+mark <= zoneLEDS) - { - zone[i+10+mark] = CRGB(red2,green2,blue2); - } - if(i+20+mark <= zoneLEDS) - { - zone[i+20+mark] = CRGB(red3,green3,blue3); - } - } - if(startPosition == 2 || startPosition == 3) + for(int blockNum = 0; blockNum < (colorsEnabled*10); blockNum+=10) //set one of each color in each block { - if(i+mark <= zoneLEDS) - { - zone[i+mark] = CRGB(red2,green2,blue2); - } - if(i+10+mark <= zoneLEDS) - { - zone[i+10+mark] = CRGB(red3,green3,blue3); - } - if(i+20+mark <= zoneLEDS) - { - zone[i+20+mark] = CRGB(red1,green1,blue1); - } - } - if(startPosition == 4 || startPosition == 5) - { - if(i+mark <= zoneLEDS) - { - zone[i+mark] = CRGB(red3,green3,blue3); - } - if(i+10+mark <= zoneLEDS) - { - zone[i+10+mark] = CRGB(red1,green1,blue1); - } - if(i+20+mark <= zoneLEDS) + if((i+blockNum+mark) <= zoneLEDS) { - zone[i+20+mark] = CRGB(red2,green2,blue2); + zone[i+blockNum+mark] = availableColors[startColorIndex]; + if(startColorIndex < colorsEnabled-1) + { + startColorIndex++; + } + else + { + startColorIndex = 0; + } } } } @@ -2278,23 +2448,23 @@ void fire(CRGB zone[], byte heat[], int sectionStart, int sectionEnd, int fireSt } void heartbeat(CRGB zone[], int zoneLEDS, uint8_t startPosition) { - if(startPosition == 1 || startPosition == 3) { + uint8_t beatIndex = map(startPosition, 0, (colorsEnabled*2)-1, 0, 5); + if(beatIndex == 1 || beatIndex == 3) { fill_solid(zone, zoneLEDS, CRGB(red1, green1, blue1)); } else { fill_solid(zone, zoneLEDS, CRGB(red1/2, green1/2, blue1/2)); } } -void threeSolid(CRGB zone[], int zoneLEDS) +void traditionalSolid(CRGB zone[], int zoneLEDS) { - for(int pixel = 0; pixel < zoneLEDS; pixel+=12) + uint8_t gap = 4; + for(int pixel = 0; pixel < zoneLEDS; pixel+= (gap*colorsEnabled)) { - if(pixel <= zoneLEDS) - zone[pixel] = CRGB(red1,green1,blue1); - if(pixel+4 <= zoneLEDS) - zone[pixel+3] = CRGB(red2,green2,blue2); - if(pixel+8 <= zoneLEDS) - zone[pixel+6] = CRGB(red3,green3,blue3); + for(int color = 0; color < colorsEnabled; color++) + { + zone[pixel+(color*gap)] = availableColors[color]; + } } } @@ -2308,16 +2478,22 @@ void fireworks(CRGB zone[], int zoneLEDS, Ball balls[], int fireworkCount, uint8 { balls[i].position = -1; balls[i].exploding = 0; - switch(random8(3)) + switch(random8(colorsEnabled)) { case 0: - balls[i].color = CRGB(red1,green1,blue1); + balls[i].color = availableColors[0]; break; case 1: - balls[i].color = CRGB(red2,green2,blue2); + balls[i].color = availableColors[1]; break; case 2: - balls[i].color = CRGB(red3,green3,blue3); + balls[i].color = availableColors[2]; + break; + case 3: + balls[i].color = availableColors[3]; + break; + case 4: + balls[i].color = availableColors[4]; break; } balls[i].reverse = random8(2) == 0; @@ -2406,16 +2582,22 @@ void fireworks(CRGB zone[], int zoneLEDS, Ball balls[], int fireworkCount, uint8 balls[i].exploding = 0; balls[i].position = -1; balls[i].reverse = random8(2) == 0; - switch(random8(3)) + switch(random8(colorsEnabled)) { case 0: - balls[i].color = CRGB(red1,green1,blue1); + balls[i].color = availableColors[0]; break; case 1: - balls[i].color = CRGB(red2,green2,blue2); + balls[i].color = availableColors[1]; break; case 2: - balls[i].color = CRGB(red3,green3,blue3); + balls[i].color = availableColors[2]; + break; + case 3: + balls[i].color = availableColors[3]; + break; + case 4: + balls[i].color = availableColors[4]; break; } } diff --git a/README.md b/README.md index 4d1cb03..fb5334a 100644 --- a/README.md +++ b/README.md @@ -60,29 +60,46 @@ light: - Fire - Fill_Solid - Spooky_Eyes + - Heartbeat + - Fireworks + - Traditional - LED_Locator retain: true - platform: mqtt name: "Color 1" - command_topic: "[MQTT_CLIENT_ID]/ColorPower" - state_topic: "[MQTT_CLIENT_ID]/powerState" + command_topic: "[MQTT_CLIENT_ID]/ColorSelector/1/Toggle" + state_topic: "[MQTT_CLIENT_ID]/ColorSelector/1/ToggleState" rgb_command_topic: "[MQTT_CLIENT_ID]/color1" rgb_state_topic: "[MQTT_CLIENT_ID]/color1State" retain: true - platform: mqtt name: "Color 2" - command_topic: "[MQTT_CLIENT_ID]/ColorPower" - state_topic: "[MQTT_CLIENT_ID]/powerState" + command_topic: "[MQTT_CLIENT_ID]/ColorSelector/2/Toggle" + state_topic: "[MQTT_CLIENT_ID]/ColorSelector/2/ToggleState" rgb_command_topic: "[MQTT_CLIENT_ID]/color2" rgb_state_topic: "[MQTT_CLIENT_ID]/color2State" retain: true - platform: mqtt name: "Color 3" - command_topic: "[MQTT_CLIENT_ID]/ColorPower" - state_topic: "[MQTT_CLIENT_ID]/powerState" + command_topic: "[MQTT_CLIENT_ID]/ColorSelector/3/Toggle" + state_topic: "[MQTT_CLIENT_ID]/ColorSelector/3/ToggleState" rgb_command_topic: "[MQTT_CLIENT_ID]/color3" rgb_state_topic: "[MQTT_CLIENT_ID]/color3State" retain: true + - platform: mqtt + name: "Color 4" + command_topic: "[MQTT_CLIENT_ID]/ColorSelector/4/Toggle" + state_topic: "[MQTT_CLIENT_ID]/ColorSelector/4/ToggleState" + rgb_command_topic: "[MQTT_CLIENT_ID]/color4" + rgb_state_topic: "[MQTT_CLIENT_ID]/color4State" + retain: true + - platform: mqtt + name: "Color 5" + command_topic: "[MQTT_CLIENT_ID]/ColorSelector/5/Toggle" + state_topic: "[MQTT_CLIENT_ID]/ColorSelector/5/ToggleState" + rgb_command_topic: "[MQTT_CLIENT_ID]/color5" + rgb_state_topic: "[MQTT_CLIENT_ID]/color5State" + retain: true - platform: mqtt name: "Glitter" state_topic: "[MQTT_CLIENT_ID]/glitter/state" @@ -129,6 +146,9 @@ light: - Fire - Fill_Solid - Spooky_Eyes + - Heartbeat + - Fireworks + - Traditional - LED_Locator retain: true - platform: mqtt @@ -155,6 +175,9 @@ light: - Fire - Fill_Solid - Spooky_Eyes + - Heartbeat + - Fireworks + - Traditional - LED_Locator retain: true ``` From 712c11a716cf875a45dcb9ec139363ff21bf6673 Mon Sep 17 00:00:00 2001 From: zskullz Date: Sat, 26 Sep 2020 10:49:11 -0600 Subject: [PATCH 7/7] Fix zone 1 references --- Holiday_LED_2.0_6_Zones.ino | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Holiday_LED_2.0_6_Zones.ino b/Holiday_LED_2.0_6_Zones.ino index 0a26c0e..144e3c5 100644 --- a/Holiday_LED_2.0_6_Zones.ino +++ b/Holiday_LED_2.0_6_Zones.ino @@ -1428,44 +1428,44 @@ void choosePattern() zOneS1heat, ZONEONE_SECTION1_START_FIRE, ZONEONE_SECTION1_END_FIRE, 0); #endif #ifdef ZONEONE_SECTION2_START - static byte zOneS1heat[ZONEONE_SECTION2_END-ZONEONE_SECTION2_START]; + static byte zOneS2heat[ZONEONE_SECTION2_END-ZONEONE_SECTION2_START]; setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION2_START, ZONEONE_SECTION2_END, - zOneS1heat, ZONEONE_SECTION2_START_FIRE, ZONEONE_SECTION2_END_FIRE, 0); + zOneS2heat, ZONEONE_SECTION2_START_FIRE, ZONEONE_SECTION2_END_FIRE, 0); #endif #ifdef ZONEONE_SECTION3_START - static byte zOneS1heat[ZONEONE_SECTION3_END-ZONEONE_SECTION3_START]; + static byte zOneS3heat[ZONEONE_SECTION3_END-ZONEONE_SECTION3_START]; setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION3_START, ZONEONE_SECTION3_END, - zOneS1heat, ZONEONE_SECTION3_START_FIRE, ZONEONE_SECTION3_END_FIRE , 0); + zOneS3heat, ZONEONE_SECTION3_START_FIRE, ZONEONE_SECTION3_END_FIRE , 0); #endif #ifdef ZONEONE_SECTION4_START - static byte zOneS1heat[ZONEONE_SECTION4_END-ZONEONE_SECTION4_START]; + static byte zOneS4heat[ZONEONE_SECTION4_END-ZONEONE_SECTION4_START]; setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION4_START, ZONEONE_SECTION4_END, - zOneS1heat, ZONEONE_SECTION4_START_FIRE, ZONEONE_SECTION4_END_FIRE, 0); + zOneS4heat, ZONEONE_SECTION4_START_FIRE, ZONEONE_SECTION4_END_FIRE, 0); #endif #ifdef ZONEONE_SECTION5_START - static byte zOneS1heat[ZONEONE_SECTION5_END-ZONEONE_SECTION5_START]; + static byte zOneS5heat[ZONEONE_SECTION5_END-ZONEONE_SECTION5_START]; setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION5_START, ZONEONE_SECTION5_END, - zOneS1heat, ZONEONE_SECTION5_START_FIRE, ZONEONE_SECTION5_END_FIRE, 0); + zOneS5heat, ZONEONE_SECTION5_START_FIRE, ZONEONE_SECTION5_END_FIRE, 0); #endif #ifdef ZONEONE_SECTION6_START - static byte zOneS1heat[ZONEONE_SECTION6_END-ZONEONE_SECTION6_START]; + static byte zOneS6heat[ZONEONE_SECTION6_END-ZONEONE_SECTION6_START]; setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION6_START, ZONEONE_SECTION6_END, - zOneS1heat, ZONEONE_SECTION6_START_FIRE, ZONEONE_SECTION6_END_FIRE, 0); + zOneS6heat, ZONEONE_SECTION6_START_FIRE, ZONEONE_SECTION6_END_FIRE, 0); #endif #ifdef ZONEONE_SECTION7_START - static byte zOneS1heat[ZONEONE_SECTION7_END-ZONEONE_SECTION7_START]; + static byte zOneS7heat[ZONEONE_SECTION7_END-ZONEONE_SECTION7_START]; setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION7_START, ZONEONE_SECTION7_END, - zOneS1heat, ZONEONE_SECTION7_START_FIRE, ZONEONE_SECTION7_END_FIRE, 0); + zOneS7heat, ZONEONE_SECTION7_START_FIRE, ZONEONE_SECTION7_END_FIRE, 0); #endif #ifdef ZONEONE_SECTION8_START - static byte zOneS1heat[ZONEONE_SECTION8_END-ZONEONE_SECTION8_START]; + static byte zOneS8heat[ZONEONE_SECTION8_END-ZONEONE_SECTION8_START]; setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION8_START, ZONEONE_SECTION8_END, - zOneS1heat, ZONEONE_SECTION8_START_FIRE, ZONEONE_SECTION8_END_FIRE, 0); + zOneS8heat, ZONEONE_SECTION8_START_FIRE, ZONEONE_SECTION8_END_FIRE, 0); #endif #ifdef ZONEONE_SECTION9_START - static byte zOneS1heat[ZONEONE_SECTION9_END-ZONEONE_SECTION9_START]; + static byte zOneS9heat[ZONEONE_SECTION9_END-ZONEONE_SECTION9_START]; setSectionPattern(firstZone, FIRSTZONE_LEDS, ZONEONE_SECTION9_START, ZONEONE_SECTION9_END, - zOneS1heat, ZONEONE_SECTION9_START_FIRE, ZONEONE_SECTION9_END_FIRE, 0); + zOneS9heat, ZONEONE_SECTION9_START_FIRE, ZONEONE_SECTION9_END_FIRE, 0); #endif } else { @@ -1515,7 +1515,7 @@ void choosePattern() zTwoS7heat, ZONETWO_SECTION7_START_FIRE, ZONETWO_SECTION7_END_FIRE, 1); #endif #ifdef ZONETWO_SECTION8_START - static byte zOneS8heat[ZONETWO_SECTION8_END-ZONETWO_SECTION8_START]; + static byte zTwoS8heat[ZONETWO_SECTION8_END-ZONETWO_SECTION8_START]; setSectionPattern(secondZone, SECONDZONE_LEDS, ZONETWO_SECTION8_START, ZONETWO_SECTION8_END, zTwoS8heat, ZONETWO_SECTION8_START_FIRE, ZONETWO_SECTION8_END_FIRE, 1); #endif