mirror of https://github.com/arendst/Tasmota.git
tuya-dimmer: Fix dimmer skipping power/dimmer commands
This tuya dimmer mcu sends data for multiple dimmer ids which breaks `tuya_ignore_dim` logic and sometimes when `power on` is sent its blocked due to multiple serial commands being sent at the same time. This patch makes sure we send dimmer commands only when we need to. Bug is explained in https://github.com/arendst/Sonoff-Tasmota/issues/6215#issuecomment-521191828
This commit is contained in:
parent
52ec4b93f3
commit
f08e7ff5df
|
@ -149,9 +149,11 @@ void LightSerialDuty(uint8_t duty)
|
|||
if(Settings.flag3.tuya_dimmer_range_255 == 0) {
|
||||
duty = changeUIntScale(duty, 0, 255, 0, 100);
|
||||
}
|
||||
if (tuya_new_dim != duty) {
|
||||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: Send dim value=%d (id=%d)"), duty, Settings.param[P_TUYA_DIMMER_ID]);
|
||||
TuyaSendValue(Settings.param[P_TUYA_DIMMER_ID], duty);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tuya_ignore_dim = false; // reset flag
|
||||
if (Settings.flag3.tuya_show_dimmer == 0) {
|
||||
|
@ -215,6 +217,7 @@ void TuyaPacketProcess(void)
|
|||
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: Autoconfiguring Dimmer ID %d"), tuya_buffer[6]);
|
||||
Settings.param[P_TUYA_DIMMER_ID] = tuya_buffer[6];
|
||||
}
|
||||
if (Settings.param[P_TUYA_DIMMER_ID] == tuya_buffer[6]) {
|
||||
if(Settings.flag3.tuya_dimmer_range_255 == 0) {
|
||||
tuya_new_dim = (uint8_t) tuya_buffer[13];
|
||||
} else {
|
||||
|
@ -228,6 +231,7 @@ void TuyaPacketProcess(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case TUYA_CMD_WIFI_RESET:
|
||||
|
|
Loading…
Reference in New Issue