From 5fc6daba2bc87696848c66b63cf8b8daac87d39b Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 7 Apr 2016 17:40:01 -0700 Subject: [PATCH] Disallow REPRAPWORLD_KEYPAD moves on Delta/SCARA until homed --- Marlin/ultralcd.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index af31e954e2..1e474bcc0c 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1842,7 +1842,7 @@ menu_edit_type(unsigned long, long5, ftostr5, 0.01); lcd_move_y(); } static void reprapworld_keypad_move_home() { - enqueue_and_echo_commands_P((PSTR("G28"))); // move all axis home + enqueue_and_echo_commands_P(PSTR("G28")); // move all axes home } #endif // REPRAPWORLD_KEYPAD @@ -2091,13 +2091,22 @@ void lcd_update() { #if ENABLED(ULTIPANEL) #if ENABLED(REPRAPWORLD_KEYPAD) - 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_MOVE_HOME) reprapworld_keypad_move_home(); + + #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 + + 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(); + } #endif bool encoderPastThreshold = (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP);