diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2019-12-23 08:13:14 -0800 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2019-12-23 08:13:14 -0800 |
commit | ed5a276f9b8a5da636e5cda4f3e33a54b0382bdf (patch) | |
tree | 7b4a58d29c1b0fd685803af23ef168787c4f3b73 /eq.c | |
parent | 335b89cbd79d2623a68984f6d99e7480272a44e9 (diff) | |
download | christmas_lights-ed5a276f9b8a5da636e5cda4f3e33a54b0382bdf.tar.gz christmas_lights-ed5a276f9b8a5da636e5cda4f3e33a54b0382bdf.tar.xz |
minor adjustments and fixes
Diffstat (limited to 'eq.c')
-rw-r--r-- | eq.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -27,7 +27,7 @@ static unsigned char map_level(unsigned char val, unsigned char min, unsigned ch else if (val >= max) return 255; else - return val * 255 / (max - min); + return (val - min) * 255 / (max - min); } void eq_read() { @@ -42,10 +42,12 @@ void eq_read() { } } -void eq_decay() { - reset(); +void eq_decay(int cycles) { + for (int i = 0; i < cycles; ++i) { + reset(); - for (int i = 0; i < 7; ++i) { - strobe(); + for (int i = 0; i < 7; ++i) { + strobe(); + } } } |