diff --git a/Lighting.cpp b/Lighting.cpp index 150a186..6047e9a 100644 --- a/Lighting.cpp +++ b/Lighting.cpp @@ -9,7 +9,8 @@ Lighting::Lighting(int ledCount, NaturalLight* naturalLight, Weather* weather, f _weather = weather; _cloudCoverLimit = cloudCoverLimit; - _leds = CRGB(_ledCount); + CRGB leds = CRGB(_ledCount); + _leds = &leds; } float Lighting::getIndexMultiplier(int now, int startTime, int endTime, bool swap) { @@ -50,6 +51,6 @@ void Lighting::update(int now) { _nextLightningFlash = millis() + (random8(1, 60) * 1000); } - fill_solid(&_leds, _ledCount, colour); + fill_solid(_leds, _ledCount, colour); FastLED.show(); } \ No newline at end of file diff --git a/Lighting.h b/Lighting.h index b1c1c98..f78276d 100644 --- a/Lighting.h +++ b/Lighting.h @@ -15,7 +15,7 @@ class Lighting { NaturalLight* _naturalLight; Weather* _weather; float _cloudCoverLimit; - CRGB _leds; + CRGB* _leds; CRGBPalette16 _sunrise = _sunrise_p; long _nextLightningFlash = 0; float _heatIndex; @@ -30,7 +30,7 @@ class Lighting { Lighting(int ledCount, NaturalLight* _naturalLight, Weather* _weather, float cloudCoverLimit); template void setup() { - FastLED.addLeds(&_leds, _ledCount).setCorrection(TypicalSMD5050).setTemperature(Tungsten40W); + FastLED.addLeds(_leds, _ledCount).setCorrection(TypicalSMD5050).setTemperature(Tungsten40W); } void update(int time); float getCurrentHeatIndex() { return _heatIndex; }