From 0ffd98768e96fd493a4ad6dcb829c54fd59ffa88 Mon Sep 17 00:00:00 2001 From: David Madison Date: Thu, 18 Oct 2018 17:38:53 -0400 Subject: [PATCH 1/5] Refactor data pin as define Allows putting the clock pin definition next to it --- Arduino/LEDstream_FastLED/LEDstream_FastLED.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino index 28c0af3..11462e6 100644 --- a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino +++ b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino @@ -25,12 +25,12 @@ static const uint16_t Num_Leds = 80; // strip length static const uint8_t - Led_Pin = 6, // Arduino data output pin Brightness = 255; // maximum brightness // --- FastLED Setings #define LED_TYPE WS2812B // led strip type for FastLED #define COLOR_ORDER GRB // color order for bitbang +#define PIN_DATA 6 // led data output pin // --- Serial Settings static const unsigned long @@ -122,7 +122,7 @@ void setup(){ pinMode(DEBUG_FPS, OUTPUT); #endif - FastLED.addLeds(leds, Num_Leds); + FastLED.addLeds(leds, Num_Leds); FastLED.setBrightness(Brightness); #ifdef CLEAR_ON_START From e7175f82e26c0098fe9e8385f80b1598d47fba5e Mon Sep 17 00:00:00 2001 From: David Madison Date: Thu, 18 Oct 2018 17:42:33 -0400 Subject: [PATCH 2/5] Adds clock pin support for 4-wire strips --- Arduino/LEDstream_FastLED/LEDstream_FastLED.ino | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino index 11462e6..d53f816 100644 --- a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino +++ b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino @@ -31,6 +31,7 @@ static const uint8_t #define LED_TYPE WS2812B // led strip type for FastLED #define COLOR_ORDER GRB // color order for bitbang #define PIN_DATA 6 // led data output pin +//#define PIN_CLOCK 7 // led data clock pin (uncomment if you're using a 4-wire LED type) // --- Serial Settings static const unsigned long @@ -122,7 +123,12 @@ void setup(){ pinMode(DEBUG_FPS, OUTPUT); #endif - FastLED.addLeds(leds, Num_Leds); + #ifdef PIN_CLOCK + FastLED.addLeds(leds, Num_Leds); + #else + FastLED.addLeds(leds, Num_Leds); + #endif + FastLED.setBrightness(Brightness); #ifdef CLEAR_ON_START From de3e66576933db71329a191f64ec3e91e7688827 Mon Sep 17 00:00:00 2001 From: David Madison Date: Thu, 18 Oct 2018 17:59:15 -0400 Subject: [PATCH 3/5] Adds PIN_CLOCK notice to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5157a8b..d8d4b45 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ Open the LEDstream_FastLED file in the Arduino IDE and customize the settings at - LED data pin - LED type +If you are using a 4-wire LED chipset like APA102, you will need to uncomment the `PIN_CLOCK` line and set that as well. + Upload to your Arduino and use a corresponding PC application to stream color data. You can get the Processing files from the [main Adalight repository](https://github.com/adafruit/Adalight), though I would recommend using [Patrick Siegler's](https://github.com/psieg/) fork of Lightpacks's Prismatik, which you can find [here](https://github.com/psieg/Lightpack/releases). ## Additional Settings From bd8c3f673910f1aec164604b7095ff1dc5ab418b Mon Sep 17 00:00:00 2001 From: David Madison Date: Thu, 18 Oct 2018 18:19:00 -0400 Subject: [PATCH 4/5] Adds APA102 to CI --- .travis.yml | 5 ++++- Arduino/LEDstream_FastLED/LEDstream_FastLED.ino | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1aae66b..eff5962 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,9 @@ env: matrix: include: - name: "WS2812B" + env: BUILD_FLAGS="-DDEBUG_CI -DLED_CHIPSET=WS2812B" + - name: "APA102" + env: BUILD_FLAGS="-DDEBUG_CI -DLED_CHIPSET=APA102 -DPIN_CLOCK=7" before_install: - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16" @@ -24,7 +27,7 @@ before_install: - CYAN="\033[36m"; YELLOW="\033[33m"; NOC="\033[0m"; - buildSketchPath() { echo -e "\n${CYAN}Building sketch ${1##*/}${NOC}"; - arduino --verify --board $BOARD "$1"; + arduino --verify --board $BOARD --pref build.extra_flags="$BUILD_FLAGS" "$1"; } - buildAllSketches() { for f in $(find $PWD -name '*.ino'); diff --git a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino index d53f816..911f8e0 100644 --- a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino +++ b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino @@ -93,6 +93,11 @@ static unsigned long lastAckTime; // Debug macros initialized +#ifdef DEBUG_CI +#undef LED_TYPE +#define LED_TYPE LED_CHIPSET // Use command line chipset definition +#endif + #ifdef DEBUG_LED #define ON 1 #define OFF 0 From f2a4031e2c1cde3d7d576c131907c09e8899e4d3 Mon Sep 17 00:00:00 2001 From: David Madison Date: Thu, 18 Oct 2018 18:41:36 -0400 Subject: [PATCH 5/5] Revert "Adds APA102 to CI" Unfortunately the "build.extra_flags" option doesn't include the USB flags specified in the boards.txt file, overwriting them instead which breaks compilation with the Leonardo. Reversing this until I can think of a better solution. This reverts commit bd8c3f673910f1aec164604b7095ff1dc5ab418b. --- .travis.yml | 5 +---- Arduino/LEDstream_FastLED/LEDstream_FastLED.ino | 5 ----- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index eff5962..1aae66b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,6 @@ env: matrix: include: - name: "WS2812B" - env: BUILD_FLAGS="-DDEBUG_CI -DLED_CHIPSET=WS2812B" - - name: "APA102" - env: BUILD_FLAGS="-DDEBUG_CI -DLED_CHIPSET=APA102 -DPIN_CLOCK=7" before_install: - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16" @@ -27,7 +24,7 @@ before_install: - CYAN="\033[36m"; YELLOW="\033[33m"; NOC="\033[0m"; - buildSketchPath() { echo -e "\n${CYAN}Building sketch ${1##*/}${NOC}"; - arduino --verify --board $BOARD --pref build.extra_flags="$BUILD_FLAGS" "$1"; + arduino --verify --board $BOARD "$1"; } - buildAllSketches() { for f in $(find $PWD -name '*.ino'); diff --git a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino index 911f8e0..d53f816 100644 --- a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino +++ b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino @@ -93,11 +93,6 @@ static unsigned long lastAckTime; // Debug macros initialized -#ifdef DEBUG_CI -#undef LED_TYPE -#define LED_TYPE LED_CHIPSET // Use command line chipset definition -#endif - #ifdef DEBUG_LED #define ON 1 #define OFF 0