From 90693e8c2a07b5ec803b70e98b31d36884929176 Mon Sep 17 00:00:00 2001 From: Dominic DiTaranto Date: Mon, 19 Jan 2026 18:57:38 -0500 Subject: [PATCH] encoder constrols screen --- master_clock.ino | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/master_clock.ino b/master_clock.ino index 2e43ef2..9eb1947 100644 --- a/master_clock.ino +++ b/master_clock.ino @@ -188,9 +188,9 @@ void checkRPot() { Serial.println(currentPos); if (currentPos > previousPos) { - BPM++; + handleBPMChange(1); } else { - BPM--; + handleBPMChange(0); } forceScreenUpdate = 1; @@ -202,6 +202,17 @@ void checkRPot() { } } +void handleBPMChange(byte increase) { + if (increase == 1) { + BPM++; + } else { + BPM--; + } + + period = (minute / BPM) / ppqn; + Timer1.setPeriod(period); +} + void updateEncoder() { // The ISR should be as short and fast as possible // Check the state of the DT pin to determine direction