Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong Dimmer behavior introduced with #6799 when SetOption37 < 128 #6819

Merged
merged 1 commit into from
Nov 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tasmota/_changelog.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* 7.0.0.2 20191102
* Add command WebColor19 to control color of Module and Name (#6811)
* Add support for Honeywell I2C HIH series Humidity and Temperetaure sensor (#6808)
* Fix wrong Dimmer behavior introduced with #6799 when SetOption37 < 128
*
* 7.0.0.1 20191027
* Remove references to versions before 6.0
Expand Down
22 changes: 15 additions & 7 deletions tasmota/xdrv_04_light.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2163,11 +2163,12 @@ void CmndColorTemperature(void)
void CmndDimmer(void)
{
uint32_t dimmer;

if ((1 == XdrvMailbox.index) || (2 == XdrvMailbox.index)) { // Dimmer1 is RGB, Dimmer 2 iw white
dimmer = light_state.getDimmer(XdrvMailbox.index);
} else {
if (XdrvMailbox.index > 2) { XdrvMailbox.index = 1; }

if ((light_controller.isCTRGBLinked()) || (0 == XdrvMailbox.index)) {
dimmer = light_state.getDimmer();
} else {
dimmer = light_state.getDimmer(XdrvMailbox.index);
}
// Handle +/- special command
if (1 == XdrvMailbox.data_len) {
Expand All @@ -2179,10 +2180,17 @@ void CmndDimmer(void)
}
// If value is ok, change it, otherwise report old value
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 100)) {
if ((1 == XdrvMailbox.index) || (2 == XdrvMailbox.index)) {
light_controller.changeDimmer(XdrvMailbox.payload, XdrvMailbox.index);
} else {
if (light_controller.isCTRGBLinked()) {
// normal state, linked RGB and CW
light_controller.changeDimmer(XdrvMailbox.payload);
} else {
if (0 != XdrvMailbox.index) {
light_controller.changeDimmer(XdrvMailbox.payload, XdrvMailbox.index);
} else {
// change both dimmers
light_controller.changeDimmer(XdrvMailbox.payload, 1);
light_controller.changeDimmer(XdrvMailbox.payload, 2);
}
}
Light.update = true;
LightPreparePower();
Expand Down