added skip led
This commit is contained in:
parent
347241bee2
commit
ef73f2c7ac
25
src/Led.cpp
25
src/Led.cpp
@ -5,16 +5,23 @@ CRGB led;
|
||||
CRGB source;
|
||||
CRGB target;
|
||||
|
||||
#ifdef LEVEL_SHIFT_WS2812B
|
||||
#define SKIP_PIXELS 1
|
||||
#else
|
||||
#define SKIP_PIXELS 0
|
||||
#endif
|
||||
|
||||
CRGB strip1[STRIP_LENGTH];
|
||||
CRGB strip2[STRIP_LENGTH];
|
||||
#define NUM_LEDS STRIP_LENGTH + SKIP_PIXELS
|
||||
|
||||
// Add one black pixel to the front
|
||||
CRGB strip1[NUM_LEDS];
|
||||
CRGB strip2[NUM_LEDS];
|
||||
|
||||
|
||||
int fadeStart = 0;
|
||||
|
||||
#ifdef LED_NEOPIXEL_BUS
|
||||
NeoPixelBus<NeoGrbFeature, NeoWs2812xMethod> strip(STRIP_LENGTH, PIN_STRIP1);
|
||||
|
||||
#endif
|
||||
|
||||
void fadeTo(const CRGB & dest){
|
||||
@ -40,10 +47,10 @@ void fadeTo(const CRGB & dest){
|
||||
void displayLed(){
|
||||
|
||||
#ifdef LED_FASTLED
|
||||
for(uint8_t index = 0; index < STRIP_LENGTH; index++){
|
||||
for(uint8_t index = SKIP_PIXELS; index < NUM_LEDS; index++){
|
||||
// Serial.printf("Led 1:%02d 0x%02x%02x%02x\n", index, strip1[index].r, strip1[index].g, strip1[index].b);
|
||||
}
|
||||
for(uint8_t index = 0; index < STRIP_LENGTH; index++){
|
||||
for(uint8_t index = SKIP_PIXELS; index < NUM_LEDS; index++){
|
||||
// Serial.printf("Led 2:%02d 0x%02x%02x%02x\n", index, strip2[index].r, strip2[index].g, strip2[index].b);
|
||||
}
|
||||
auto before = micros();
|
||||
@ -73,7 +80,7 @@ void jumpTo(const CRGB & dest){
|
||||
// Serial.printf("FastLED.showColor took %d micros\n", after - before);
|
||||
// return;
|
||||
|
||||
for(uint8_t index = 0; index < STRIP_LENGTH; index++){
|
||||
for(uint8_t index = SKIP_PIXELS; index < NUM_LEDS; index++){
|
||||
strip1[index] = CRGB(dest);
|
||||
strip2[index] = CRGB(dest);
|
||||
}
|
||||
@ -116,8 +123,10 @@ void Led_setup(){
|
||||
// analogWriteRange(255);
|
||||
|
||||
#ifdef LED_FASTLED
|
||||
FastLED.addLeds<WS2812B, PIN_STRIP1>(strip2, STRIP_LENGTH);
|
||||
FastLED.addLeds<WS2812B, PIN_STRIP2>(strip2, STRIP_LENGTH);
|
||||
FastLED.addLeds<WS2812B, PIN_STRIP1>(strip2, NUM_LEDS);
|
||||
FastLED.addLeds<WS2812B, PIN_STRIP2>(strip2, NUM_LEDS);
|
||||
strip1[0] = CRGB::Black;
|
||||
strip2[0] = CRGB::Black;
|
||||
#endif
|
||||
|
||||
#ifdef LED_NEOPIXEL_BUS
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user