Sort out colour

This commit is contained in:
Robert Marshall 2018-09-16 19:43:15 +01:00
parent 58ef89e943
commit 346706bc2d

View file

@ -34,7 +34,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;
@ -83,7 +83,7 @@ void setup() {
WiFi.begin(SSID, PASSWORD);
reconnect();
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);
@ -132,9 +132,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++;
@ -143,9 +143,6 @@ void doLighting() {
heatIndex--;
}
Serial.print("Heat index: ");
Serial.println(heatIndex);
FastLED.show();
}
}