From b6495598de81e558ea93b8dd86a5d83ba48be884 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 30 Jun 2020 18:00:14 +0200 Subject: [PATCH] Tune rotary encoder color control --- tasmota/support_rotary.ino | 2 +- tasmota/xdrv_04_light.ino | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tasmota/support_rotary.ino b/tasmota/support_rotary.ino index 58f9925b3..66fd1cd5c 100644 --- a/tasmota/support_rotary.ino +++ b/tasmota/support_rotary.ino @@ -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); diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 0562cc900..00cdd96b6 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -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 {