AC-Dimmer update

change to linear power distribution on PWM
This commit is contained in:
stefanbode 2022-11-24 09:39:46 +01:00 committed by GitHub
parent 7dd0003617
commit 8bc46aa0d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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
}
}