Browse Source

ajout de colortemp

master
Julien Cabillot 3 years ago
committed by Cabillot Julien
parent
commit
4e0c1ff950
1 changed files with 33 additions and 1 deletions
  1. 34
      arduino/mqttfastledmenu/mqttfastledmenu.cpp

34
arduino/mqttfastledmenu/mqttfastledmenu.cpp

@ -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();
}

Loading…
Cancel
Save