]> www.fi.muni.cz Git - bike-lights.git/commitdiff
pwmled.c: reload ADC target data after setting the brightness
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Tue, 25 Jun 2013 20:16:47 +0000 (22:16 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 26 Jun 2013 09:10:11 +0000 (11:10 +0200)
firmware/pwmled.c

index b8f702a766f2b9b39b5dac9b16ce0890d4fd6e22..bf376eea98aeb71357effc5e19ac9902eef351e0 100644 (file)
@@ -138,8 +138,10 @@ void pwmled_set_brightness(uint16_t brightness)
        adc_vals[7] = adc_targets_2[(brightness >> 12) & 0x7];
        adc_vals[8] = adc_vals[7];
 
-       for (i = 0; i < N_PWMLEDS; i++)
+       for (i = 0; i < N_PWMLEDS; i++) {
                pwmleds[i].err_sum = 0;
+               pwmled_set_mode(i, pwmleds[i].mode);
+       }
 }
 
 #define PWMLED_PROBE_STEADY_COUNT 10