#include #include "NaturalLight.h" #include "Weather.h" DEFINE_GRADIENT_PALETTE(_sunrise_p) { 0, 0, 0, 0, 8, 0, 0, 16, 128, 255, 128, 0, 224, 255, 255, 0, 240, 255, 255, 255, // Hack to get around LINEARBLEND problem (for now, hopefully) 255, 255, 255, 255 }; class Lighting { int _ledCount, _whitePin; NaturalLight* _naturalLight; Weather* _weather; float _cloudCoverLimit; CRGB* _leds; CRGBPalette16 _sunrise = _sunrise_p; long _nextLightningFlash = 0; float _heatIndex; float _brightness; float _currentHeatIndex(); float getIndexMultiplier(int now, int startTime, int endTime, bool swap); float getHeatIndex(int time); float getPaletteHeatIndex(int time); float getBrightness(); float getPaletteBrightness(); void updateRGB(int now); void updateWhite(); public: Lighting(int ledCount, NaturalLight* _naturalLight, Weather* _weather, float cloudCoverLimit); template void setup() { FastLED.addLeds(_leds, _ledCount).setCorrection(TypicalSMD5050).setTemperature(Tungsten40W); _whitePin = WHITE_PIN; pinMode(_whitePin, OUTPUT); } void update(int time); float getCurrentHeatIndex() { return _heatIndex; } float getCurrentBrightness() { return _brightness; } };