diff --git a/src/Led.cpp b/src/Led.cpp index 0cf787e..49eaa91 100644 --- a/src/Led.cpp +++ b/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 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(strip2, STRIP_LENGTH); - FastLED.addLeds(strip2, STRIP_LENGTH); + FastLED.addLeds(strip2, NUM_LEDS); + FastLED.addLeds(strip2, NUM_LEDS); + strip1[0] = CRGB::Black; + strip2[0] = CRGB::Black; #endif #ifdef LED_NEOPIXEL_BUS diff --git a/src/Led.h b/src/Led.h index 35e1b72..08e542a 100644 --- a/src/Led.h +++ b/src/Led.h @@ -24,6 +24,7 @@ #define PIN_STRIP2 6 #define STRIP_LENGTH 46 +#define LEVEL_SHIFT_WS2812B #define FADE_PERIOD 3.0f