Merge from master

This commit is contained in:
Robert Marshall 2018-09-19 22:18:01 +01:00
commit 65dcc100e2

View file

@ -1,5 +1,3 @@
// see here: https://forum.arduino.cc/index.php?topic=336012.msg2643184#msg2643184 and https://scidle.com/how-to-use-a-ph-sensor-with-arduino/
#include <Wire.h>
#include <Adafruit_ADS1015.h>
#include <PubSubClient.h>
@ -42,7 +40,7 @@ CRGB leds[LED_COUNT];
bool lightsOn = true;
static const uint8_t sunriseLength = 30;
static const uint8_t heatIndexMax = 240;
static const uint8_t heatIndexMax = 241; // After 241 the pallet seems to go dim
static const float lightChangeInterval = ((float)(sunriseLength * 60) / heatIndexMax) * 1000;
static uint8_t heatIndex = 0;
int _lightsOnStartTime, _lightsOnEndTime, _lightsOffStartTime, _lightsOffEndTime;
@ -146,7 +144,7 @@ void setup() {
String json = getSolarEventJson();
parseEvents(json);
FastLED.addLeds<WS2811, LIGHT_PIN, GRB>(leds, LED_COUNT).setCorrection(TypicalSMD5050);//.setTemperature(Tungsten40W);
FastLED.addLeds<WS2811, LIGHT_PIN, GRB>(leds, LED_COUNT).setCorrection(TypicalSMD5050).setTemperature(Tungsten40W);
Serial.print("Light interval: ");
Serial.println(lightChangeInterval);
@ -191,9 +189,9 @@ void publishTemperature() {
void doLighting() {
EVERY_N_MILLISECONDS(lightChangeInterval) {
CRGB color = ColorFromPalette(HeatColors_p, heatIndex);
CRGB colour = ColorFromPalette(HeatColors_p, heatIndex);
fill_solid(leds, LED_COUNT, color);
fill_solid(leds, LED_COUNT, colour);
if (lightsOn){
if(heatIndex < heatIndexMax)
heatIndex++;
@ -202,9 +200,6 @@ void doLighting() {
heatIndex--;
}
Serial.print("Heat index: ");
Serial.println(heatIndex);
FastLED.show();
}
}