implement jogging and speedup on key hold

This commit is contained in:
Ronald Schaten 2022-02-01 20:25:43 +01:00
parent e520ef0f11
commit 4a1f9d0af2

View File

@ -130,31 +130,31 @@ void ButtonHandler_jog(const ButtonParam& param) {
switch (param.state) { switch (param.state) {
case ButtonState_Up: case ButtonState_Up:
Serial.println("Up"); Serial.println("Up");
stepper.stop();
stepper.setRPM(STEPPER_RPM);
break; break;
case ButtonState_Down: case ButtonState_Down:
Serial.println("Down"); Serial.println("Down");
break;
case ButtonState_Click:
Serial.println("Click");
switch (param.button) { switch (param.button) {
case KEY_UP: case KEY_UP:
stepper.startRotate(-30); stepper.startMove(100 * 360);
break; break;
case KEY_DOWN: case KEY_DOWN:
stepper.startRotate(30); stepper.startMove(-100 * 360);
break;
case KEY_SELECT:
state = STATE_MENU;
nav.doNav(leftCmd);
nav.doOutput();
break; break;
} }
break; break;
case ButtonState_DoubleClick:
Serial.println("Double Click");
break;
case ButtonState_Hold: case ButtonState_Hold:
Serial.println("Hold"); Serial.println("Hold");
stepper.setRPM(2 * STEPPER_RPM);
switch (param.button) {
case KEY_UP:
stepper.startMove(100 * 360);
break;
case KEY_DOWN:
stepper.startMove(-100 * 360);
break;
}
break; break;
} }
} }