From c274b2d6ca11dff3e602804f0b7d143f59d35d1a Mon Sep 17 00:00:00 2001 From: Hendrik Langer Date: Wed, 7 Feb 2018 16:53:20 +0100 Subject: [PATCH] sunrise --- src/led.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/led.cpp b/src/led.cpp index 5d8dc99..d934177 100644 --- a/src/led.cpp +++ b/src/led.cpp @@ -40,14 +40,31 @@ void Led::loop_off(void) { if (wakeupIndex == 0) { fill_solid(leds, NUM_LEDS, CRGB::Black); } else { - fill_solid(leds, NUM_LEDS, CRGB::White); + CRGB color = ColorFromPalette(HeatColors_p, wakeupIndex); + fill_solid(leds, NUM_LEDS, color); +// fadeToBlackBy( leds, NUM_LEDS, 255-wakeupIndex); FastLED.setBrightness(wakeupIndex); + if (wakeupIndex < 100) { + leds[3] = CRGB::Black; + leds[NUM_LEDS-4] = CRGB::Black; + } + if (wakeupIndex < 150) { + leds[2] = CRGB::Black; + leds[NUM_LEDS-3] = CRGB::Black; + } + if (wakeupIndex < 200) { + leds[1] = CRGB::Black; + leds[NUM_LEDS-2] = CRGB::Black; + } + if (wakeupIndex < 250) { + leds[0] = CRGB::Black; + leds[NUM_LEDS-1] = CRGB::Black; + } + } } void Led::wakeUpLight(uint8_t i) { - fill_solid(leds, NUM_LEDS, CRGB::White); - FastLED.setBrightness(i); Serial.printf("wakeuplight(%d)\n", i); wakeupIndex = i; }