FIx for wierd lighting glitch (constantly halving in brightness, values not being returned, general fuckiness)

This commit is contained in:
Robert Marshall 2018-10-30 12:54:04 +00:00
parent 93b15c9ebb
commit d382a4b0a2
2 changed files with 5 additions and 4 deletions

View file

@ -9,7 +9,8 @@ Lighting::Lighting(int ledCount, NaturalLight* naturalLight, Weather* weather, f
_weather = weather; _weather = weather;
_cloudCoverLimit = cloudCoverLimit; _cloudCoverLimit = cloudCoverLimit;
_leds = CRGB(_ledCount); CRGB leds = CRGB(_ledCount);
_leds = &leds;
} }
float Lighting::getIndexMultiplier(int now, int startTime, int endTime, bool swap) { 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); _nextLightningFlash = millis() + (random8(1, 60) * 1000);
} }
fill_solid(&_leds, _ledCount, colour); fill_solid(_leds, _ledCount, colour);
FastLED.show(); FastLED.show();
} }

View file

@ -15,7 +15,7 @@ class Lighting {
NaturalLight* _naturalLight; NaturalLight* _naturalLight;
Weather* _weather; Weather* _weather;
float _cloudCoverLimit; float _cloudCoverLimit;
CRGB _leds; CRGB* _leds;
CRGBPalette16 _sunrise = _sunrise_p; CRGBPalette16 _sunrise = _sunrise_p;
long _nextLightningFlash = 0; long _nextLightningFlash = 0;
float _heatIndex; float _heatIndex;
@ -30,7 +30,7 @@ class Lighting {
Lighting(int ledCount, NaturalLight* _naturalLight, Weather* _weather, float cloudCoverLimit); Lighting(int ledCount, NaturalLight* _naturalLight, Weather* _weather, float cloudCoverLimit);
template<uint8_t DATA_PIN> void setup() { template<uint8_t DATA_PIN> void setup() {
FastLED.addLeds<WS2811, DATA_PIN, GRB>(&_leds, _ledCount).setCorrection(TypicalSMD5050).setTemperature(Tungsten40W); FastLED.addLeds<WS2811, DATA_PIN, GRB>(_leds, _ledCount).setCorrection(TypicalSMD5050).setTemperature(Tungsten40W);
} }
void update(int time); void update(int time);
float getCurrentHeatIndex() { return _heatIndex; } float getCurrentHeatIndex() { return _heatIndex; }