From 691e753cc3fb71dac6e574f8cde67a2a775715fb Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 21 Mar 2015 16:30:02 -0700 Subject: [PATCH 1/7] Don't add home offsets in G29 - Address #1262 by leaving values as set - Rename `add_homing` to `home_offset` --- Marlin/ConfigurationStore.cpp | 14 ++++---- Marlin/Marlin.h | 2 +- Marlin/Marlin_main.cpp | 63 +++++++++++++++-------------------- Marlin/ultralcd.cpp | 2 +- 4 files changed, 36 insertions(+), 45 deletions(-) diff --git a/Marlin/ConfigurationStore.cpp b/Marlin/ConfigurationStore.cpp index 16d94760b..29cc0412a 100644 --- a/Marlin/ConfigurationStore.cpp +++ b/Marlin/ConfigurationStore.cpp @@ -18,7 +18,7 @@ * max_xy_jerk * max_z_jerk * max_e_jerk - * add_homing (x3) + * home_offset (x3) * * Mesh bed leveling: * active @@ -136,7 +136,7 @@ void Config_StoreSettings() { EEPROM_WRITE_VAR(i, max_xy_jerk); EEPROM_WRITE_VAR(i, max_z_jerk); EEPROM_WRITE_VAR(i, max_e_jerk); - EEPROM_WRITE_VAR(i, add_homing); + EEPROM_WRITE_VAR(i, home_offset); uint8_t mesh_num_x = 3; uint8_t mesh_num_y = 3; @@ -294,7 +294,7 @@ void Config_RetrieveSettings() { EEPROM_READ_VAR(i, max_xy_jerk); EEPROM_READ_VAR(i, max_z_jerk); EEPROM_READ_VAR(i, max_e_jerk); - EEPROM_READ_VAR(i, add_homing); + EEPROM_READ_VAR(i, home_offset); uint8_t mesh_num_x = 0; uint8_t mesh_num_y = 0; @@ -447,7 +447,7 @@ void Config_ResetDefault() { max_xy_jerk = DEFAULT_XYJERK; max_z_jerk = DEFAULT_ZJERK; max_e_jerk = DEFAULT_EJERK; - add_homing[X_AXIS] = add_homing[Y_AXIS] = add_homing[Z_AXIS] = 0; + home_offset[X_AXIS] = home_offset[Y_AXIS] = home_offset[Z_AXIS] = 0; #if defined(MESH_BED_LEVELING) mbl.active = 0; @@ -607,9 +607,9 @@ void Config_PrintSettings(bool forReplay) { SERIAL_ECHOLNPGM("Home offset (mm):"); SERIAL_ECHO_START; } - SERIAL_ECHOPAIR(" M206 X", add_homing[X_AXIS] ); - SERIAL_ECHOPAIR(" Y", add_homing[Y_AXIS] ); - SERIAL_ECHOPAIR(" Z", add_homing[Z_AXIS] ); + SERIAL_ECHOPAIR(" M206 X", home_offset[X_AXIS] ); + SERIAL_ECHOPAIR(" Y", home_offset[Y_AXIS] ); + SERIAL_ECHOPAIR(" Z", home_offset[Z_AXIS] ); SERIAL_EOL; #ifdef DELTA diff --git a/Marlin/Marlin.h b/Marlin/Marlin.h index 44a85f78d..5184c4906 100644 --- a/Marlin/Marlin.h +++ b/Marlin/Marlin.h @@ -240,7 +240,7 @@ extern int extruder_multiply[EXTRUDERS]; // sets extrude multiply factor (in per extern float filament_size[EXTRUDERS]; // cross-sectional area of filament (in millimeters), typically around 1.75 or 2.85, 0 disables the volumetric calculations for the extruder. extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner extern float current_position[NUM_AXIS] ; -extern float add_homing[3]; +extern float home_offset[3]; #ifdef DELTA extern float endstop_adj[3]; extern float delta_radius; diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 41955d86a..fb7ae6145 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -248,7 +248,7 @@ float volumetric_multiplier[EXTRUDERS] = {1.0 #endif }; float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 }; -float add_homing[3] = { 0, 0, 0 }; +float home_offset[3] = { 0, 0, 0 }; #ifdef DELTA float endstop_adj[3] = { 0, 0, 0 }; #endif @@ -984,7 +984,7 @@ static int dual_x_carriage_mode = DEFAULT_DUAL_X_CARRIAGE_MODE; static float x_home_pos(int extruder) { if (extruder == 0) - return base_home_pos(X_AXIS) + add_homing[X_AXIS]; + return base_home_pos(X_AXIS) + home_offset[X_AXIS]; else // In dual carriage mode the extruder offset provides an override of the // second X-carriage offset when homed - otherwise X2_HOME_POS is used. @@ -1016,9 +1016,9 @@ static void axis_is_at_home(int axis) { return; } else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && active_extruder == 0) { - current_position[X_AXIS] = base_home_pos(X_AXIS) + add_homing[X_AXIS]; - min_pos[X_AXIS] = base_min_pos(X_AXIS) + add_homing[X_AXIS]; - max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + add_homing[X_AXIS], + current_position[X_AXIS] = base_home_pos(X_AXIS) + home_offset[X_AXIS]; + min_pos[X_AXIS] = base_min_pos(X_AXIS) + home_offset[X_AXIS]; + max_pos[X_AXIS] = min(base_max_pos(X_AXIS) + home_offset[X_AXIS], max(extruder_offset[X_AXIS][1], X2_MAX_POS) - duplicate_extruder_x_offset); return; } @@ -1046,11 +1046,11 @@ static void axis_is_at_home(int axis) { for (i=0; i<2; i++) { - delta[i] -= add_homing[i]; + delta[i] -= home_offset[i]; } - // SERIAL_ECHOPGM("addhome X="); SERIAL_ECHO(add_homing[X_AXIS]); - // SERIAL_ECHOPGM(" addhome Y="); SERIAL_ECHO(add_homing[Y_AXIS]); + // SERIAL_ECHOPGM("addhome X="); SERIAL_ECHO(home_offset[X_AXIS]); + // SERIAL_ECHOPGM(" addhome Y="); SERIAL_ECHO(home_offset[Y_AXIS]); // SERIAL_ECHOPGM(" addhome Theta="); SERIAL_ECHO(delta[X_AXIS]); // SERIAL_ECHOPGM(" addhome Psi+Theta="); SERIAL_ECHOLN(delta[Y_AXIS]); @@ -1068,14 +1068,14 @@ static void axis_is_at_home(int axis) { } else { - current_position[axis] = base_home_pos(axis) + add_homing[axis]; - min_pos[axis] = base_min_pos(axis) + add_homing[axis]; - max_pos[axis] = base_max_pos(axis) + add_homing[axis]; + current_position[axis] = base_home_pos(axis) + home_offset[axis]; + min_pos[axis] = base_min_pos(axis) + home_offset[axis]; + max_pos[axis] = base_max_pos(axis) + home_offset[axis]; } #else - current_position[axis] = base_home_pos(axis) + add_homing[axis]; - min_pos[axis] = base_min_pos(axis) + add_homing[axis]; - max_pos[axis] = base_max_pos(axis) + add_homing[axis]; + current_position[axis] = base_home_pos(axis) + home_offset[axis]; + min_pos[axis] = base_min_pos(axis) + home_offset[axis]; + max_pos[axis] = base_max_pos(axis) + home_offset[axis]; #endif } @@ -1858,7 +1858,7 @@ inline void gcode_G28() { if (code_value_long() != 0) { current_position[X_AXIS] = code_value() #ifndef SCARA - + add_homing[X_AXIS] + + home_offset[X_AXIS] #endif ; } @@ -1867,7 +1867,7 @@ inline void gcode_G28() { if (code_seen(axis_codes[Y_AXIS]) && code_value_long() != 0) { current_position[Y_AXIS] = code_value() #ifndef SCARA - + add_homing[Y_AXIS] + + home_offset[Y_AXIS] #endif ; } @@ -1941,7 +1941,7 @@ inline void gcode_G28() { if (code_seen(axis_codes[Z_AXIS]) && code_value_long() != 0) - current_position[Z_AXIS] = code_value() + add_homing[Z_AXIS]; + current_position[Z_AXIS] = code_value() + home_offset[Z_AXIS]; #ifdef ENABLE_AUTO_BED_LEVELING if (home_all_axis || code_seen(axis_codes[Z_AXIS])) @@ -2512,22 +2512,13 @@ inline void gcode_G92() { if (!code_seen(axis_codes[E_AXIS])) st_synchronize(); - for (int i=0;i Date: Sat, 21 Mar 2015 16:43:47 -0700 Subject: [PATCH 2/7] Fix compile error with `*_DUAL_STEPPER_DRIVERS` - Patch up macros in stepper.cpp --- Marlin/stepper.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 9f09f727f..30f231c1d 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -102,11 +102,8 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; X_DIR_WRITE(v); \ X2_DIR_WRITE(v); \ } \ - else{ \ - if (current_block->active_extruder) \ - X2_DIR_WRITE(v); \ - else \ - X_DIR_WRITE(v); \ + else { \ + if (current_block->active_extruder) X2_DIR_WRITE(v); else X_DIR_WRITE(v); \ } #define X_APPLY_STEP(v,ALWAYS) \ if (extruder_duplication_enabled || ALWAYS) { \ @@ -114,10 +111,7 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; X2_STEP_WRITE(v); \ } \ else { \ - if (current_block->active_extruder != 0) \ - X2_STEP_WRITE(v); \ - else \ - X_STEP_WRITE(v); \ + if (current_block->active_extruder != 0) X2_STEP_WRITE(v); else X_STEP_WRITE(v); \ } #else #define X_APPLY_DIR(v,Q) X_DIR_WRITE(v) @@ -125,16 +119,16 @@ volatile signed char count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; #endif #ifdef Y_DUAL_STEPPER_DRIVERS - #define Y_APPLY_DIR(v,Q) Y_DIR_WRITE(v), Y2_DIR_WRITE((v) != INVERT_Y2_VS_Y_DIR) - #define Y_APPLY_STEP(v,Q) Y_STEP_WRITE(v), Y2_STEP_WRITE(v) + #define Y_APPLY_DIR(v,Q) { Y_DIR_WRITE(v); Y2_DIR_WRITE((v) != INVERT_Y2_VS_Y_DIR); } + #define Y_APPLY_STEP(v,Q) { Y_STEP_WRITE(v); Y2_STEP_WRITE(v); } #else #define Y_APPLY_DIR(v,Q) Y_DIR_WRITE(v) #define Y_APPLY_STEP(v,Q) Y_STEP_WRITE(v) #endif #ifdef Z_DUAL_STEPPER_DRIVERS - #define Z_APPLY_DIR(v,Q) Z_DIR_WRITE(v), Z2_DIR_WRITE(v) - #define Z_APPLY_STEP(v,Q) Z_STEP_WRITE(v), Z2_STEP_WRITE(v) + #define Z_APPLY_DIR(v,Q) { Z_DIR_WRITE(v); Z2_DIR_WRITE(v); } + #define Z_APPLY_STEP(v,Q) { Z_STEP_WRITE(v); Z2_STEP_WRITE(v); } #else #define Z_APPLY_DIR(v,Q) Z_DIR_WRITE(v) #define Z_APPLY_STEP(v,Q) Z_STEP_WRITE(v) From 6c96f32069f6246fcab0ce8954af5e9ffe28f6fd Mon Sep 17 00:00:00 2001 From: maverikou Date: Sat, 21 Mar 2015 12:00:04 +0200 Subject: [PATCH 3/7] Blind fix for #1507 --- Marlin/Marlin_main.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index fb7ae6145..9a6365462 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1309,7 +1309,11 @@ static void engage_z_probe() { static void retract_z_probe() { // Retract Z Servo endstop if enabled #ifdef SERVO_ENDSTOPS - if (servo_endstops[Z_AXIS] > -1) { + if (servo_endstops[Z_AXIS] > -1) + { + do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_AFTER_PROBING); + st_synchronize(); + #if SERVO_LEVELING servos[servo_endstops[Z_AXIS]].attach(0); #endif @@ -1364,10 +1368,16 @@ static void retract_z_probe() { } -enum ProbeAction { ProbeStay, ProbeEngage, ProbeRetract, ProbeEngageRetract }; +enum ProbeAction +{ + ProbeStay = 0, + ProbeEngage = (1 << 0), + ProbeRetract = (1 << 1), + ProbeEngageAndRectract = (ProbeEngage | ProbeRetract), +}; /// Probe bed height at position (x,y), returns the measured z value -static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageRetract, int verbose_level=1) { +static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageAndRectract, int verbose_level=1) { // move to right place do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before); do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]); @@ -2330,7 +2340,7 @@ inline void gcode_G28() { act = ProbeStay; } else - act = ProbeEngageRetract; + act = ProbeEngageAndRectract; measured_z = probe_pt(xProbe, yProbe, z_before, act, verbose_level); @@ -2445,9 +2455,6 @@ inline void gcode_G28() { #endif // !AUTO_BED_LEVELING_GRID - do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_AFTER_PROBING); - st_synchronize(); - #ifndef DELTA if (verbose_level > 0) plan_bed_level_matrix.debug(" \n\nBed Level Correction Matrix:"); From 0f034dd97e9969b1d65fa46eb48b067ea4254ab4 Mon Sep 17 00:00:00 2001 From: maverikou Date: Sun, 22 Mar 2015 09:51:43 +0200 Subject: [PATCH 4/7] Clean up Z_RAISE_AFTER_PROBING to work the same in all code paths except Z_PROBE_SLED. --- Marlin/Marlin_main.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 9a6365462..b272d73ef 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1326,7 +1326,7 @@ static void retract_z_probe() { #elif defined(Z_PROBE_ALLEN_KEY) // Move up for safety feedrate = homing_feedrate[X_AXIS]; - destination[Z_AXIS] = current_position[Z_AXIS] + 20; + destination[Z_AXIS] = current_position[Z_AXIS] + Z_RAISE_AFTER_PROBING; prepare_move_raw(); // Move to the start position to initiate retraction @@ -1370,26 +1370,26 @@ static void retract_z_probe() { enum ProbeAction { - ProbeStay = 0, - ProbeEngage = (1 << 0), - ProbeRetract = (1 << 1), - ProbeEngageAndRectract = (ProbeEngage | ProbeRetract), + ProbeStay = 0, + ProbeEngage = (1 << 0), + ProbeRetract = (1 << 1), + ProbeEngageAndRetract = (ProbeEngage | ProbeRetract), }; /// Probe bed height at position (x,y), returns the measured z value -static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageAndRectract, int verbose_level=1) { +static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageAndRetract, int verbose_level=1) { // move to right place do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before); do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]); - #if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY) + #if !defined(Z_PROBE_SLED) if (retract_action & ProbeEngage) engage_z_probe(); #endif run_z_probe(); float measured_z = current_position[Z_AXIS]; - #if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY) + #if !defined(Z_PROBE_SLED) if (retract_action & ProbeRetract) retract_z_probe(); #endif @@ -2231,8 +2231,6 @@ inline void gcode_G28() { #ifdef Z_PROBE_SLED dock_sled(false); // engage (un-dock) the probe - #elif not defined(SERVO_ENDSTOPS) - engage_z_probe(); #endif st_synchronize(); @@ -2340,7 +2338,7 @@ inline void gcode_G28() { act = ProbeStay; } else - act = ProbeEngageAndRectract; + act = ProbeEngageAndRetract; measured_z = probe_pt(xProbe, yProbe, z_before, act, verbose_level); @@ -2474,8 +2472,6 @@ inline void gcode_G28() { #ifdef Z_PROBE_SLED dock_sled(true, -SLED_DOCKING_OFFSET); // dock the probe, correcting for over-travel - #elif not defined(SERVO_ENDSTOPS) - retract_z_probe(); #endif #ifdef Z_PROBE_END_SCRIPT From 15345cc249925c79a90ff0126e1396a99f5e1ecf Mon Sep 17 00:00:00 2001 From: maverikou Date: Sun, 22 Mar 2015 13:49:52 +0200 Subject: [PATCH 5/7] Corrected Z_PROBE_ALLEN_KEY behaviour. --- Marlin/Marlin_main.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index b272d73ef..cdf9e5c6f 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1311,8 +1311,10 @@ static void retract_z_probe() { #ifdef SERVO_ENDSTOPS if (servo_endstops[Z_AXIS] > -1) { + #if Z_RAISE_AFTER_PROBING > 0 do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], Z_RAISE_AFTER_PROBING); st_synchronize(); + #endif #if SERVO_LEVELING servos[servo_endstops[Z_AXIS]].attach(0); @@ -1382,14 +1384,14 @@ static float probe_pt(float x, float y, float z_before, ProbeAction retract_acti do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z_before); do_blocking_move_to(x - X_PROBE_OFFSET_FROM_EXTRUDER, y - Y_PROBE_OFFSET_FROM_EXTRUDER, current_position[Z_AXIS]); - #if !defined(Z_PROBE_SLED) + #if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY) if (retract_action & ProbeEngage) engage_z_probe(); #endif run_z_probe(); float measured_z = current_position[Z_AXIS]; - #if !defined(Z_PROBE_SLED) + #if !defined(Z_PROBE_SLED) && !defined(Z_PROBE_ALLEN_KEY) if (retract_action & ProbeRetract) retract_z_probe(); #endif @@ -2231,6 +2233,8 @@ inline void gcode_G28() { #ifdef Z_PROBE_SLED dock_sled(false); // engage (un-dock) the probe + #elif defined(Z_PROBE_ALLEN_KEY) + engage_z_probe(); #endif st_synchronize(); @@ -2472,6 +2476,8 @@ inline void gcode_G28() { #ifdef Z_PROBE_SLED dock_sled(true, -SLED_DOCKING_OFFSET); // dock the probe, correcting for over-travel + #elif defined(Z_PROBE_ALLEN_KEY) + retract_z_probe(); #endif #ifdef Z_PROBE_END_SCRIPT From 146501215f722322baa0042ff31faa321cc4ab39 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 22 Mar 2015 21:45:20 -0700 Subject: [PATCH 6/7] Fix mangled probe_pt calls - Address issue #1669 - Remove the TOPO_ORIGIN configuration setting --- Marlin/Configuration.h | 7 +- Marlin/Marlin_main.cpp | 112 +++++++----------- Marlin/configurator/config/Configuration.h | 7 +- .../Felix/Configuration.h | 7 +- .../Felix/Configuration_DUAL.h | 7 +- .../Hephestos/Configuration.h | 7 +- .../K8200/Configuration.h | 7 +- .../SCARA/Configuration.h | 7 +- .../WITBOX/Configuration.h | 7 +- .../makibox/Configuration.h | 7 +- .../tvrrug/Round2/Configuration.h | 7 +- 11 files changed, 54 insertions(+), 128 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index c892cd9de..897cdfefa 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -417,12 +417,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #ifdef AUTO_BED_LEVELING_GRID - // Use one of these defines to specify the origin - // for a topographical map to be printed for your bed. - enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight }; - #define TOPO_ORIGIN OriginFrontLeft - - // The edges of the rectangle in which to probe +home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index cdf9e5c6f..10aa47f80 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -1370,12 +1370,11 @@ static void retract_z_probe() { } -enum ProbeAction -{ - ProbeStay = 0, - ProbeEngage = (1 << 0), - ProbeRetract = (1 << 1), - ProbeEngageAndRetract = (ProbeEngage | ProbeRetract), +enum ProbeAction { + ProbeStay = 0, + ProbeEngage = BIT(0), + ProbeRetract = BIT(1), + ProbeEngageAndRetract = (ProbeEngage | ProbeRetract) }; /// Probe bed height at position (x,y), returns the measured z value @@ -2178,7 +2177,7 @@ inline void gcode_G28() { #ifdef AUTO_BED_LEVELING_GRID #ifndef DELTA - bool topo_flag = verbose_level > 2 || code_seen('T') || code_seen('t'); + bool do_topography_map = verbose_level > 2 || code_seen('T') || code_seen('t'); #endif if (verbose_level > 0) @@ -2239,9 +2238,10 @@ inline void gcode_G28() { st_synchronize(); - #ifdef DELTA - reset_bed_level(); - #else + #ifdef DELTA + reset_bed_level(); + #else + // make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly //vector_3 corrected_position = plan_get_position_mm(); //corrected_position.debug("position before G29"); @@ -2282,42 +2282,36 @@ inline void gcode_G28() { delta_grid_spacing[1] = yGridSpacing; float z_offset = Z_PROBE_OFFSET_FROM_EXTRUDER; - if (code_seen(axis_codes[Z_AXIS])) { - z_offset += code_value(); - } + if (code_seen(axis_codes[Z_AXIS])) z_offset += code_value(); #endif int probePointCounter = 0; bool zig = true; - for (int yCount=0; yCount < auto_bed_leveling_grid_points; yCount++) - { + for (int yCount = 0; yCount < auto_bed_leveling_grid_points; yCount++) { double yProbe = front_probe_bed_position + yGridSpacing * yCount; int xStart, xStop, xInc; - if (zig) - { + if (zig) { xStart = 0; xStop = auto_bed_leveling_grid_points; xInc = 1; zig = false; } - else - { + else { xStart = auto_bed_leveling_grid_points - 1; xStop = -1; xInc = -1; zig = true; } - #ifndef DELTA - // If topo_flag is set then don't zig-zag. Just scan in one direction. - // This gets the probe points in more readable order. - if (!topo_flag) zig = !zig; - #endif + #ifndef DELTA + // If do_topography_map is set then don't zig-zag. Just scan in one direction. + // This gets the probe points in more readable order. + if (!do_topography_map) zig = !zig; + #endif - for (int xCount=xStart; xCount != xStop; xCount += xInc) - { + for (int xCount = xStart; xCount != xStop; xCount += xInc) { double xProbe = left_probe_bed_position + xGridSpacing * xCount; // raise extruder @@ -2384,49 +2378,31 @@ inline void gcode_G28() { } } - if (topo_flag) { - - int xx, yy; + // Show the Topography map if enabled + if (do_topography_map) { SERIAL_PROTOCOLPGM(" \nBed Height Topography: \n"); - #if TOPO_ORIGIN == OriginFrontLeft - SERIAL_PROTOCOLPGM("+-----------+\n"); - SERIAL_PROTOCOLPGM("|...Back....|\n"); - SERIAL_PROTOCOLPGM("|Left..Right|\n"); - SERIAL_PROTOCOLPGM("|...Front...|\n"); - SERIAL_PROTOCOLPGM("+-----------+\n"); - for (yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) - #else - for (yy = 0; yy < auto_bed_leveling_grid_points; yy++) - #endif - { - #if TOPO_ORIGIN == OriginBackRight - for (xx = 0; xx < auto_bed_leveling_grid_points; xx++) - #else - for (xx = auto_bed_leveling_grid_points - 1; xx >= 0; xx--) - #endif - { - int ind = - #if TOPO_ORIGIN == OriginBackRight || TOPO_ORIGIN == OriginFrontLeft - yy * auto_bed_leveling_grid_points + xx - #elif TOPO_ORIGIN == OriginBackLeft - xx * auto_bed_leveling_grid_points + yy - #elif TOPO_ORIGIN == OriginFrontRight - abl2 - xx * auto_bed_leveling_grid_points - yy - 1 - #endif - ; - float diff = eqnBVector[ind] - mean; - if (diff >= 0.0) - SERIAL_PROTOCOLPGM(" +"); // Include + for column alignment - else - SERIAL_PROTOCOLPGM(" "); - SERIAL_PROTOCOL_F(diff, 5); - } // xx - SERIAL_EOL; - } // yy + SERIAL_PROTOCOLPGM("+-----------+\n"); + SERIAL_PROTOCOLPGM("|...Back....|\n"); + SERIAL_PROTOCOLPGM("|Left..Right|\n"); + SERIAL_PROTOCOLPGM("|...Front...|\n"); + SERIAL_PROTOCOLPGM("+-----------+\n"); + + for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) { + for (int xx = auto_bed_leveling_grid_points - 1; xx >= 0; xx--) { + int ind = yy * auto_bed_leveling_grid_points + xx; + float diff = eqnBVector[ind] - mean; + if (diff >= 0.0) + SERIAL_PROTOCOLPGM(" +"); // Include + for column alignment + else + SERIAL_PROTOCOLPGM(" "); + SERIAL_PROTOCOL_F(diff, 5); + } // xx SERIAL_EOL; + } // yy + SERIAL_EOL; - } //topo_flag + } //do_topography_map set_bed_level_equation_lsq(plane_equation_coefficients); @@ -2448,9 +2424,9 @@ inline void gcode_G28() { z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeRetract, verbose_level); } else { - z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, verbose_level=verbose_level); - z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level=verbose_level); - z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level=verbose_level); + z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, ProbeEngageAndRetract, verbose_level); + z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeEngageAndRetract, verbose_level); + z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeEngageAndRetract, verbose_level); } clean_up_after_endstop_move(); set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3); diff --git a/Marlin/configurator/config/Configuration.h b/Marlin/configurator/config/Configuration.h index 57ec74f9b..bf0dc8f0c 100644 --- a/Marlin/configurator/config/Configuration.h +++ b/Marlin/configurator/config/Configuration.h @@ -440,12 +440,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef AUTO_BED_LEVELING_GRID - // Use one of these defines to specify the origin - // for a topographical map to be printed for your bed. - enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight }; - #define TOPO_ORIGIN OriginFrontLeft - - // The edges of the rectangle in which to probe +home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 diff --git a/Marlin/example_configurations/Felix/Configuration.h b/Marlin/example_configurations/Felix/Configuration.h index 17da67953..973fb6354 100644 --- a/Marlin/example_configurations/Felix/Configuration.h +++ b/Marlin/example_configurations/Felix/Configuration.h @@ -386,12 +386,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Note: this feature occupies 10'206 byte #ifdef AUTO_BED_LEVELING_GRID - // Use one of these defines to specify the origin - // for a topographical map to be printed for your bed. - enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight }; - #define TOPO_ORIGIN OriginFrontLeft - - // set the rectangle in which to probe +home_offset // set the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define BACK_PROBE_BED_POSITION 180 diff --git a/Marlin/example_configurations/Felix/Configuration_DUAL.h b/Marlin/example_configurations/Felix/Configuration_DUAL.h index 9766961a5..42dcd3827 100644 --- a/Marlin/example_configurations/Felix/Configuration_DUAL.h +++ b/Marlin/example_configurations/Felix/Configuration_DUAL.h @@ -386,12 +386,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of // Note: this feature occupies 10'206 byte #ifdef AUTO_BED_LEVELING_GRID - // Use one of these defines to specify the origin - // for a topographical map to be printed for your bed. - enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight }; - #define TOPO_ORIGIN OriginFrontLeft - - // set the rectangle in which to probe +home_offset // set the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define BACK_PROBE_BED_POSITION 180 diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 324554612..27c460c6a 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -410,12 +410,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef AUTO_BED_LEVELING_GRID - // Use one of these defines to specify the origin - // for a topographical map to be printed for your bed. - enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight }; - #define TOPO_ORIGIN OriginFrontLeft - - // The edges of the rectangle in which to probe +home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index b1c63eb4f..4bbcf7bad 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -415,12 +415,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef AUTO_BED_LEVELING_GRID - // Use one of these defines to specify the origin - // for a topographical map to be printed for your bed. - enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight }; - #define TOPO_ORIGIN OriginFrontLeft - - // The edges of the rectangle in which to probe +home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index 6c12c2f19..bebf146f0 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -439,12 +439,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef AUTO_BED_LEVELING_GRID - // Use one of these defines to specify the origin - // for a topographical map to be printed for your bed. - enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight }; - #define TOPO_ORIGIN OriginFrontLeft - - // The edges of the rectangle in which to probe +home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index 8d348ba9b..b819b7a64 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -409,12 +409,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef AUTO_BED_LEVELING_GRID - // Use one of these defines to specify the origin - // for a topographical map to be printed for your bed. - enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight }; - #define TOPO_ORIGIN OriginFrontLeft - - // The edges of the rectangle in which to probe +home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index cb61ca10f..19c56d6ec 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -407,12 +407,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef AUTO_BED_LEVELING_GRID - // Use one of these defines to specify the origin - // for a topographical map to be printed for your bed. - enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight }; - #define TOPO_ORIGIN OriginFrontLeft - - // The edges of the rectangle in which to probe +home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index bf4e27960..f381bceb2 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -409,12 +409,7 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef AUTO_BED_LEVELING_GRID - // Use one of these defines to specify the origin - // for a topographical map to be printed for your bed. - enum { OriginBackLeft, OriginFrontLeft, OriginBackRight, OriginFrontRight }; - #define TOPO_ORIGIN OriginFrontLeft - - // The edges of the rectangle in which to probe +home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 From 7717e1ce330f9b9238a8a9f1970d6c0a11806d9d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 22 Mar 2015 21:48:46 -0700 Subject: [PATCH 7/7] Fix bad insert in configuration --- Marlin/Configuration.h | 1 - Marlin/configurator/config/Configuration.h | 1 - Marlin/example_configurations/Hephestos/Configuration.h | 1 - Marlin/example_configurations/K8200/Configuration.h | 1 - Marlin/example_configurations/SCARA/Configuration.h | 1 - Marlin/example_configurations/WITBOX/Configuration.h | 1 - Marlin/example_configurations/makibox/Configuration.h | 1 - Marlin/example_configurations/tvrrug/Round2/Configuration.h | 1 - 8 files changed, 8 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 897cdfefa..63f906388 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -417,7 +417,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = false; // set to true to invert the logic o #ifdef AUTO_BED_LEVELING_GRID -home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 diff --git a/Marlin/configurator/config/Configuration.h b/Marlin/configurator/config/Configuration.h index bf0dc8f0c..fe1e6bdc3 100644 --- a/Marlin/configurator/config/Configuration.h +++ b/Marlin/configurator/config/Configuration.h @@ -440,7 +440,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef AUTO_BED_LEVELING_GRID -home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 diff --git a/Marlin/example_configurations/Hephestos/Configuration.h b/Marlin/example_configurations/Hephestos/Configuration.h index 27c460c6a..484729c1e 100644 --- a/Marlin/example_configurations/Hephestos/Configuration.h +++ b/Marlin/example_configurations/Hephestos/Configuration.h @@ -410,7 +410,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef AUTO_BED_LEVELING_GRID -home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 diff --git a/Marlin/example_configurations/K8200/Configuration.h b/Marlin/example_configurations/K8200/Configuration.h index 4bbcf7bad..3b178c6b4 100644 --- a/Marlin/example_configurations/K8200/Configuration.h +++ b/Marlin/example_configurations/K8200/Configuration.h @@ -415,7 +415,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef AUTO_BED_LEVELING_GRID -home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 diff --git a/Marlin/example_configurations/SCARA/Configuration.h b/Marlin/example_configurations/SCARA/Configuration.h index bebf146f0..e6b2730dd 100644 --- a/Marlin/example_configurations/SCARA/Configuration.h +++ b/Marlin/example_configurations/SCARA/Configuration.h @@ -439,7 +439,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef AUTO_BED_LEVELING_GRID -home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 diff --git a/Marlin/example_configurations/WITBOX/Configuration.h b/Marlin/example_configurations/WITBOX/Configuration.h index b819b7a64..26d34dc35 100644 --- a/Marlin/example_configurations/WITBOX/Configuration.h +++ b/Marlin/example_configurations/WITBOX/Configuration.h @@ -409,7 +409,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef AUTO_BED_LEVELING_GRID -home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 diff --git a/Marlin/example_configurations/makibox/Configuration.h b/Marlin/example_configurations/makibox/Configuration.h index 19c56d6ec..104b51eaf 100644 --- a/Marlin/example_configurations/makibox/Configuration.h +++ b/Marlin/example_configurations/makibox/Configuration.h @@ -407,7 +407,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef AUTO_BED_LEVELING_GRID -home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20 diff --git a/Marlin/example_configurations/tvrrug/Round2/Configuration.h b/Marlin/example_configurations/tvrrug/Round2/Configuration.h index f381bceb2..e3f592207 100644 --- a/Marlin/example_configurations/tvrrug/Round2/Configuration.h +++ b/Marlin/example_configurations/tvrrug/Round2/Configuration.h @@ -409,7 +409,6 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #ifdef AUTO_BED_LEVELING_GRID -home_offset // The edges of the rectangle in which to probe #define LEFT_PROBE_BED_POSITION 15 #define RIGHT_PROBE_BED_POSITION 170 #define FRONT_PROBE_BED_POSITION 20