From: Jan "Yenya" Kasprzak Date: Wed, 26 Jun 2013 20:35:37 +0000 (+0200) Subject: braking is handled behind the patterns inside pattern.c X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=15758319e9901ada7e67a7c0c3288e53d803f059;hp=15758319e9901ada7e67a7c0c3288e53d803f059;p=bike-lights.git 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. ---