encoder constrols screen

This commit is contained in:
Dominic DiTaranto 2026-01-19 18:57:38 -05:00
parent e317595cdd
commit 90693e8c2a

View file

@ -188,9 +188,9 @@ void checkRPot() {
Serial.println(currentPos); Serial.println(currentPos);
if (currentPos > previousPos) { if (currentPos > previousPos) {
BPM++; handleBPMChange(1);
} else { } else {
BPM--; handleBPMChange(0);
} }
forceScreenUpdate = 1; 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() { void updateEncoder() {
// The ISR should be as short and fast as possible // The ISR should be as short and fast as possible
// Check the state of the DT pin to determine direction // Check the state of the DT pin to determine direction