Menu system fixes; made state less global

This commit is contained in:
Brian Hrebec 2023-08-29 13:32:56 -05:00
parent cfc2390b8b
commit 209959e2de
14 changed files with 964 additions and 731 deletions

View file

@ -103,8 +103,22 @@ void errorWait() {
}
}
/*
* Read the knob value accounting for 4x precision - NB this might not work on other kinds of encoder
*/
int readKnob(uint8_t n) {
return knobs[n].readAndReset();
int out = 0;
int32_t val = knobs[n].read();
if (val > 4) {
out = val / 4;
} else if (val < -4) {
out = val / 4;
}
if (out != 0) {
knobs[n].write(0);
}
return out;
}
int readTouchKey(uint8_t n) {