33 lines
1.2 KiB
C++
33 lines
1.2 KiB
C++
void checkInputs() {
|
|
|
|
//encoder
|
|
if (millis() > encoderCheckTime + 20) { //debouncing. this approach doesn't work. very noisy
|
|
checkEncoderStatus();
|
|
}
|
|
|
|
if (encoderChange != 0) {
|
|
if (!reverseEnc) {
|
|
encoderChange = encoderChange * -1;
|
|
}
|
|
counter += encoderChange;
|
|
|
|
/*if (((encoderChange > 0) != encoderDirectionOld) && encoderTimeBetweenPulses < 60) { //filter out encoder "jumps".
|
|
encoderChange = 0; //Comented out because it seems like sometimes it was preventing normal scroll
|
|
} //if it works ok without it delete encoderDirectionOld var altogether
|
|
encoderDirectionOld = (encoderChange > 0);*/
|
|
|
|
//encoder acceleration
|
|
/*if (encoderTimeBetweenPulses < 15) { // <--
|
|
encoderBurstCount++;
|
|
} else {
|
|
encoderBurstCount = 0;
|
|
}
|
|
if (encoderBurstCount > 3) { // <--
|
|
encoderChange = encoderChange * 3; // <-- The three params need to be finetuned to feel natural
|
|
}*/
|
|
|
|
updateScreen();
|
|
//encPositionOld = encPosition;
|
|
encoderChange = 0;
|
|
}
|
|
} |