From acc05624220cdb98fdd1396f6a10a379270c2a2a Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 29 Jun 2020 16:34:35 +0200 Subject: [PATCH] Try to fix Mi Desk Lamp Try to fix Mi Desk Lamp (#8748) --- tasmota/support_rotary.ino | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tasmota/support_rotary.ino b/tasmota/support_rotary.ino index f7543be0b..ad13bf1f1 100644 --- a/tasmota/support_rotary.ino +++ b/tasmota/support_rotary.ino @@ -127,9 +127,7 @@ void RotaryHandler(void) DEBUG_CORE_LOG(PSTR("ROT: " D_CMND_COLORTEMPERATURE " %d"), Rotary.position - Rotary.last_position); LightSetColorTemp((uint16_t)t); } else { -// int8_t d = Settings.light_dimmer; - int8_t d = LightGetDimmer(0); - + int8_t d = Settings.light_dimmer; d = d + (Rotary.position - Rotary.last_position); if (d < 1) { d = 1; @@ -138,10 +136,11 @@ void RotaryHandler(void) d = 100; } // DEBUG_CORE_LOG(PSTR("ROT: " D_CMND_DIMMER " %d"), Rotary.position - Rotary.last_position); - AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ROT: " D_CMND_DIMMER " %d"), d); +// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ROT: " D_CMND_DIMMER " %d"), d); - LightSetDimmer((uint8_t)d); -// Settings.light_dimmer = d; + char scmnd[20]; + snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_DIMMER "0 %d"), d); + ExecuteCommand(scmnd, SRC_SWITCH); } } Rotary.last_position = 128;