From 12e756fef1a6e820664a8fa0eeeed2ebe203f062 Mon Sep 17 00:00:00 2001 From: Robert Marshall Date: Sun, 3 Mar 2019 21:35:55 +0000 Subject: [PATCH] Refactor lighting with define guard and cammel case template variables (so the macros in monitor.ino don't overwrite) --- Lighting.h | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Lighting.h b/Lighting.h index df46f0d..e120a7f 100644 --- a/Lighting.h +++ b/Lighting.h @@ -1,3 +1,6 @@ +#ifndef Lighting_h +#define Lighting_h + #include #include "NaturalLight.h" #include "Weather.h" @@ -38,20 +41,20 @@ class Lighting { public: Lighting(NaturalLight* _naturalLight, Weather* _weather, float cloudCoverLimit); - template void setupStrip() { - _ledCount = LED_COUNT; - FastLED.addLeds(_leds, _ledCount).setCorrection(TypicalSMD5050).setTemperature(Tungsten40W); - _whitePin = WHITE_PIN; + template void setupStrip() { + _ledCount = ledCount; + FastLED.addLeds(_leds, _ledCount).setCorrection(TypicalSMD5050).setTemperature(Tungsten40W); + _whitePin = whitePin; pinMode(_whitePin, OUTPUT); analogWrite(_whitePin, 0); _useStrip = true; } - template void setupPWM() { - _rPin = R_PIN; - _gPin = G_PIN; - _bPin = B_PIN; - _whitePin = WHITE_PIN; + template void setupPWM() { + _rPin = rPin; + _gPin = gPin; + _bPin = bPin; + _whitePin = whitePin; pinMode(_rPin, OUTPUT); pinMode(_gPin, OUTPUT); pinMode(_bPin, OUTPUT); @@ -66,4 +69,6 @@ class Lighting { void update(int time); float getCurrentHeatIndex() { return _heatIndex; } float getCurrentBrightness() { return _brightness; } -}; \ No newline at end of file +}; + +#endif \ No newline at end of file