From: Jan "Yenya" Kasprzak Date: Sun, 16 Dec 2012 16:26:50 +0000 (+0100) Subject: pwmled.c: disable the disconnected step-up earlier X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=5742ccfd6f39275f7e87795331ca465b776d5f7d;p=bike-lights.git pwmled.c: disable the disconnected step-up earlier --- diff --git a/firmware/pwmled.c b/firmware/pwmled.c index fcde84a..9a8deac 100644 --- a/firmware/pwmled.c +++ b/firmware/pwmled.c @@ -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; }