From 409d2f7f905191b94df90b01a8068864cf8876fe Mon Sep 17 00:00:00 2001 From: Niklas Wagner Date: Fri, 29 Jun 2018 21:25:14 +0200 Subject: [PATCH] _light_mireds must be set before we return; --- code/espurna/light.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/espurna/light.ino b/code/espurna/light.ino index 5ecd79cd..f1146949 100644 --- a/code/espurna/light.ino +++ b/code/espurna/light.ino @@ -282,14 +282,14 @@ void _fromHSV(const char * hsv) { void _fromKelvin(unsigned long kelvin) { if (!_light_has_color) return; + + _light_mireds = constrain(round(1000000UL / kelvin), LIGHT_MIN_MIREDS, LIGHT_MAX_MIREDS); if (_light_use_cct) { _setRGBInputValue(LIGHT_MAX_VALUE, LIGHT_MAX_VALUE, LIGHT_MAX_VALUE); return; } - _light_mireds = constrain(round(1000000UL / kelvin), LIGHT_MIN_MIREDS, LIGHT_MAX_MIREDS); - // Calculate colors kelvin /= 100; unsigned int red = (kelvin <= 66)