improve debug output

This commit is contained in:
Ronald Schaten 2022-02-01 18:49:47 +01:00
parent d92f47ee26
commit e520ef0f11

View File

@ -49,7 +49,7 @@
#define MAX_DEPTH 2 #define MAX_DEPTH 2
const int KeypadMap[] = {0, 96, 250, 402, 636}; const int KeypadMap[] = {0, 96, 250, 402, 636};
const uint16_t KeypadHoldTimeMs = 5000; const uint16_t KeypadHoldTimeMs = 1000;
const uint8_t KeypadAnalogPin = PIN_BUTTON; const uint8_t KeypadAnalogPin = PIN_BUTTON;
AnalogKeypad keypad(KeypadAnalogPin, KeypadMap, countof(KeypadMap), KeypadHoldTimeMs); AnalogKeypad keypad(KeypadAnalogPin, KeypadMap, countof(KeypadMap), KeypadHoldTimeMs);
@ -101,10 +101,10 @@ NAVROOT(nav, mainMenu, MAX_DEPTH, in, out);
void ButtonHandler_menu(const ButtonParam& param) { void ButtonHandler_menu(const ButtonParam& param) {
Serial.print("ButtonHandler_menu("); Serial.print("ButtonHandler_menu(");
Serial.print(param.button); Serial.print(param.button);
Serial.println(")"); Serial.print(") - ");
switch (param.state) { switch (param.state) {
case ButtonState_Click: case ButtonState_Click:
Serial.print("Click"); Serial.println("Click");
switch (param.button) { switch (param.button) {
case KEY_UP: case KEY_UP:
nav.doNav(upCmd); nav.doNav(upCmd);
@ -118,22 +118,24 @@ void ButtonHandler_menu(const ButtonParam& param) {
} }
nav.doOutput(); nav.doOutput();
break; break;
default:
Serial.println(param.state);
} }
} }
void ButtonHandler_jog(const ButtonParam& param) { void ButtonHandler_jog(const ButtonParam& param) {
Serial.print("ButtonHandler_jog("); Serial.print("ButtonHandler_jog(");
Serial.print(param.button); Serial.print(param.button);
Serial.println(")"); Serial.print(") - ");
switch (param.state) { switch (param.state) {
case ButtonState_Up: case ButtonState_Up:
Serial.print("Up"); Serial.println("Up");
break; break;
case ButtonState_Down: case ButtonState_Down:
Serial.print("Down"); Serial.println("Down");
break; break;
case ButtonState_Click: case ButtonState_Click:
Serial.print("Click"); Serial.println("Click");
switch (param.button) { switch (param.button) {
case KEY_UP: case KEY_UP:
stepper.startRotate(-30); stepper.startRotate(-30);
@ -149,10 +151,10 @@ void ButtonHandler_jog(const ButtonParam& param) {
} }
break; break;
case ButtonState_DoubleClick: case ButtonState_DoubleClick:
Serial.print("Double Click"); Serial.println("Double Click");
break; break;
case ButtonState_Hold: case ButtonState_Hold:
Serial.print("Hold"); Serial.println("Hold");
break; break;
} }
} }
@ -160,7 +162,8 @@ void ButtonHandler_jog(const ButtonParam& param) {
void ButtonHandler_run(const ButtonParam& param) { void ButtonHandler_run(const ButtonParam& param) {
Serial.print("ButtonHandler_run("); Serial.print("ButtonHandler_run(");
Serial.print(param.button); Serial.print(param.button);
Serial.println(")"); Serial.print(") - ");
Serial.println("TODO");
} }
void setup() { void setup() {