ajout de colortemp

This commit is contained in:
Julien Cabillot 2017-03-10 11:09:19 +01:00 committed by Cabillot Julien
parent a8c09dd27b
commit 4e0c1ff950

View File

@ -312,6 +312,36 @@ void SetupPurpleAndGreenPalette()
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////// ColorTemperature
void colorTemp()
{
// draw a generic, no-name rainbow
static uint8_t starthue = 0;
fill_rainbow( leds + 5, LED_NUM - 5, --starthue, 20);
// Choose which 'color temperature' profile to enable.
uint8_t secs = (millis() / 1000) % (DISPLAYTIME * 2);
if( secs < DISPLAYTIME) {
FastLED.setTemperature( TEMPERATURE_1 ); // first temperature
leds[0] = TEMPERATURE_1; // show indicator pixel
} else {
FastLED.setTemperature( TEMPERATURE_2 ); // second temperature
leds[0] = TEMPERATURE_2; // show indicator pixel
}
// Black out the LEDs for a few secnds between color changes
// to let the eyes and brains adjust
if( (secs % DISPLAYTIME) < BLACKTIME) {
memset8( leds, 0, LED_NUM * sizeof(CRGB));
}
FastLED.show();
FastLED.delay(8);
}
////////////////////////////////////////////////////////////////////
void loop() {
// MQTT
testConnectMQTT();
@ -325,8 +355,10 @@ void loop() {
ledCylon();
} else if (ledEffect == LED_EFFECT_FULLRED) {
ledFullColor();
} else if (ledEffect == LED_EFFET_COLORPATTERN) {
} else if (ledEffect == LED_EFFECT_COLORPATTERN) {
ledColorPattern();
} else if (ledEffect == LED_EFFECT_COLORTEMP) {
colorTemp();
} else {
ledError();
}