]> www.fi.muni.cz Git - bike-lights.git/commitdiff
pwmled.c: disable the disconnected step-up earlier
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sun, 16 Dec 2012 16:26:50 +0000 (17:26 +0100)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Sun, 16 Dec 2012 16:26:50 +0000 (17:26 +0100)
firmware/pwmled.c

index fcde84a35a3f103968441a1a9663ee28f6bc3ecb..9a8deac4658bae6ddbb349c0196d4935d13f248e 100644 (file)
@@ -218,7 +218,8 @@ void pwmled_adc(unsigned char n, uint16_t adcval)
        sum -= led->pwm << shift;
        led->err_sum = sum;
 
-       if (led->pwm >= PWM_MAX) {
+       if (led->pwm >= PWM_MAX
+               || (n == 1 && led->pwm > PWM_MAX/4 && adcval < 0x08)) {
                pwmled_err(n);
                return;
        }