unsigned overflow fixed (#19221)

fixed overflow on negative value with dimmer 100%
This commit is contained in:
stefanbode 2023-07-30 15:01:21 +02:00 committed by GitHub
parent 2c15cfe4da
commit 355b1e3b74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -150,7 +150,7 @@ void IRAM_ATTR ACDimmerTimer_intr() {
time_since_zc = micros() - ac_zero_cross_dimmer.crossed_zero_at; time_since_zc = micros() - ac_zero_cross_dimmer.crossed_zero_at;
} }
#endif #endif
if (time_since_zc >= ac_zero_cross_dimmer.enable_time_us[i]-5 && !ac_zero_cross_dimmer.triggered[i] ) { if (time_since_zc+5 >= ac_zero_cross_dimmer.enable_time_us[i] && !ac_zero_cross_dimmer.triggered[i] ) {
digitalWrite(Pin(GPIO_PWM1, i), HIGH ^ ac_zero_cross_dimmer.fallingEdgeDimmer ); digitalWrite(Pin(GPIO_PWM1, i), HIGH ^ ac_zero_cross_dimmer.fallingEdgeDimmer );
ac_zero_cross_dimmer.triggered[i] = true; ac_zero_cross_dimmer.triggered[i] = true;
ac_zero_cross_dimmer.accurracy[i] = time_since_zc-ac_zero_cross_dimmer.enable_time_us[i]; ac_zero_cross_dimmer.accurracy[i] = time_since_zc-ac_zero_cross_dimmer.enable_time_us[i];