From ed5a276f9b8a5da636e5cda4f3e33a54b0382bdf Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Mon, 23 Dec 2019 08:13:14 -0800 Subject: minor adjustments and fixes --- eq.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'eq.c') 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(); + } } } -- cgit v1.2.3-70-g09d2