diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 8947af1572799288c04e7e0937daf2c0149c5575..ac93cb453d370446144dc012d89c90b7013fb406 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1160,7 +1160,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index c3765b9090260c99a8b2be5b4b199c25443c254b..00662171c8648797b1f0427b881ae8540c37750d 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -1143,7 +1143,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/Felix/DUAL/Configuration.h b/Marlin/example_configurations/Felix/DUAL/Configuration.h index 943b5483f32cc2f4c3bee08fedf40b56fbd1490f..29cc3b051a99dedb1cf2743e0a074ddd4ca2dd68 100644 --- a/Marlin/example_configurations/Felix/DUAL/Configuration.h +++ b/Marlin/example_configurations/Felix/DUAL/Configuration.h @@ -1141,7 +1141,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 1834986c1bb07f5ba2bb65d12d79f7baf8857ce8..7b659c0bfa99681316951a1f9d94c457eb36c4e4 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -1152,7 +1152,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/Hephestos_2/Configuration.h b/Marlin/example_configurations/Hephestos_2/Configuration.h index f082073853f6604e16f8e25bb46e2e951560d78c..9ce056a9002bbfe5e86b0bec5c09a290a48f91d7 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration.h @@ -1154,7 +1154,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index a46c98f084ce9e250256e8cfb81f34c77c22e90a..0c4a27162ef0b874dc3a156833645547d49f256a 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -1177,7 +1177,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h index a48370e5f497534e5b82d2afec1ea11199d0c853..8dab9e9452631dd4054415c858b5aafedd0a1297 100644 --- a/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h @@ -1160,7 +1160,7 @@ // is pressed, a value of 10.0 means 10mm per click. // #define REPRAPWORLD_KEYPAD -#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/RigidBot/Configuration.h b/Marlin/example_configurations/RigidBot/Configuration.h index bf8de78bd2d705ce23510fafbac3f53e1af0cef2..1568ed873827eae8f951180f98c17a157b4d22dc 100644 --- a/Marlin/example_configurations/RigidBot/Configuration.h +++ b/Marlin/example_configurations/RigidBot/Configuration.h @@ -1160,7 +1160,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 970ee801527a8af99cfb2871e802426e5895cf64..9123b2016a0f86e399f8177d1abd4485b953ab57 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -1168,7 +1168,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/TAZ4/Configuration.h b/Marlin/example_configurations/TAZ4/Configuration.h index b9264323de0115075586841b8363c18d4d2f31b1..a4db05cb082a06e32bdf95d0fea4cfb5fd0123d0 100644 --- a/Marlin/example_configurations/TAZ4/Configuration.h +++ b/Marlin/example_configurations/TAZ4/Configuration.h @@ -1181,7 +1181,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index 8de68af4f873ea490c9ea9aa69eb03a84692636a..d700848b559926e75c31a225deba870b23d65c6f 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -1152,7 +1152,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/adafruit/ST7565/Configuration.h b/Marlin/example_configurations/adafruit/ST7565/Configuration.h index 6b5546eff4aa5718203321b87d5a0aab79eefc6c..9c690416d5d70d2b51bb4ddc05a12291c3a9eadf 100644 --- a/Marlin/example_configurations/adafruit/ST7565/Configuration.h +++ b/Marlin/example_configurations/adafruit/ST7565/Configuration.h @@ -1160,7 +1160,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/delta/biv2.5/Configuration.h b/Marlin/example_configurations/delta/biv2.5/Configuration.h index 0e6ab7cefed2d510f5cd2198d57e3e490abfe8d2..d0e8c37a1dbe235b9bb76db27030ec456ae38ed9 100644 --- a/Marlin/example_configurations/delta/biv2.5/Configuration.h +++ b/Marlin/example_configurations/delta/biv2.5/Configuration.h @@ -1255,7 +1255,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/delta/generic/Configuration.h b/Marlin/example_configurations/delta/generic/Configuration.h index 7e27d294c4046dc4e1d259756d1dfb3f4fe84cc5..1b81a1e54057d32b48d3156b5c9154a3955ea68d 100644 --- a/Marlin/example_configurations/delta/generic/Configuration.h +++ b/Marlin/example_configurations/delta/generic/Configuration.h @@ -1249,7 +1249,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/delta/kossel_mini/Configuration.h b/Marlin/example_configurations/delta/kossel_mini/Configuration.h index 906a33e63bd270f77923d0bb40ab56351b2e2dd4..b26f2bd54cc01b73ae07f78f639a45babf315080 100644 --- a/Marlin/example_configurations/delta/kossel_mini/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_mini/Configuration.h @@ -1252,7 +1252,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/delta/kossel_pro/Configuration.h b/Marlin/example_configurations/delta/kossel_pro/Configuration.h index d36d8246bb7d9f5b45b9ae3df86b2cab8a451475..b9b0eff1c3772a198437d3f4d71afbc94fee16e9 100644 --- a/Marlin/example_configurations/delta/kossel_pro/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_pro/Configuration.h @@ -1252,7 +1252,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/delta/kossel_xl/Configuration.h b/Marlin/example_configurations/delta/kossel_xl/Configuration.h index d164dc72c42b63bbc13c7ae6b848d8a7fea3171f..5739ac3da8d29c559dca80166fee3528c8e77a93 100644 --- a/Marlin/example_configurations/delta/kossel_xl/Configuration.h +++ b/Marlin/example_configurations/delta/kossel_xl/Configuration.h @@ -1254,7 +1254,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index 6ba372f058b003a7e3941ab649eb1577e6a67a46..a87caff14a789ce0adfb2da1cb439a98da240af3 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -1163,7 +1163,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index 2a723f23fddcea7e3d06d638dd9cbb062f9006d8..251fae1f1b21843616776b01660b989bb6a7bafd 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -1154,7 +1154,7 @@ // is pressed, a value of 10.0 means 10mm per click. // //#define REPRAPWORLD_KEYPAD -//#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0 +//#define REPRAPWORLD_KEYPAD_MOVE_STEP 1.0 // // RigidBot Panel V1.0 diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index fbdcb8a40c5106aec99e4e59f7a830f42bb5eeaf..02a0e3a22e753a1c20e7c436361abeda2db4b5b3 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -2295,6 +2295,7 @@ void kill_screen(const char* lcd_msg) { currentScreen = menu_edit_callback_ ## _name; \ callbackFunc = callback; \ } + menu_edit_type(int, int3, itostr3, 1); menu_edit_type(float, float3, ftostr3, 1); menu_edit_type(float, float32, ftostr32, 100); @@ -2310,42 +2311,25 @@ void kill_screen(const char* lcd_msg) { * */ #if ENABLED(REPRAPWORLD_KEYPAD) - static void reprapworld_keypad_move_z_up() { - encoderPosition = 1; - move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; - lcd_move_z(); - } - static void reprapworld_keypad_move_z_down() { - encoderPosition = -1; - move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; - lcd_move_z(); - } - static void reprapworld_keypad_move_x_left() { - encoderPosition = -1; - move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; - lcd_move_x(); - } - static void reprapworld_keypad_move_x_right() { - encoderPosition = 1; + static void _reprapworld_keypad_move(AxisEnum axis, int dir) { move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; - lcd_move_x(); - } - static void reprapworld_keypad_move_y_down() { - encoderPosition = 1; - move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; - lcd_move_y(); - } - static void reprapworld_keypad_move_y_up() { - encoderPosition = -1; - move_menu_scale = REPRAPWORLD_KEYPAD_MOVE_STEP; - lcd_move_y(); - } - static void reprapworld_keypad_move_home() { - enqueue_and_echo_commands_P(PSTR("G28")); // move all axes home + encoderPosition = dir; + switch (axis) { + case X_AXIS: lcd_move_x(); break; + case Y_AXIS: lcd_move_y(); break; + case Z_AXIS: lcd_move_z(); + } } + static void reprapworld_keypad_move_z_up() { _reprapworld_keypad_move(Z_AXIS, 1); } + static void reprapworld_keypad_move_z_down() { _reprapworld_keypad_move(Z_AXIS, -1); } + static void reprapworld_keypad_move_x_left() { _reprapworld_keypad_move(X_AXIS, -1); } + static void reprapworld_keypad_move_x_right() { _reprapworld_keypad_move(X_AXIS, 1); } + static void reprapworld_keypad_move_y_up() { _reprapworld_keypad_move(Y_AXIS, -1); } + static void reprapworld_keypad_move_y_down() { _reprapworld_keypad_move(Y_AXIS, 1); } + static void reprapworld_keypad_move_home() { enqueue_and_echo_commands_P(PSTR("G28")); } // move all axes home and wait + static void reprapworld_keypad_move_menu() { lcd_goto_screen(lcd_move_menu); } #endif // REPRAPWORLD_KEYPAD - /** * * Audio feedback for controller clicks @@ -2602,22 +2586,35 @@ void lcd_update() { #if ENABLED(REPRAPWORLD_KEYPAD) - #if ENABLED(DELTA) || ENABLED(SCARA) - #define _KEYPAD_MOVE_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) - #else - #define _KEYPAD_MOVE_ALLOWED true - #endif + static uint8_t keypad_debounce = 0; - if (REPRAPWORLD_KEYPAD_MOVE_HOME) reprapworld_keypad_move_home(); - if (_KEYPAD_MOVE_ALLOWED) { - if (REPRAPWORLD_KEYPAD_MOVE_Z_UP) reprapworld_keypad_move_z_up(); - if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN) reprapworld_keypad_move_z_down(); - if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT) reprapworld_keypad_move_x_left(); - if (REPRAPWORLD_KEYPAD_MOVE_X_RIGHT) reprapworld_keypad_move_x_right(); - if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) reprapworld_keypad_move_y_down(); - if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) reprapworld_keypad_move_y_up(); + if (!REPRAPWORLD_KEYPAD_PRESSED) { + if (keypad_debounce > 0) keypad_debounce--; } - #endif + else if (!keypad_debounce) { + keypad_debounce = 2; + + if (REPRAPWORLD_KEYPAD_MOVE_MENU) reprapworld_keypad_move_menu(); + + #if DISABLED(DELTA) && Z_HOME_DIR == -1 + if (REPRAPWORLD_KEYPAD_MOVE_Z_UP) reprapworld_keypad_move_z_up(); + #endif + + if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) { + #if ENABLED(DELTA) || Z_HOME_DIR != -1 + if (REPRAPWORLD_KEYPAD_MOVE_Z_UP) reprapworld_keypad_move_z_up(); + #endif + if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN) reprapworld_keypad_move_z_down(); + if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT) reprapworld_keypad_move_x_left(); + if (REPRAPWORLD_KEYPAD_MOVE_X_RIGHT) reprapworld_keypad_move_x_right(); + if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN) reprapworld_keypad_move_y_down(); + if (REPRAPWORLD_KEYPAD_MOVE_Y_UP) reprapworld_keypad_move_y_up(); + } + else { + if (REPRAPWORLD_KEYPAD_MOVE_HOME) reprapworld_keypad_move_home(); + } + } + #endif // REPRAPWORLD_KEYPAD bool encoderPastThreshold = (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP); if (encoderPastThreshold || LCD_CLICKED) { @@ -2657,7 +2654,7 @@ void lcd_update() { return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; lcdDrawUpdate = LCDVIEW_REDRAW_NOW; } - #endif //ULTIPANEL + #endif // ULTIPANEL // We arrive here every ~100ms when idling often enough. // Instead of tracking the changes simply redraw the Info Screen ~1 time a second. diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index ccb6f504d7dc5b631d5f8f790d9dd064a958f6bf..457a70f513dcc158a553c47437cb27c73f483d1a 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -117,12 +117,24 @@ #define REPRAPWORLD_KEYPAD_MOVE_Z_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F3) #define REPRAPWORLD_KEYPAD_MOVE_Z_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F2) + #define REPRAPWORLD_KEYPAD_MOVE_MENU (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F1) #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_DOWN) #define REPRAPWORLD_KEYPAD_MOVE_X_RIGHT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_RIGHT) #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_MIDDLE) #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_UP) #define REPRAPWORLD_KEYPAD_MOVE_X_LEFT (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_LEFT) + #define REPRAPWORLD_KEYPAD_PRESSED (buttons_reprapworld_keypad & ( \ + EN_REPRAPWORLD_KEYPAD_F3 | \ + EN_REPRAPWORLD_KEYPAD_F2 | \ + EN_REPRAPWORLD_KEYPAD_F1 | \ + EN_REPRAPWORLD_KEYPAD_DOWN | \ + EN_REPRAPWORLD_KEYPAD_RIGHT | \ + EN_REPRAPWORLD_KEYPAD_MIDDLE | \ + EN_REPRAPWORLD_KEYPAD_UP | \ + EN_REPRAPWORLD_KEYPAD_LEFT) \ + ) + #endif // REPRAPWORLD_KEYPAD #if ENABLED(NEWPANEL)