Some (unsuccessfull) encoder tests
This commit is contained in:
33
Extra/EncoderPollingTest/Interactions.ino
Normal file
33
Extra/EncoderPollingTest/Interactions.ino
Normal file
@ -0,0 +1,33 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user