From 8bc46aa0d965c1745cade6c6b4778448553cd234 Mon Sep 17 00:00:00 2001 From: stefanbode Date: Thu, 24 Nov 2022 09:39:46 +0100 Subject: [PATCH] AC-Dimmer update change to linear power distribution on PWM --- tasmota/tasmota_xdrv_driver/xdrv_04_light.ino | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino b/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino index c865603c8..6f665d27b 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_04_light.ino @@ -2191,11 +2191,11 @@ void LightSetOutputs(const uint16_t *cur_col_10) { } if (!Settings->flag4.zerocross_dimmer) { #ifdef ESP32 - TasmotaGlobal.pwm_value[i] = cur_col; // mark the new expected value - // AddLog(LOG_LEVEL_DEBUG_MORE, "analogWrite-%i 0x%03X", i, cur_col); + TasmotaGlobal.pwm_value[i] = ac_zero_cross_power(cur_col); // mark the new expected value + // AddLog(LOG_LEVEL_DEBUG_MORE, "analogWrite-%i 0x%03X", i, cur_col2); #else // ESP32 - analogWrite(Pin(GPIO_PWM1, i), bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range - cur_col : cur_col); - // AddLog(LOG_LEVEL_DEBUG_MORE, "analogWrite-%i 0x%03X", bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range - cur_col : cur_col); + analogWrite(Pin(GPIO_PWM1, i), bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range - ac_zero_cross_power(cur_col) : ac_zero_cross_power(cur_col)); + // AddLog(LOG_LEVEL_DEBUG_MORE, "analogWrite-%i 0x%03X", bitRead(TasmotaGlobal.pwm_inverted, i) ? Settings->pwm_range - cur_col2 : cur_col2); #endif // ESP32 } }