|
|
@ -1370,12 +1370,11 @@ static void retract_z_probe() {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
enum ProbeAction
|
|
|
|
enum ProbeAction {
|
|
|
|
{
|
|
|
|
|
|
|
|
ProbeStay = 0,
|
|
|
|
ProbeStay = 0,
|
|
|
|
ProbeEngage = (1 << 0),
|
|
|
|
ProbeEngage = BIT(0),
|
|
|
|
ProbeRetract = (1 << 1),
|
|
|
|
ProbeRetract = BIT(1),
|
|
|
|
ProbeEngageAndRetract = (ProbeEngage | ProbeRetract),
|
|
|
|
ProbeEngageAndRetract = (ProbeEngage | ProbeRetract)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/// Probe bed height at position (x,y), returns the measured z value
|
|
|
|
/// 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
|
|
|
|
#ifdef AUTO_BED_LEVELING_GRID
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef DELTA
|
|
|
|
#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
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (verbose_level > 0)
|
|
|
|
if (verbose_level > 0)
|
|
|
@ -2242,6 +2241,7 @@ inline void gcode_G28() {
|
|
|
|
#ifdef DELTA
|
|
|
|
#ifdef DELTA
|
|
|
|
reset_bed_level();
|
|
|
|
reset_bed_level();
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
|
|
|
|
|
|
|
|
// make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly
|
|
|
|
// make sure the bed_level_rotation_matrix is identity or the planner will get it incorectly
|
|
|
|
//vector_3 corrected_position = plan_get_position_mm();
|
|
|
|
//vector_3 corrected_position = plan_get_position_mm();
|
|
|
|
//corrected_position.debug("position before G29");
|
|
|
|
//corrected_position.debug("position before G29");
|
|
|
@ -2282,28 +2282,23 @@ inline void gcode_G28() {
|
|
|
|
delta_grid_spacing[1] = yGridSpacing;
|
|
|
|
delta_grid_spacing[1] = yGridSpacing;
|
|
|
|
|
|
|
|
|
|
|
|
float z_offset = Z_PROBE_OFFSET_FROM_EXTRUDER;
|
|
|
|
float z_offset = Z_PROBE_OFFSET_FROM_EXTRUDER;
|
|
|
|
if (code_seen(axis_codes[Z_AXIS])) {
|
|
|
|
if (code_seen(axis_codes[Z_AXIS])) z_offset += code_value();
|
|
|
|
z_offset += code_value();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
int probePointCounter = 0;
|
|
|
|
int probePointCounter = 0;
|
|
|
|
bool zig = true;
|
|
|
|
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;
|
|
|
|
double yProbe = front_probe_bed_position + yGridSpacing * yCount;
|
|
|
|
int xStart, xStop, xInc;
|
|
|
|
int xStart, xStop, xInc;
|
|
|
|
|
|
|
|
|
|
|
|
if (zig)
|
|
|
|
if (zig) {
|
|
|
|
{
|
|
|
|
|
|
|
|
xStart = 0;
|
|
|
|
xStart = 0;
|
|
|
|
xStop = auto_bed_leveling_grid_points;
|
|
|
|
xStop = auto_bed_leveling_grid_points;
|
|
|
|
xInc = 1;
|
|
|
|
xInc = 1;
|
|
|
|
zig = false;
|
|
|
|
zig = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else {
|
|
|
|
{
|
|
|
|
|
|
|
|
xStart = auto_bed_leveling_grid_points - 1;
|
|
|
|
xStart = auto_bed_leveling_grid_points - 1;
|
|
|
|
xStop = -1;
|
|
|
|
xStop = -1;
|
|
|
|
xInc = -1;
|
|
|
|
xInc = -1;
|
|
|
@ -2311,13 +2306,12 @@ inline void gcode_G28() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef DELTA
|
|
|
|
#ifndef DELTA
|
|
|
|
// If topo_flag is set then don't zig-zag. Just scan in one direction.
|
|
|
|
// 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.
|
|
|
|
// This gets the probe points in more readable order.
|
|
|
|
if (!topo_flag) zig = !zig;
|
|
|
|
if (!do_topography_map) zig = !zig;
|
|
|
|
#endif
|
|
|
|
#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;
|
|
|
|
double xProbe = left_probe_bed_position + xGridSpacing * xCount;
|
|
|
|
|
|
|
|
|
|
|
|
// raise extruder
|
|
|
|
// raise extruder
|
|
|
@ -2384,37 +2378,19 @@ inline void gcode_G28() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (topo_flag) {
|
|
|
|
// Show the Topography map if enabled
|
|
|
|
|
|
|
|
if (do_topography_map) {
|
|
|
|
int xx, yy;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM(" \nBed Height Topography: \n");
|
|
|
|
SERIAL_PROTOCOLPGM(" \nBed Height Topography: \n");
|
|
|
|
#if TOPO_ORIGIN == OriginFrontLeft
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLPGM("+-----------+\n");
|
|
|
|
SERIAL_PROTOCOLPGM("+-----------+\n");
|
|
|
|
SERIAL_PROTOCOLPGM("|...Back....|\n");
|
|
|
|
SERIAL_PROTOCOLPGM("|...Back....|\n");
|
|
|
|
SERIAL_PROTOCOLPGM("|Left..Right|\n");
|
|
|
|
SERIAL_PROTOCOLPGM("|Left..Right|\n");
|
|
|
|
SERIAL_PROTOCOLPGM("|...Front...|\n");
|
|
|
|
SERIAL_PROTOCOLPGM("|...Front...|\n");
|
|
|
|
SERIAL_PROTOCOLPGM("+-----------+\n");
|
|
|
|
SERIAL_PROTOCOLPGM("+-----------+\n");
|
|
|
|
for (yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--)
|
|
|
|
|
|
|
|
#else
|
|
|
|
for (int yy = auto_bed_leveling_grid_points - 1; yy >= 0; yy--) {
|
|
|
|
for (yy = 0; yy < auto_bed_leveling_grid_points; yy++)
|
|
|
|
for (int xx = auto_bed_leveling_grid_points - 1; xx >= 0; xx--) {
|
|
|
|
#endif
|
|
|
|
int ind = yy * auto_bed_leveling_grid_points + xx;
|
|
|
|
{
|
|
|
|
|
|
|
|
#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;
|
|
|
|
float diff = eqnBVector[ind] - mean;
|
|
|
|
if (diff >= 0.0)
|
|
|
|
if (diff >= 0.0)
|
|
|
|
SERIAL_PROTOCOLPGM(" +"); // Include + for column alignment
|
|
|
|
SERIAL_PROTOCOLPGM(" +"); // Include + for column alignment
|
|
|
@ -2426,7 +2402,7 @@ inline void gcode_G28() {
|
|
|
|
} // yy
|
|
|
|
} // yy
|
|
|
|
SERIAL_EOL;
|
|
|
|
SERIAL_EOL;
|
|
|
|
|
|
|
|
|
|
|
|
} //topo_flag
|
|
|
|
} //do_topography_map
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_bed_level_equation_lsq(plane_equation_coefficients);
|
|
|
|
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);
|
|
|
|
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 {
|
|
|
|
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_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, 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, 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, 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, ProbeEngageAndRetract, verbose_level);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
clean_up_after_endstop_move();
|
|
|
|
clean_up_after_endstop_move();
|
|
|
|
set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
|
|
|
|
set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
|
|
|
|