summaryrefslogtreecommitdiff
path: root/eq.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2019-12-23 08:13:14 -0800
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2019-12-23 08:13:14 -0800
commited5a276f9b8a5da636e5cda4f3e33a54b0382bdf (patch)
tree7b4a58d29c1b0fd685803af23ef168787c4f3b73 /eq.c
parent335b89cbd79d2623a68984f6d99e7480272a44e9 (diff)
downloadchristmas_lights-ed5a276f9b8a5da636e5cda4f3e33a54b0382bdf.tar.gz
christmas_lights-ed5a276f9b8a5da636e5cda4f3e33a54b0382bdf.tar.xz
minor adjustments and fixes
Diffstat (limited to 'eq.c')
-rw-r--r--eq.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/eq.c b/eq.c
index eb7febd..846e1fa 100644
--- a/eq.c
+++ b/eq.c
@@ -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();
+ }
}
}