beginning of modes

This commit is contained in:
2020-03-08 22:49:27 -07:00
parent 6eb4f9da4d
commit e68a31689c

View File

@ -34,6 +34,18 @@ typedef struct
DebounceButton up, down, left, right, select;
typedef enum {
MODE_LEFT_CLICK,
MODE_WALK_FORWARD,
MODE_COUNT
} Mode;
Mode currMode = MODE_LEFT_CLICK;
char *modeNames[] = {
"Left click ",
"Walk forward "
};
bool doClicking = false;
unsigned long lastClickTime = 0;
int clickColor = 0;
@ -121,10 +133,9 @@ void loop() {
}
if (triggered(select)) {
// lcd.setCursor(0, 1);
// lcd.print("SELECT ");
// // lcd.setBacklight(VIOLET);
// lcdLastSet = millis();
currMode = (currMode + 1) % MODE_COUNT;
lcd.setCursor(0, 0);
lcd.print(modeNames[currMode]);
}
}
@ -144,6 +155,8 @@ void loop() {
// clear second lcd line after a while
if (lcdLastSet > 0 && millis() > lcdLastSet + lcdTimeout) {
lcd.setCursor(0, 0);
lcd.print(modeNames[currMode]);
lcd.setCursor(0, 1);
lcd.print(" ");
lcdLastSet = 0;