Try to fix mi desk lamp

Try to fix mi desk lamp (#8748)
This commit is contained in:
Theo Arends 2020-06-28 12:54:44 +02:00
parent 7dafeb280e
commit 609b0309fa
1 changed files with 6 additions and 3 deletions

View File

@ -127,7 +127,9 @@ 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 = Settings.light_dimmer;
int8_t d = LightGetDimmer(0);
d = d + (Rotary.position - Rotary.last_position);
if (d < 1) {
d = 1;
@ -135,10 +137,11 @@ void RotaryHandler(void)
if (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);
LightSetDimmer((uint8_t)d);
Settings.light_dimmer = d;
// Settings.light_dimmer = d;
}
}
Rotary.last_position = 128;