Add support for 2 Neopixel strips (#14667)
This commit is contained in:
committed by
Scott Lahteine
parent
6899ed2026
commit
e5aa453293
@@ -39,7 +39,7 @@
|
||||
#endif
|
||||
|
||||
#if ENABLED(PCA9533)
|
||||
#include "SailfishRGB_LED.h"
|
||||
#include <SailfishRGB_LED.h>
|
||||
#endif
|
||||
|
||||
#if ENABLED(LED_COLOR_PRESETS)
|
||||
@@ -69,7 +69,7 @@ void LEDLights::setup() {
|
||||
#endif
|
||||
#endif
|
||||
#if ENABLED(NEOPIXEL_LED)
|
||||
setup_neopixel();
|
||||
neo.init();
|
||||
#endif
|
||||
#if ENABLED(PCA9533)
|
||||
RGBinit();
|
||||
@@ -88,23 +88,28 @@ void LEDLights::set_color(const LEDColor &incol
|
||||
#if ENABLED(NEOPIXEL_LED)
|
||||
|
||||
const uint32_t neocolor = LEDColorWhite() == incol
|
||||
? pixels.Color(NEO_WHITE)
|
||||
: pixels.Color(incol.r, incol.g, incol.b, incol.w);
|
||||
? neo.Color(NEO_WHITE)
|
||||
: neo.Color(incol.r, incol.g, incol.b, incol.w);
|
||||
static uint16_t nextLed = 0;
|
||||
|
||||
#ifdef NEOPIXEL_BKGD_LED_INDEX
|
||||
if (NEOPIXEL_BKGD_LED_INDEX == nextLed) { nextLed++; return; }
|
||||
if (NEOPIXEL_BKGD_LED_INDEX == nextLed) {
|
||||
if (++nextLed >= neo.pixels()) nextLed = 0;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
pixels.setBrightness(incol.i);
|
||||
if (!isSequence)
|
||||
set_neopixel_color(neocolor);
|
||||
else {
|
||||
pixels.setPixelColor(nextLed, neocolor);
|
||||
pixels.show();
|
||||
if (++nextLed >= pixels.numPixels()) nextLed = 0;
|
||||
|
||||
neo.set_brightness(incol.i);
|
||||
|
||||
if (isSequence) {
|
||||
neo.set_pixel_color(nextLed, neocolor);
|
||||
neo.show();
|
||||
if (++nextLed >= neo.pixels()) nextLed = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
neo.set_color(neocolor);
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(BLINKM)
|
||||
|
||||
Reference in New Issue
Block a user