]> www.fi.muni.cz Git - bike-lights.git/commitdiff
pwmled.c: mode stabilization
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Fri, 19 Jul 2013 21:03:57 +0000 (23:03 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Fri, 19 Jul 2013 21:03:57 +0000 (23:03 +0200)
When changing brightness via pwmled_set_brightness() below,
we want to converge to the target value as fast as possible. Also,
we would like to somehow initialize the mode 3, which is used as
"mode 2 + other PWMLED on". So after the brightness is set,
we also set pwmleds[n].modes_not_yet_stable to MODE_STABILIZATION_TIME.
When modes_not_yet_stable is non-zero, we allow only mode 2 to be set
regardless of what is fed to pwmled_set_mode. We will then converge
to the target value of mode 2 only, and after MODE_STABILIZATION_TIME
ADC measurements, we copy the mode_pwm value to all other modes.
Only then it is allowed to set the other modes.


No differences found