From 479d307a44b45d41e3617706a816c88fb1d0219f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 7 Apr 2016 01:58:23 -0700 Subject: [PATCH 1/2] Disable LCD Move XYZ for unhomed Delta/SCARA --- Marlin/ultralcd.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index af31e954e2..a2d472d115 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -1203,13 +1203,22 @@ static void lcd_move_e( * */ +#if ENABLED(DELTA) || ENABLED(SCARA) + #define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS]) +#else + #define _MOVE_XYZ_ALLOWED true +#endif + static void _lcd_move_menu_axis() { START_MENU(); MENU_ITEM(back, MSG_MOVE_AXIS); - MENU_ITEM(submenu, MSG_MOVE_X, lcd_move_x); - MENU_ITEM(submenu, MSG_MOVE_Y, lcd_move_y); + + if (_MOVE_XYZ_ALLOWED) { + MENU_ITEM(submenu, MSG_MOVE_X, lcd_move_x); + MENU_ITEM(submenu, MSG_MOVE_Y, lcd_move_y); + } if (move_menu_scale < 10.0) { - MENU_ITEM(submenu, MSG_MOVE_Z, lcd_move_z); + if (_MOVE_XYZ_ALLOWED) MENU_ITEM(submenu, MSG_MOVE_Z, lcd_move_z); #if EXTRUDERS == 1 MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_e); #else @@ -1248,7 +1257,10 @@ static void lcd_move_menu_01mm() { static void lcd_move_menu() { START_MENU(); MENU_ITEM(back, MSG_PREPARE); - MENU_ITEM(submenu, MSG_MOVE_10MM, lcd_move_menu_10mm); + + if (_MOVE_XYZ_ALLOWED) + MENU_ITEM(submenu, MSG_MOVE_10MM, lcd_move_menu_10mm); + MENU_ITEM(submenu, MSG_MOVE_1MM, lcd_move_menu_1mm); MENU_ITEM(submenu, MSG_MOVE_01MM, lcd_move_menu_01mm); //TODO:X,Y,Z,E From 165e73794ad049b44ca5e47a74d34af80ce8d1dd Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 7 Apr 2016 01:58:58 -0700 Subject: [PATCH 2/2] Tweak encoderPosition non-zero test --- Marlin/ultralcd.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index a2d472d115..3e5ee8f46a 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -553,7 +553,7 @@ void lcd_set_home_offsets() { static void _lcd_babystep(const int axis, const char* msg) { ENCODER_DIRECTION_NORMAL(); - if (encoderPosition != 0) { + if (encoderPosition) { int distance = (int)encoderPosition * BABYSTEP_MULTIPLICATOR; encoderPosition = 0; lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_REDRAW; @@ -1124,7 +1124,7 @@ float move_menu_scale; static void _lcd_move(const char* name, AxisEnum axis, float min, float max) { ENCODER_DIRECTION_NORMAL(); - if ((encoderPosition != 0) && (movesplanned() <= 3)) { + if (encoderPosition && movesplanned() <= 3) { refresh_cmd_timeout(); current_position[axis] += float((int)encoderPosition) * move_menu_scale; if (min_software_endstops) NOLESS(current_position[axis], min); @@ -1156,7 +1156,7 @@ static void lcd_move_e( unsigned short original_active_extruder = active_extruder; active_extruder = e; #endif - if ((encoderPosition != 0) && (movesplanned() <= 3)) { + if (encoderPosition && movesplanned() <= 3) { current_position[E_AXIS] += float((int)encoderPosition) * move_menu_scale; encoderPosition = 0; line_to_current(E_AXIS); @@ -1641,7 +1641,7 @@ static void lcd_control_volumetric_menu() { #if ENABLED(HAS_LCD_CONTRAST) static void lcd_set_contrast() { ENCODER_DIRECTION_NORMAL(); - if (encoderPosition != 0) { + if (encoderPosition) { #if ENABLED(U8GLIB_LM6059_AF) lcd_contrast += encoderPosition; lcd_contrast &= 0xFF;