Merge pull request #1738 from thinkyhead/fixup_homing

Fix G29 E and M48 n
master
Scott Lahteine 10 years ago
commit 85b67e5223

@ -2108,8 +2108,8 @@ inline void gcode_G28() {
* *
* Global Parameters: * Global Parameters:
* *
* E/e By default G29 engages / disengages the probe for each point. * E/e By default G29 will engages the probe, test the bed, then disengage.
* Include "E" to engage and disengage the probe just once. * Include "E" to engage/disengage the probe for each sample.
* There's no extra effect if you have a fixed probe. * There's no extra effect if you have a fixed probe.
* Usage: "G29 E" or "G29 e" * Usage: "G29 E" or "G29 e"
* *
@ -2135,7 +2135,7 @@ inline void gcode_G28() {
} }
bool dryrun = code_seen('D') || code_seen('d'); bool dryrun = code_seen('D') || code_seen('d');
bool enhanced_g29 = code_seen('E') || code_seen('e'); bool engage_probe_for_each_reading = code_seen('E') || code_seen('e');
#ifdef AUTO_BED_LEVELING_GRID #ifdef AUTO_BED_LEVELING_GRID
@ -2293,16 +2293,14 @@ inline void gcode_G28() {
// Enhanced G29 - Do not retract servo between probes // Enhanced G29 - Do not retract servo between probes
ProbeAction act; ProbeAction act;
if (enhanced_g29) { if (engage_probe_for_each_reading)
if (yProbe == front_probe_bed_position && xCount == 0) act = ProbeEngageAndRetract;
else if (yProbe == front_probe_bed_position && xCount == 0)
act = ProbeEngage; act = ProbeEngage;
else if (yProbe == front_probe_bed_position + (yGridSpacing * (auto_bed_leveling_grid_points - 1)) && xCount == auto_bed_leveling_grid_points - 1) else if (yProbe == front_probe_bed_position + (yGridSpacing * (auto_bed_leveling_grid_points - 1)) && xCount == auto_bed_leveling_grid_points - 1)
act = ProbeRetract; act = ProbeRetract;
else else
act = ProbeStay; act = ProbeStay;
}
else
act = ProbeEngageAndRetract;
measured_z = probe_pt(xProbe, yProbe, z_before, act, verbose_level); measured_z = probe_pt(xProbe, yProbe, z_before, act, verbose_level);
@ -2384,20 +2382,17 @@ inline void gcode_G28() {
#else // !AUTO_BED_LEVELING_GRID #else // !AUTO_BED_LEVELING_GRID
// Probe at 3 arbitrary points // Actions for each probe
float z_at_pt_1, z_at_pt_2, z_at_pt_3; ProbeAction p1, p2, p3;
if (engage_probe_for_each_reading)
p1 = p2 = p3 = ProbeEngageAndRetract;
else
p1 = ProbeEngage, p2 = ProbeStay, p3 = ProbeRetract;
if (enhanced_g29) { // Probe at 3 arbitrary points
// Basic Enhanced G29 float z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, p1, verbose_level),
z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, ProbeEngage, 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, p2, 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, ProbeStay, 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, p3, 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 {
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(); clean_up_after_endstop_move();
if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3); if (!dryrun) set_bed_level_equation_3pts(z_at_pt_1, z_at_pt_2, z_at_pt_3);
@ -2764,7 +2759,7 @@ inline void gcode_M42() {
* *
* Usage: * Usage:
* M48 <n#> <X#> <Y#> <V#> <E> <L#> * M48 <n#> <X#> <Y#> <V#> <E> <L#>
* n = Number of samples (4-50, default 10) * P = Number of sampled points (4-50, default 10)
* X = Sample X position * X = Sample X position
* Y = Sample Y position * Y = Sample Y position
* V = Verbose level (0-4, default=1) * V = Verbose level (0-4, default=1)
@ -2798,10 +2793,10 @@ inline void gcode_M42() {
if (verbose_level > 0) if (verbose_level > 0)
SERIAL_PROTOCOLPGM("M48 Z-Probe Repeatability test\n"); SERIAL_PROTOCOLPGM("M48 Z-Probe Repeatability test\n");
if (code_seen('n')) { if (code_seen('P') || code_seen('p') || code_seen('n')) { // `n` for legacy support only - please use `P`!
n_samples = code_value(); n_samples = code_value();
if (n_samples < 4 || n_samples > 50) { if (n_samples < 4 || n_samples > 50) {
SERIAL_PROTOCOLPGM("?Specified sample size not plausible (4-50).\n"); SERIAL_PROTOCOLPGM("?Sample size not plausible (4-50).\n");
return; return;
} }
} }
@ -2818,7 +2813,7 @@ inline void gcode_M42() {
if (code_seen('X') || code_seen('x')) { if (code_seen('X') || code_seen('x')) {
X_probe_location = code_value() - X_PROBE_OFFSET_FROM_EXTRUDER; X_probe_location = code_value() - X_PROBE_OFFSET_FROM_EXTRUDER;
if (X_probe_location < X_MIN_POS || X_probe_location > X_MAX_POS) { if (X_probe_location < X_MIN_POS || X_probe_location > X_MAX_POS) {
SERIAL_PROTOCOLPGM("?Specified X position out of range.\n"); SERIAL_PROTOCOLPGM("?X position out of range.\n");
return; return;
} }
} }
@ -2826,7 +2821,7 @@ inline void gcode_M42() {
if (code_seen('Y') || code_seen('y')) { if (code_seen('Y') || code_seen('y')) {
Y_probe_location = code_value() - Y_PROBE_OFFSET_FROM_EXTRUDER; Y_probe_location = code_value() - Y_PROBE_OFFSET_FROM_EXTRUDER;
if (Y_probe_location < Y_MIN_POS || Y_probe_location > Y_MAX_POS) { if (Y_probe_location < Y_MIN_POS || Y_probe_location > Y_MAX_POS) {
SERIAL_PROTOCOLPGM("?Specified Y position out of range.\n"); SERIAL_PROTOCOLPGM("?Y position out of range.\n");
return; return;
} }
} }
@ -2835,7 +2830,7 @@ inline void gcode_M42() {
n_legs = code_value(); n_legs = code_value();
if (n_legs == 1) n_legs = 2; if (n_legs == 1) n_legs = 2;
if (n_legs < 0 || n_legs > 15) { if (n_legs < 0 || n_legs > 15) {
SERIAL_PROTOCOLPGM("?Specified number of legs in movement not plausible (0-15).\n"); SERIAL_PROTOCOLPGM("?Number of legs in movement not plausible (0-15).\n");
return; return;
} }
} }
@ -2858,7 +2853,7 @@ inline void gcode_M42() {
// use that as a starting point for each probe. // use that as a starting point for each probe.
// //
if (verbose_level > 2) if (verbose_level > 2)
SERIAL_PROTOCOL("Positioning probe for the test.\n"); SERIAL_PROTOCOL("Positioning the probe...\n");
plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location, plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location,
ext_position, ext_position,
@ -2907,7 +2902,7 @@ inline void gcode_M42() {
//SERIAL_ECHOPAIR("starting radius: ",radius); //SERIAL_ECHOPAIR("starting radius: ",radius);
//SERIAL_ECHOPAIR(" theta: ",theta); //SERIAL_ECHOPAIR(" theta: ",theta);
//SERIAL_ECHOPAIR(" direction: ",rotational_direction); //SERIAL_ECHOPAIR(" direction: ",rotational_direction);
//SERIAL_PROTOCOLLNPGM(""); //SERIAL_EOL;
float dir = rotational_direction ? 1 : -1; float dir = rotational_direction ? 1 : -1;
for (l = 0; l < n_legs - 1; l++) { for (l = 0; l < n_legs - 1; l++) {
@ -2926,7 +2921,7 @@ inline void gcode_M42() {
if (verbose_level > 3) { if (verbose_level > 3) {
SERIAL_ECHOPAIR("x: ", X_current); SERIAL_ECHOPAIR("x: ", X_current);
SERIAL_ECHOPAIR("y: ", Y_current); SERIAL_ECHOPAIR("y: ", Y_current);
SERIAL_PROTOCOLLNPGM(""); SERIAL_EOL;
} }
do_blocking_move_to( X_current, Y_current, Z_current ); do_blocking_move_to( X_current, Y_current, Z_current );
@ -4933,14 +4928,13 @@ void process_commands() {
case 665: // M665 set delta configurations L<diagonal_rod> R<delta_radius> S<segments_per_sec> case 665: // M665 set delta configurations L<diagonal_rod> R<delta_radius> S<segments_per_sec>
gcode_M665(); gcode_M665();
break; break;
case 666: // M666 set delta endstop adjustment #endif
gcode_M666();
break; #if defined(DELTA) || defined(Z_DUAL_ENDSTOPS)
#elif defined(Z_DUAL_ENDSTOPS) case 666: // M666 set delta / dual endstop adjustment
case 666: // M666 set delta endstop adjustment
gcode_M666(); gcode_M666();
break; break;
#endif // DELTA #endif
#ifdef FWRETRACT #ifdef FWRETRACT
case 207: //M207 - set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop] case 207: //M207 - set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop]

Loading…
Cancel
Save