]> www.fi.muni.cz Git - bike-lights.git/commit - firmware/control.c
braking is handled behind the patterns inside pattern.c
authorJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 26 Jun 2013 20:35:37 +0000 (22:35 +0200)
committerJan "Yenya" Kasprzak <kas@fi.muni.cz>
Wed, 26 Jun 2013 20:36:59 +0000 (22:36 +0200)
commit15758319e9901ada7e67a7c0c3288e53d803f059
tree97784a3403af5702cac41ee9a73a81f3de07d8ac
parentb8e8d71d31246f04d261e8cd71055f4c980a039a
braking is handled behind the patterns inside pattern.c

See the comment above pwmled_update_mode():

This is tricky: we use a single pattern for all three pwmleds,
but on some occasions, we want to be able to modify only a single
pwmled status without affecting other outputs. For example, during
braking, we want to modify only the rear pwmled status. We don't
use a separate "braking" pattern for every other pattern used, but instead
we change the pwmled0 status regardless of the original value when
braking. The rule is the following:
- if during braking the pwmled2 (front) is at mode 2, we switch it to
    mode 3 (which has the same target current) to avoid flicker.
- if pwmled0 (rear) is off, we set it to mode 2
    (if it is with mode 1, we keep it at mode 1)
TODO: something similar should be done for the "entering the dark area"
    condition, where we want to switch pwmled2 (front) on, to mode 2.
firmware/control.c
firmware/lights.h
firmware/pattern.c