From 234987ee2f6ea001fd4fe934ac24cc8057820b88 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 16 Apr 2016 14:17:06 -0700 Subject: [PATCH 1/2] Fix MBL lift --- Marlin/Marlin_main.cpp | 10 ++++++---- Marlin/ultralcd.cpp | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index c0acebf8df..96eff9d3db 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2847,10 +2847,12 @@ inline void gcode_G28() { saved_feedrate = feedrate; feedrate = homing_feedrate[X_AXIS]; - #if MIN_Z_HEIGHT_FOR_HOMING > 0 - current_position[Z_AXIS] = MESH_HOME_SEARCH_Z + MIN_Z_HEIGHT_FOR_HOMING; - line_to_current_position(); - #endif + current_position[Z_AXIS] = MESH_HOME_SEARCH_Z + #if MIN_Z_HEIGHT_FOR_HOMING > 0 + + MIN_Z_HEIGHT_FOR_HOMING + #endif + ; + line_to_current_position(); current_position[X_AXIS] = x + home_offset[X_AXIS]; current_position[Y_AXIS] = y + home_offset[Y_AXIS]; diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 5d5845cfbf..31d5d3165d 100644 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -893,10 +893,12 @@ void lcd_cooldown() { // Z position will be restored with the final action, a G28 inline void _mbl_goto_xy(float x, float y) { mbl_wait_for_move = true; - #if MIN_Z_HEIGHT_FOR_HOMING > 0 - current_position[Z_AXIS] += MIN_Z_HEIGHT_FOR_HOMING; - line_to_current(Z_AXIS); - #endif + current_position[Z_AXIS] = MESH_HOME_SEARCH_Z + #if MIN_Z_HEIGHT_FOR_HOMING > 0 + + MIN_Z_HEIGHT_FOR_HOMING + #endif + ; + line_to_current(Z_AXIS); current_position[X_AXIS] = x + home_offset[X_AXIS]; current_position[Y_AXIS] = y + home_offset[Y_AXIS]; line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS); From 4b75b11a539a42ff159833df5ef6da86d58e91ad Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 16 Apr 2016 14:35:22 -0700 Subject: [PATCH 2/2] Wrap defines in parentheses in configs, M48 --- Marlin/Marlin_main.cpp | 8 ++++---- .../Hephestos_2/Configuration.h | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 96eff9d3db..63942d8e01 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -4012,7 +4012,7 @@ inline void gcode_M42() { if (Z_start_location < Z_RAISE_BEFORE_PROBING * 2.0) do_blocking_move_to_z(Z_start_location); - do_blocking_move_to_xy(X_probe_location - X_PROBE_OFFSET_FROM_EXTRUDER, Y_probe_location - Y_PROBE_OFFSET_FROM_EXTRUDER); + do_blocking_move_to_xy(X_probe_location - (X_PROBE_OFFSET_FROM_EXTRUDER), Y_probe_location - (Y_PROBE_OFFSET_FROM_EXTRUDER)); /** * OK, do the initial probe to get us close to the bed. @@ -4072,8 +4072,8 @@ inline void gcode_M42() { while (angle < 0.0) // outside of this range. It looks like they behave correctly with angle += 360.0; // numbers outside of the range, but just to be safe we clamp them. - X_current = X_probe_location - X_PROBE_OFFSET_FROM_EXTRUDER + cos(RADIANS(angle)) * radius; - Y_current = Y_probe_location - Y_PROBE_OFFSET_FROM_EXTRUDER + sin(RADIANS(angle)) * radius; + X_current = X_probe_location - (X_PROBE_OFFSET_FROM_EXTRUDER) + cos(RADIANS(angle)) * radius; + Y_current = Y_probe_location - (Y_PROBE_OFFSET_FROM_EXTRUDER) + sin(RADIANS(angle)) * radius; #if DISABLED(DELTA) X_current = constrain(X_current, X_MIN_POS, X_MAX_POS); @@ -4111,7 +4111,7 @@ inline void gcode_M42() { * height. This gets us back to the probe location at the same height that * we have been running around the circle at. */ - do_blocking_move_to_xy(X_probe_location - X_PROBE_OFFSET_FROM_EXTRUDER, Y_probe_location - Y_PROBE_OFFSET_FROM_EXTRUDER); + do_blocking_move_to_xy(X_probe_location - (X_PROBE_OFFSET_FROM_EXTRUDER), Y_probe_location - (Y_PROBE_OFFSET_FROM_EXTRUDER)); if (deploy_probe_for_each_reading) sample_set[n] = probe_pt(X_probe_location, Y_probe_location, Z_RAISE_BEFORE_PROBING, ProbeDeployAndStow, verbose_level); else { diff --git a/Marlin/example_configurations/Hephestos_2/Configuration.h b/Marlin/example_configurations/Hephestos_2/Configuration.h index 98117fa87e..d7a1131783 100644 --- a/Marlin/example_configurations/Hephestos_2/Configuration.h +++ b/Marlin/example_configurations/Hephestos_2/Configuration.h @@ -512,9 +512,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(MESH_BED_LEVELING) #define MESH_MIN_X 10 - #define MESH_MAX_X (X_MAX_POS - MESH_MIN_X) + #define MESH_MAX_X (X_MAX_POS - (MESH_MIN_X)) #define MESH_MIN_Y 10 - #define MESH_MAX_Y (Y_MAX_POS - MESH_MIN_Y) + #define MESH_MAX_Y (Y_MAX_POS - (MESH_MIN_Y)) #define MESH_NUM_X_POINTS 3 // Don't use more than 7 points per axis, implementation limited. #define MESH_NUM_Y_POINTS 3 #define MESH_HOME_SEARCH_Z 4 // Z after Home, bed somewhere below but above 0.0. @@ -557,9 +557,9 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l #if ENABLED(AUTO_BED_LEVELING_GRID) #define LEFT_PROBE_BED_POSITION X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER - #define RIGHT_PROBE_BED_POSITION X_MAX_POS - X_PROBE_OFFSET_FROM_EXTRUDER + #define RIGHT_PROBE_BED_POSITION X_MAX_POS - (X_PROBE_OFFSET_FROM_EXTRUDER) #define FRONT_PROBE_BED_POSITION Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER - #define BACK_PROBE_BED_POSITION Y_MAX_POS - Y_PROBE_OFFSET_FROM_EXTRUDER + #define BACK_PROBE_BED_POSITION Y_MAX_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER) #define MIN_PROBE_EDGE 10 // The Z probe minimum square sides can be no smaller than this. @@ -573,10 +573,10 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l // A simple cross-product is used to estimate the plane of the bed. #define ABL_PROBE_PT_1_X X_MIN_POS + X_PROBE_OFFSET_FROM_EXTRUDER #define ABL_PROBE_PT_1_Y Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER - #define ABL_PROBE_PT_2_X X_MAX_POS - X_PROBE_OFFSET_FROM_EXTRUDER + #define ABL_PROBE_PT_2_X X_MAX_POS - (X_PROBE_OFFSET_FROM_EXTRUDER) #define ABL_PROBE_PT_2_Y Y_MIN_POS + Y_PROBE_OFFSET_FROM_EXTRUDER #define ABL_PROBE_PT_3_X ((X_MIN_POS + X_MAX_POS) / 2) - #define ABL_PROBE_PT_3_Y Y_MAX_POS - Y_PROBE_OFFSET_FROM_EXTRUDER + #define ABL_PROBE_PT_3_Y Y_MAX_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER) #endif // AUTO_BED_LEVELING_GRID