From 2a41f0ff84a7f8afe4942997e980cc73ba3e0339 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 6 Jun 2017 02:30:39 -0500 Subject: [PATCH] Save 28b PROGMEM in ultralcd.cpp (line_to_current) --- Marlin/ultralcd.cpp | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 1512cd893b..7f2c80e11b 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -686,8 +686,13 @@ void kill_screen(const char* lcd_msg) { else lcd_buzz(20, 440); } - inline void line_to_current(AxisEnum axis) { - planner.buffer_line_kinematic(current_position, MMM_TO_MMS(manual_feedrate_mm_m[axis]), active_extruder); + inline void line_to_current_z() { + planner.buffer_line_kinematic(current_position, MMM_TO_MMS(manual_feedrate_mm_m[Z_AXIS]), active_extruder); + } + + inline void line_to_z(const float &z) { + current_position[Z_AXIS] = z; + line_to_current_z(); } #if ENABLED(SDSUPPORT) @@ -1521,8 +1526,7 @@ void kill_screen(const char* lcd_msg) { // void _lcd_after_probing() { #if MANUAL_PROBE_HEIGHT > 0 - current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT; - line_to_current(Z_AXIS); + line_to_z(LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT); #endif // Display "Done" screen and wait for moves to complete #if MANUAL_PROBE_HEIGHT > 0 || ENABLED(MESH_BED_LEVELING) @@ -1539,15 +1543,13 @@ void kill_screen(const char* lcd_msg) { // Utility to go to the next mesh point inline void _manual_probe_goto_xy(float x, float y) { #if MANUAL_PROBE_HEIGHT > 0 - current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT; - line_to_current(Z_AXIS); + line_to_z(LOGICAL_Z_POSITION(Z_MIN_POS) + MANUAL_PROBE_HEIGHT); #endif current_position[X_AXIS] = LOGICAL_X_POSITION(x); current_position[Y_AXIS] = LOGICAL_Y_POSITION(y); planner.buffer_line_kinematic(current_position, MMM_TO_MMS(XY_PROBE_SPEED), active_extruder); #if MANUAL_PROBE_HEIGHT > 0 - current_position[Z_AXIS] = LOGICAL_Z_POSITION(Z_MIN_POS); - line_to_current(Z_AXIS); + line_to_z(LOGICAL_Z_POSITION(Z_MIN_POS)); #endif lcd_synchronize(); } @@ -1629,10 +1631,8 @@ void kill_screen(const char* lcd_msg) { // if (encoderPosition) { refresh_cmd_timeout(); - current_position[Z_AXIS] += float((int32_t)encoderPosition) * (MBL_Z_STEP); - NOLESS(current_position[Z_AXIS], -(LCD_PROBE_Z_RANGE) * 0.5); - NOMORE(current_position[Z_AXIS], (LCD_PROBE_Z_RANGE) * 0.5); - line_to_current(Z_AXIS); + const float z = current_position[Z_AXIS] + float((int32_t)encoderPosition) * (MBL_Z_STEP); + line_to_z(constrain(z, -(LCD_PROBE_Z_RANGE) * 0.5, (LCD_PROBE_Z_RANGE) * 0.5)); lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; encoderPosition = 0; } @@ -2299,15 +2299,13 @@ void kill_screen(const char* lcd_msg) { reset_bed_level(); // After calibration bed-level data is no longer valid #endif - current_position[Z_AXIS] = max(Z_HOMING_HEIGHT, Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5; - line_to_current(Z_AXIS); + line_to_z(max(Z_HOMING_HEIGHT, Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5); current_position[X_AXIS] = a < 0 ? LOGICAL_X_POSITION(X_HOME_POS) : cos(RADIANS(a)) * delta_calibration_radius; current_position[Y_AXIS] = a < 0 ? LOGICAL_Y_POSITION(Y_HOME_POS) : sin(RADIANS(a)) * delta_calibration_radius; - line_to_current(Z_AXIS); + line_to_current_z(); - current_position[Z_AXIS] = 4.0; - line_to_current(Z_AXIS); + line_to_z(4.0); lcd_synchronize(); @@ -2536,8 +2534,7 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(DELTA) #define _MOVE_XY_ALLOWED (current_position[Z_AXIS] <= delta_clip_start_height) void lcd_lower_z_to_clip_height() { - current_position[Z_AXIS] = delta_clip_start_height; - line_to_current(Z_AXIS); + line_to_z(delta_clip_start_height); lcd_synchronize(); } #else