From d382a4b0a2117a3bebe063505f44a3bf6ac43e56 Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Tue, 30 Oct 2018 12:54:04 +0000 Subject: [PATCH] FIx for wierd lighting glitch (constantly halving in brightness, values not being returned, general fuckiness) --- Lighting.cpp | 5 +++-- Lighting.h | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) 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; }