Fix Toggle functionality to button double press when one button and two devices are detected

Fix Toggle functionality to button double press when one button and two devices are detected (#5935)
This commit is contained in:
Theo Arends 2019-06-09 17:54:13 +02:00
parent d3eaf7491d
commit 09dcb93489
2 changed files with 6 additions and 3 deletions

View File

@ -6,6 +6,7 @@
* Add command SetOption65 0/1 and more Tuya Serial based device support (#5815)
* Fix include of my_user_config.h in sonoff_aws_iot.cpp (#5930)
* Fix exception 9 when syslog is enabled and NTP is just synced (#5917)
* Fix Toggle functionality to button double press when one button and two devices are detected (#5935)
*
* 6.5.0.14 20190602
* Change webserver HTML input, button, textarea, and select name based on id

View File

@ -218,11 +218,13 @@ void ButtonHandler(void)
if ((SONOFF_DUAL_R2 == my_module_type) || (SONOFF_DUAL == my_module_type) || (CH4 == my_module_type)) {
single_press = true;
} else {
if ((0 == button_index) && (1 == buttons_present)) { // Single Button1 only
single_press = (Settings.flag.button_swap +1 == multipress[button_index]); // SetOption11 (0)
if (Settings.flag.button_swap) { // SetOption11 (0)
single_press = (Settings.flag.button_swap +1 == multipress[button_index]); // SetOption11 (0)
if ((1 == buttons_present) && (2 == devices_present)) { // Single Button with two devices only
if (Settings.flag.button_swap) { // SetOption11 (0)
multipress[button_index] = (single_press) ? 1 : 2;
}
} else {
multipress[button_index] = 1;
}
}
}