Try to fix Mi Desk Lamp

Try to fix Mi Desk Lamp (#8748)
This commit is contained in:
Theo Arends 2020-06-29 16:34:35 +02:00
parent a6a372c2e4
commit acc0562422

View File

@ -127,9 +127,7 @@ void RotaryHandler(void)
DEBUG_CORE_LOG(PSTR("ROT: " D_CMND_COLORTEMPERATURE " %d"), Rotary.position - Rotary.last_position); DEBUG_CORE_LOG(PSTR("ROT: " D_CMND_COLORTEMPERATURE " %d"), Rotary.position - Rotary.last_position);
LightSetColorTemp((uint16_t)t); LightSetColorTemp((uint16_t)t);
} else { } else {
// int8_t d = Settings.light_dimmer; int8_t d = Settings.light_dimmer;
int8_t d = LightGetDimmer(0);
d = d + (Rotary.position - Rotary.last_position); d = d + (Rotary.position - Rotary.last_position);
if (d < 1) { if (d < 1) {
d = 1; d = 1;
@ -138,10 +136,11 @@ void RotaryHandler(void)
d = 100; d = 100;
} }
// DEBUG_CORE_LOG(PSTR("ROT: " D_CMND_DIMMER " %d"), Rotary.position - Rotary.last_position); // 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); char scmnd[20];
// Settings.light_dimmer = d; snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_DIMMER "0 %d"), d);
ExecuteCommand(scmnd, SRC_SWITCH);
} }
} }
Rotary.last_position = 128; Rotary.last_position = 128;