Tune rotary encoder color control

This commit is contained in:
Theo Arends 2020-06-30 18:00:14 +02:00
parent 828a64815b
commit b6495598de
2 changed files with 3 additions and 3 deletions

View File

@ -98,7 +98,7 @@ void RotaryHandler(void) {
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ROT: " D_CMND_COLORTEMPERATURE " %d"), rotary_position);
Rotary.changed = 1;
if (!LightColorTempOffset(rotary_position * 4)) { // Ct from 153 - 500
LightColorOffset(rotary_position * 4); // Hue from 0 - 359
LightColorOffset(rotary_position * 2); // Hue from 0 - 359
}
} else {
// AddLog_P2(LOG_LEVEL_DEBUG, PSTR("ROT: " D_CMND_DIMMER " %d"), rotary_position);

View File

@ -1483,8 +1483,8 @@ void LightColorOffset(int32_t offset) {
uint8_t sat;
light_state.getHSB(&hue, &sat, nullptr); // Allow user control over Saturation
hue += offset;
if (hue < 0) { hue = 0; }
if (hue > 359) { hue = 359; }
if (hue < 0) { hue += 359; }
if (hue > 359) { hue -= 359; }
if (!Light.pwm_multi_channels) {
light_state.setHS(hue, sat);
} else {