]> www.fi.muni.cz Git - bike-lights.git/commit
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)
commite15cb822c9a62b4f740ea3951f45bd764f051e9c
tree351face8fbf41a9b66cf7d002943ceed2f30d5fd
parent60f1349e85769a3fe43843b46b4232168c08ca98
pwmled.c: mode stabilization

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.
firmware/pwmled.c