Put in hack to reduce flickering issue.
This commit is contained in:
parent
c0c4e75db0
commit
ccbbf6e4c1
3 changed files with 23 additions and 16 deletions
30
Lighting.cpp
30
Lighting.cpp
|
@ -42,21 +42,27 @@ float Lighting::getPaletteBrightness(){
|
|||
}
|
||||
|
||||
void Lighting::updateRGB(int now) {
|
||||
CRGB colour = ColorFromPalette(_sunrise, getPaletteHeatIndex(now), getPaletteBrightness(), LINEARBLEND);
|
||||
byte heatIndex = getPaletteHeatIndex(now);
|
||||
byte brightness = getPaletteBrightness();
|
||||
if (heatIndex != _lastHeatIndex || brightness!=_lastBrightness) {
|
||||
CRGB colour = ColorFromPalette(_sunrise, heatIndex, brightness, LINEARBLEND);
|
||||
|
||||
if (_weather->getCondition() == WeatherCondition::Thunder && millis() >= _nextLightningFlash) {
|
||||
int flashes = random8(2, 8);
|
||||
for (int i = 0; i < flashes; i++) {
|
||||
FastLED.showColor(CRGB::White);
|
||||
delay(random8(10, 20));
|
||||
FastLED.showColor(colour);
|
||||
delay(random8(40, 80));
|
||||
if (_weather->getCondition() == WeatherCondition::Thunder && millis() >= _nextLightningFlash) {
|
||||
int flashes = random8(2, 8);
|
||||
for (int i = 0; i < flashes; i++) {
|
||||
FastLED.showColor(CRGB::White);
|
||||
delay(random8(10, 20));
|
||||
FastLED.showColor(colour);
|
||||
delay(random8(40, 80));
|
||||
}
|
||||
_nextLightningFlash = millis() + (random8(1, 60) * 1000);
|
||||
}
|
||||
_nextLightningFlash = millis() + (random8(1, 60) * 1000);
|
||||
}
|
||||
|
||||
fill_solid(_leds, _ledCount, colour);
|
||||
FastLED.show();
|
||||
fill_solid(_leds, _ledCount, colour);
|
||||
FastLED.show();
|
||||
}
|
||||
_lastHeatIndex = heatIndex;
|
||||
_lastBrightness = brightness;
|
||||
}
|
||||
|
||||
void Lighting::updateWhite(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue