named keys

This commit is contained in:
Ronald Schaten 2022-02-01 15:25:21 +01:00
parent 6546f11437
commit c066eeb593

View File

@ -20,6 +20,11 @@
// analog keypad
#define PIN_BUTTON 0
#define KEY_RIGHT 0
#define KEY_UP 1
#define KEY_DOWN 2
#define KEY_LEFT 3
#define KEY_SELECT 4
// 2x16 LCD
#define PIN_LCD_DB4 4
#define PIN_LCD_DB5 5
@ -83,17 +88,17 @@ void ButtonHandler(const ButtonParam& param) {
case ButtonState_Click:
Serial.print("Click");
switch (param.button) {
case 0: // right
case KEY_RIGHT:
break;
case 1: // up
case KEY_UP:
nav.doNav(upCmd);
break;
case 2: // down
case KEY_DOWN:
nav.doNav(downCmd);
break;
case 3: // left
case KEY_LEFT:
break;
case 4: // select
case KEY_SELECT:
nav.doNav(enterCmd);
break;
}
@ -112,13 +117,13 @@ void ButtonHandler(const ButtonParam& param) {
case ButtonState_Click:
Serial.print("Click");
switch (param.button) {
case 1: // up
case KEY_UP:
stepper.startRotate(-30);
break;
case 2: // down
case KEY_DOWN:
stepper.startRotate(30);
break;
case 4: // select
case KEY_SELECT:
state = MENU;
nav.doNav(leftCmd);
nav.doOutput();