From 94fcff6794f348a6e7b37de360adae844c0914c4 Mon Sep 17 00:00:00 2001 From: Shantur Rathore Date: Tue, 29 Oct 2019 10:50:56 +0000 Subject: [PATCH] TuyaMCU: Change dimmer scale before comparing with dimmer ranges. Fixes #6780 --- tasmota/xdrv_16_tuyamcu.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasmota/xdrv_16_tuyamcu.ino b/tasmota/xdrv_16_tuyamcu.ino index 608303efc..f2a4c9400 100644 --- a/tasmota/xdrv_16_tuyamcu.ino +++ b/tasmota/xdrv_16_tuyamcu.ino @@ -377,8 +377,8 @@ void LightSerialDuty(uint16_t duty) { uint8_t dpid = TuyaGetDpId(TUYA_MCU_FUNC_DIMMER); if (duty > 0 && !Tuya.ignore_dim && TuyaSerial && dpid > 0) { - if (duty < Settings.dimmer_hw_min) { duty = Settings.dimmer_hw_min; } // dimming acts odd below 25(10%) - this mirrors the threshold set on the faceplate itself duty = changeUIntScale(duty, 0, 255, 0, Settings.dimmer_hw_max); + if (duty < Settings.dimmer_hw_min) { duty = Settings.dimmer_hw_min; } // dimming acts odd below 25(10%) - this mirrors the threshold set on the faceplate itself if (Tuya.new_dim != duty) { AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: Send dim value=%d (id=%d)"), duty, dpid); TuyaSendValue(dpid, duty);