Move Menu: Select axis first, resolution after

This commit is contained in:
Scott Lahteine 2016-12-12 21:58:16 -08:00
parent 641e0936d4
commit 93b2833347
2 changed files with 100 additions and 57 deletions

View File

@ -141,6 +141,9 @@
#ifndef MSG_MOVING #ifndef MSG_MOVING
#define MSG_MOVING "Moving..." #define MSG_MOVING "Moving..."
#endif #endif
#ifndef MSG_FREE_XY
#define MSG_FREE_XY "Free XY"
#endif
#ifndef MSG_MOVE_X #ifndef MSG_MOVE_X
#define MSG_MOVE_X "Move X" #define MSG_MOVE_X "Move X"
#endif #endif

View File

@ -1282,6 +1282,14 @@ KeepDrawing:
// //
MENU_BACK(MSG_MAIN); MENU_BACK(MSG_MAIN);
//
// Move Axis
//
#if ENABLED(DELTA)
if (axis_homed[Z_AXIS])
#endif
MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
// //
// Auto Home // Auto Home
// //
@ -1309,11 +1317,6 @@ KeepDrawing:
MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed); MENU_ITEM(submenu, MSG_LEVEL_BED, lcd_level_bed);
#endif #endif
//
// Move Axis
//
MENU_ITEM(submenu, MSG_MOVE_AXIS, lcd_move_menu);
// //
// Disable Steppers // Disable Steppers
// //
@ -1557,23 +1560,92 @@ KeepDrawing:
* *
*/ */
#if IS_KINEMATIC screenFunc_t _manual_move_func_ptr;
#define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
#else void lcd_move_menu_10mm() { move_menu_scale = 10.0; lcd_goto_screen(_manual_move_func_ptr); }
#define _MOVE_XYZ_ALLOWED true void lcd_move_menu_1mm() { move_menu_scale = 1.0; lcd_goto_screen(_manual_move_func_ptr); }
void lcd_move_menu_01mm() { move_menu_scale = 0.1; lcd_goto_screen(_manual_move_func_ptr); }
void _lcd_move_distance_menu(AxisEnum axis, screenFunc_t func) {
_manual_move_func_ptr = func;
START_MENU();
if (LCD_HEIGHT >= 4) {
switch(axis) {
case X_AXIS:
STATIC_ITEM(MSG_MOVE_X, true, true); break;
case Y_AXIS:
STATIC_ITEM(MSG_MOVE_Y, true, true); break;
case Z_AXIS:
STATIC_ITEM(MSG_MOVE_Z, true, true); break;
default:
STATIC_ITEM(MSG_MOVE_E, true, true); break;
}
}
MENU_BACK(MSG_MOVE_AXIS);
if (axis == X_AXIS || axis == Y_AXIS)
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);
END_MENU();
}
void lcd_move_get_x_amount() { _lcd_move_distance_menu(X_AXIS, lcd_move_x); }
void lcd_move_get_y_amount() { _lcd_move_distance_menu(Y_AXIS, lcd_move_y); }
void lcd_move_get_z_amount() { _lcd_move_distance_menu(Z_AXIS, lcd_move_z); }
void lcd_move_get_e_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e); }
#if E_MANUAL > 1
void lcd_move_get_e0_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e0); }
void lcd_move_get_e1_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e1); }
#if E_MANUAL > 2
void lcd_move_get_e2_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e2); }
#if E_MANUAL > 3
void lcd_move_get_e3_amount() { _lcd_move_distance_menu(E_AXIS, lcd_move_e3); }
#endif
#endif
#endif #endif
void _lcd_move_menu_axis() { /**
*
* "Prepare" > "Move Axis" submenu
*
*/
#if IS_KINEMATIC
#define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
#if ENABLED(DELTA)
#define _MOVE_XY_ALLOWED (current_position[Z_AXIS] <= delta_clip_start_height)
void lcd_lower_z_to_clip_height() {
if (!no_reentrance) {
current_position[Z_AXIS] = delta_clip_start_height;
line_to_current(Z_AXIS);
lcd_synchronize();
}
}
#else
#define _MOVE_XY_ALLOWED true
#endif
#else
#define _MOVE_XYZ_ALLOWED true
#define _MOVE_XY_ALLOWED true
#endif
void lcd_move_menu() {
START_MENU(); START_MENU();
MENU_BACK(MSG_MOVE_AXIS); MENU_BACK(MSG_PREPARE);
if (_MOVE_XYZ_ALLOWED) { if (_MOVE_XYZ_ALLOWED) {
MENU_ITEM(submenu, MSG_MOVE_X, lcd_move_x); if (_MOVE_XY_ALLOWED) {
MENU_ITEM(submenu, MSG_MOVE_Y, lcd_move_y); MENU_ITEM(submenu, MSG_MOVE_X, lcd_move_get_x_amount);
MENU_ITEM(submenu, MSG_MOVE_Y, lcd_move_get_y_amount);
} }
#if ENABLED(DELTA)
else
MENU_ITEM(function, MSG_FREE_XY, lcd_lower_z_to_clip_height);
#endif
if (move_menu_scale < 10.0) { MENU_ITEM(submenu, MSG_MOVE_Z, lcd_move_get_z_amount);
if (_MOVE_XYZ_ALLOWED) MENU_ITEM(submenu, MSG_MOVE_Z, lcd_move_z); }
else
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
#if ENABLED(SWITCHING_EXTRUDER) #if ENABLED(SWITCHING_EXTRUDER)
if (active_extruder) if (active_extruder)
@ -1582,50 +1654,18 @@ KeepDrawing:
MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1")); MENU_ITEM(gcode, MSG_SELECT " " MSG_E2, PSTR("T1"));
#endif #endif
MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_e); MENU_ITEM(submenu, MSG_MOVE_E, lcd_move_get_e_amount);
#if E_MANUAL > 1 #if E_MANUAL > 1
MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E1, lcd_move_e0); MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E1, lcd_move_get_e0_amount);
MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E2, lcd_move_e1); MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E2, lcd_move_get_e1_amount);
#if E_MANUAL > 2 #if E_MANUAL > 2
MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E3, lcd_move_e2); MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E3, lcd_move_get_e2_amount);
#if E_MANUAL > 3 #if E_MANUAL > 3
MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E4, lcd_move_e3); MENU_ITEM(submenu, MSG_MOVE_E MSG_MOVE_E4, lcd_move_get_e3_amount);
#endif #endif
#endif #endif
#endif #endif
}
END_MENU();
}
void lcd_move_menu_10mm() {
move_menu_scale = 10.0;
_lcd_move_menu_axis();
}
void lcd_move_menu_1mm() {
move_menu_scale = 1.0;
_lcd_move_menu_axis();
}
void lcd_move_menu_01mm() {
move_menu_scale = 0.1;
_lcd_move_menu_axis();
}
/**
*
* "Prepare" > "Move Axis" submenu
*
*/
void lcd_move_menu() {
START_MENU();
MENU_BACK(MSG_PREPARE);
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
END_MENU(); END_MENU();
} }