Merge pull request #4099 from chaosmaster/tuya-dimmer-reset-handler

Add reset-button-handler vor tuya-dimmer
This commit is contained in:
Theo Arends 2018-10-18 16:42:30 +02:00 committed by GitHub
commit 32f79a7b5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 1 deletions

View File

@ -1723,7 +1723,20 @@ void ButtonHandler()
ExecuteCommandPower(button_index +1, POWER_TOGGLE, SRC_BUTTON); // Execute Toggle command internally ExecuteCommandPower(button_index +1, POWER_TOGGLE, SRC_BUTTON); // Execute Toggle command internally
} }
} }
} else { }
#ifdef USE_TUYA_DIMMER
else if (TUYA_DIMMER == Settings.module) {
if ((PRESSED == button) && (NOT_PRESSED == lastbutton[button_index])) {
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_LEVEL_10), button_index +1);
AddLog(LOG_LEVEL_DEBUG);
if (!Settings.flag.button_restrict) {
snprintf_P(scmnd, sizeof(scmnd), D_CMND_WIFICONFIG " %d", 2);
ExecuteCommand(scmnd, SRC_BUTTON);
}
}
}
#endif
else {
if ((PRESSED == button) && (NOT_PRESSED == lastbutton[button_index])) { if ((PRESSED == button) && (NOT_PRESSED == lastbutton[button_index])) {
if (Settings.flag.button_single) { // Allow only single button press for immediate action if (Settings.flag.button_single) { // Allow only single button press for immediate action
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_IMMEDIATE), button_index +1); snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_APPLICATION D_BUTTON "%d " D_IMMEDIATE), button_index +1);