Tweak up/dn/select/enter to be more natural with the lcd buttons

This commit is contained in:
Mike C 2013-03-10 14:48:13 -04:00
parent 6d9aa75635
commit 023025852c

View file

@ -51,6 +51,24 @@ void setup() {
} }
void loop() { void loop() {
// Up
if (!digitalRead(buttonPins[2])) {
serialmode newMode = (serialmode)(selectedMode - 1);
if (newMode >= 0) {
setSelection(newMode);
}
// Wait for release before going on
while(!digitalRead(buttonPins[2]));
}
// Select / Enter
if (!digitalRead(buttonPins[1])) {
setMode(selectedMode);
// Wait for release before going on
while(!digitalRead(buttonPins[1]));
}
// Down
if (!digitalRead(buttonPins[0])) { if (!digitalRead(buttonPins[0])) {
serialmode newMode = (serialmode)(selectedMode + 1); serialmode newMode = (serialmode)(selectedMode + 1);
if (newMode <= cisco) { if (newMode <= cisco) {
@ -59,21 +77,6 @@ void loop() {
// Wait for release before going on // Wait for release before going on
while(!digitalRead(buttonPins[0])); while(!digitalRead(buttonPins[0]));
} }
if (!digitalRead(buttonPins[1])) {
serialmode newMode = (serialmode)(selectedMode - 1);
if (newMode >= 0) {
setSelection(newMode);
}
// Wait for release before going on
while(!digitalRead(buttonPins[1]));
}
if (!digitalRead(buttonPins[2])) {
setMode(selectedMode);
// Wait for release before going on
while(!digitalRead(buttonPins[2]));
}
} }
void setMode(serialmode aMode) { void setMode(serialmode aMode) {