From 79c514bd59ce24b976380226498646a280642d58 Mon Sep 17 00:00:00 2001 From: David Madison Date: Tue, 18 Apr 2017 22:52:37 -0400 Subject: [PATCH 1/4] Added DEBUG_LED feature --- Arduino/LEDstream_FastLED/LEDstream_FastLED.ino | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino index 8a3b850..583161e 100644 --- a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino +++ b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino @@ -27,6 +27,8 @@ static const unsigned long //#define CLEAR_ON_START // LEDs are cleared on reset //#define GROUND_PIN 10 // additional grounding pin (optional) //#define CALIBRATE // sets all LEDs to the color of the first +//#define DEBUG_LED 13 // turns on the Arduino's built-in LED + // if the magic word + checksum match // -------------------------------------------------------------------- @@ -67,6 +69,11 @@ void setup(){ digitalWrite(GROUND_PIN, LOW); #endif + #ifdef DEBUG_LED + pinMode(DEBUG_LED, OUTPUT); + digitalWrite(DEBUG_LED, LOW); + #endif + FastLED.addLeds(leds, Num_Leds); FastLED.setBrightness(Brightness); @@ -134,6 +141,10 @@ void adalight(){ if(chk == (hi ^ lo ^ 0x55)) { // Checksum looks valid. Get 16-bit LED count, add 1 // (# LEDs is always > 0) and multiply by 3 for R,G,B. + #ifdef DEBUG_LED + digitalWrite(DEBUG_LED, HIGH); + #endif + bytesRemaining = 3L * (256L * (long)hi + (long)lo + 1L); outPos = 0; memset(leds, 0, Num_Leds * sizeof(struct CRGB)); @@ -166,6 +177,10 @@ void adalight(){ // End of data -- issue latch: mode = MODE_HEADER; // Begin next header search FastLED.show(); + + #ifdef DEBUG_LED + digitalWrite(DEBUG_LED, LOW); + #endif } break; } // end switch From c24abb7393a8d873caa2b154f803fce0db00b3a9 Mon Sep 17 00:00:00 2001 From: David Madison Date: Wed, 19 Apr 2017 21:31:39 -0400 Subject: [PATCH 2/4] Set mode variable as static Chasing what I believe is a memory allocation issue, related to large numbers of LEDs (#9) --- Arduino/LEDstream_FastLED/LEDstream_FastLED.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino index 583161e..5f0c2d9 100644 --- a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino +++ b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino @@ -87,8 +87,9 @@ void setup(){ } void adalight(){ + static uint8_t + mode = MODE_HEADER; uint8_t - mode = MODE_HEADER, headPos, hi, lo, chk; int16_t From e57c61b1ea465ca86f448f1f4f61878e304fc693 Mon Sep 17 00:00:00 2001 From: David Madison Date: Sun, 23 Apr 2017 04:32:03 -0400 Subject: [PATCH 3/4] Added static keywords to Adalight func variables Should not be strictly necessary, but it was careless to omit them. --- Arduino/LEDstream_FastLED/LEDstream_FastLED.ino | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino index 5f0c2d9..d78eff6 100644 --- a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino +++ b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino @@ -89,19 +89,20 @@ void setup(){ void adalight(){ static uint8_t mode = MODE_HEADER; - uint8_t + static uint8_t headPos, hi, lo, chk; int16_t c; - uint16_t + static uint16_t outPos; - uint32_t + static uint32_t bytesRemaining; unsigned long - lastByteTime, - lastAckTime, t; + static unsigned long + lastByteTime, + lastAckTime; Serial.print("Ada\n"); // Send ACK string to host From 4931d955ed2155772583124641bd89bae93bccb0 Mon Sep 17 00:00:00 2001 From: David Madison Date: Sun, 23 Apr 2017 04:35:10 -0400 Subject: [PATCH 4/4] Update date --- Arduino/LEDstream_FastLED/LEDstream_FastLED.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino index d78eff6..aec1dad 100644 --- a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino +++ b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino @@ -4,7 +4,7 @@ * library (http://fastled.io) for driving led strips. * * http://github.com/dmadison/Adalight-FastLED - * Last Updated: 2017-04-08 + * Last Updated: 2017-04-23 */ // --- General Settings