Merge pull request #7238 from thinkyhead/bf_probe_manual_G33
Add PROBE_MANUALLY support to G33
This commit is contained in:
commit
ef94ddf53c
|
@ -5127,6 +5127,10 @@ void home_all_axes() { gcode_G28(true); }
|
|||
|
||||
#endif // Z_PROBE_SLED
|
||||
|
||||
#endif // HAS_BED_PROBE
|
||||
|
||||
#if PROBE_SELECTED
|
||||
|
||||
#if ENABLED(DELTA_AUTO_CALIBRATION)
|
||||
/**
|
||||
* G33 - Delta '1-4-7-point' Auto-Calibration
|
||||
|
@ -5184,9 +5188,9 @@ void home_all_axes() { gcode_G28(true); }
|
|||
return;
|
||||
}
|
||||
|
||||
const int8_t force_iterations = parser.intval('F', 1);
|
||||
if (!WITHIN(force_iterations, 1, 30)) {
|
||||
SERIAL_PROTOCOLLNPGM("?(F)orce iteration is implausible (1-30).");
|
||||
const int8_t force_iterations = parser.intval('F', 0);
|
||||
if (!WITHIN(force_iterations, 0, 30)) {
|
||||
SERIAL_PROTOCOLLNPGM("?(F)orce iteration is implausible (0-30).");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5221,7 +5225,7 @@ void home_all_axes() { gcode_G28(true); }
|
|||
alpha_old = delta_tower_angle_trim[A_AXIS],
|
||||
beta_old = delta_tower_angle_trim[B_AXIS];
|
||||
|
||||
if (!_1p_calibration) { // test if the outer radius is reachable
|
||||
if (!_1p_calibration) { // test if the outer radius is reachable
|
||||
const float circles = (_7p_quadruple_circle ? 1.5 :
|
||||
_7p_triple_circle ? 1.0 :
|
||||
_7p_double_circle ? 0.5 : 0),
|
||||
|
@ -5273,7 +5277,9 @@ void home_all_axes() { gcode_G28(true); }
|
|||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
home_offset[Z_AXIS] -= probe_pt(dx, dy, stow_after_each, 1, false); // 1st probe to set height
|
||||
#if DISABLED(PROBE_MANUALLY)
|
||||
home_offset[Z_AXIS] -= probe_pt(dx, dy, stow_after_each, 1, false); // 1st probe to set height
|
||||
#endif
|
||||
|
||||
do {
|
||||
|
||||
|
@ -5286,12 +5292,20 @@ void home_all_axes() { gcode_G28(true); }
|
|||
// Probe the points
|
||||
|
||||
if (!_7p_half_circle && !_7p_triple_circle) { // probe the center
|
||||
z_at_pt[0] += probe_pt(dx, dy, stow_after_each, 1, false);
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
z_at_pt[0] += lcd_probe_pt(0, 0);
|
||||
#else
|
||||
z_at_pt[0] += probe_pt(dx, dy, stow_after_each, 1, false);
|
||||
#endif
|
||||
}
|
||||
if (_7p_calibration) { // probe extra center points
|
||||
for (int8_t axis = _7p_multi_circle ? 11 : 9; axis > 0; axis -= _7p_multi_circle ? 2 : 4) {
|
||||
const float a = RADIANS(180 + 30 * axis), r = delta_calibration_radius * 0.1;
|
||||
z_at_pt[0] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false);
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
z_at_pt[0] += lcd_probe_pt(cos(a) * r, sin(a) * r);
|
||||
#else
|
||||
z_at_pt[0] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false);
|
||||
#endif
|
||||
}
|
||||
z_at_pt[0] /= float(_7p_double_circle ? 7 : probe_points);
|
||||
}
|
||||
|
@ -5307,7 +5321,11 @@ void home_all_axes() { gcode_G28(true); }
|
|||
for (float circles = -offset_circles ; circles <= offset_circles; circles++) {
|
||||
const float a = RADIANS(180 + 30 * axis),
|
||||
r = delta_calibration_radius * (1 + circles * (zig_zag ? 0.1 : -0.1));
|
||||
z_at_pt[axis] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false);
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
z_at_pt[axis] += lcd_probe_pt(cos(a) * r, sin(a) * r);
|
||||
#else
|
||||
z_at_pt[axis] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1, false);
|
||||
#endif
|
||||
}
|
||||
zig_zag = !zig_zag;
|
||||
z_at_pt[axis] /= (2 * offset_circles + 1);
|
||||
|
@ -5359,9 +5377,13 @@ void home_all_axes() { gcode_G28(true); }
|
|||
#define Z0444(I) ZP(a_factor * 4.0 / 9.0, I)
|
||||
#define Z0888(I) ZP(a_factor * 8.0 / 9.0, I)
|
||||
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
test_precision = 0.00; // forced end
|
||||
#endif
|
||||
|
||||
switch (probe_points) {
|
||||
case 1:
|
||||
test_precision = 0.00;
|
||||
test_precision = 0.00; // forced end
|
||||
LOOP_XYZ(i) e_delta[i] = Z1000(0);
|
||||
break;
|
||||
|
||||
|
@ -5437,16 +5459,19 @@ void home_all_axes() { gcode_G28(true); }
|
|||
SERIAL_EOL();
|
||||
}
|
||||
}
|
||||
if (test_precision != 0.0) { // !forced end
|
||||
if (verbose_level != 0) { // !dry run
|
||||
if ((zero_std_dev >= test_precision || zero_std_dev <= calibration_precision) && iterations > force_iterations) { // end iterations
|
||||
SERIAL_PROTOCOLPGM("Calibration OK");
|
||||
SERIAL_PROTOCOL_SP(36);
|
||||
if (zero_std_dev >= test_precision)
|
||||
SERIAL_PROTOCOLPGM("rolling back.");
|
||||
else {
|
||||
SERIAL_PROTOCOLPGM("std dev:");
|
||||
SERIAL_PROTOCOL_F(zero_std_dev, 3);
|
||||
}
|
||||
#if DISABLED(PROBE_MANUALLY)
|
||||
if (zero_std_dev >= test_precision && !_1p_calibration)
|
||||
SERIAL_PROTOCOLPGM("rolling back.");
|
||||
else
|
||||
#endif
|
||||
{
|
||||
SERIAL_PROTOCOLPGM("std dev:");
|
||||
SERIAL_PROTOCOL_F(zero_std_dev, 3);
|
||||
}
|
||||
SERIAL_EOL();
|
||||
LCD_MESSAGEPGM("Calibration OK"); // TODO: Make translatable string
|
||||
}
|
||||
|
@ -5480,22 +5505,12 @@ void home_all_axes() { gcode_G28(true); }
|
|||
serialprintPGM(save_message);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
else { // forced end
|
||||
if (verbose_level == 0) {
|
||||
SERIAL_PROTOCOLPGM("End DRY-RUN");
|
||||
SERIAL_PROTOCOL_SP(39);
|
||||
SERIAL_PROTOCOLPGM("std dev:");
|
||||
SERIAL_PROTOCOL_F(zero_std_dev, 3);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
else {
|
||||
SERIAL_PROTOCOLLNPGM("Calibration OK");
|
||||
LCD_MESSAGEPGM("Calibration OK"); // TODO: Make translatable string
|
||||
SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]);
|
||||
SERIAL_EOL();
|
||||
serialprintPGM(save_message);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
else { // dry run
|
||||
SERIAL_PROTOCOLPGM("End DRY-RUN");
|
||||
SERIAL_PROTOCOL_SP(39);
|
||||
SERIAL_PROTOCOLPGM("std dev:");
|
||||
SERIAL_PROTOCOL_F(zero_std_dev, 3);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
|
||||
endstops.enable(true);
|
||||
|
@ -5517,7 +5532,7 @@ void home_all_axes() { gcode_G28(true); }
|
|||
|
||||
#endif // DELTA_AUTO_CALIBRATION
|
||||
|
||||
#endif // HAS_BED_PROBE
|
||||
#endif // PROBE_SELECTED
|
||||
|
||||
#if ENABLED(G38_PROBE_TARGET)
|
||||
|
||||
|
@ -10493,6 +10508,10 @@ void process_next_command() {
|
|||
|
||||
#endif // Z_PROBE_SLED
|
||||
|
||||
#endif // HAS_BED_PROBE
|
||||
|
||||
#if PROBE_SELECTED
|
||||
|
||||
#if ENABLED(DELTA_AUTO_CALIBRATION)
|
||||
|
||||
case 33: // G33: Delta Auto-Calibration
|
||||
|
@ -10501,7 +10520,7 @@ void process_next_command() {
|
|||
|
||||
#endif // DELTA_AUTO_CALIBRATION
|
||||
|
||||
#endif // HAS_BED_PROBE
|
||||
#endif // PROBE_SELECTED
|
||||
|
||||
#if ENABLED(G38_PROBE_TARGET)
|
||||
case 38: // G38.2 & G38.3
|
||||
|
|
|
@ -480,8 +480,10 @@ static_assert(1 >= 0
|
|||
#error "You probably want to use Max Endstops for DELTA!"
|
||||
#elif ENABLED(ENABLE_LEVELING_FADE_HEIGHT) && DISABLED(AUTO_BED_LEVELING_BILINEAR) && !UBL_DELTA
|
||||
#error "ENABLE_LEVELING_FADE_HEIGHT on DELTA requires AUTO_BED_LEVELING_BILINEAR or AUTO_BED_LEVELING_UBL."
|
||||
#elif ENABLED(DELTA_AUTO_CALIBRATION) && !HAS_BED_PROBE
|
||||
#error "DELTA_AUTO_CALIBRATION requires a probe: FIX_MOUNTED_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, or Z Servo."
|
||||
#elif ENABLED(DELTA_AUTO_CALIBRATION) && !PROBE_SELECTED
|
||||
#error "DELTA_AUTO_CALIBRATION requires a probe: PROBE_MANUALLY, FIX_MOUNTED_PROBE, BLTOUCH, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, Z Servo."
|
||||
#elif ENABLED(DELTA_AUTO_CALIBRATION) && ENABLED(PROBE_MANUALLY) && DISABLED(ULTIPANEL)
|
||||
#error "DELTA_AUTO_CALIBRATION requires an LCD controller with PROBE_MANUALLY."
|
||||
#elif ABL_GRID
|
||||
#if (GRID_MAX_POINTS_X & 1) == 0 || (GRID_MAX_POINTS_Y & 1) == 0
|
||||
#error "DELTA requires GRID_MAX_POINTS_X and GRID_MAX_POINTS_Y to be odd numbers."
|
||||
|
|
|
@ -2486,31 +2486,37 @@ void kill_screen(const char* lcd_msg) {
|
|||
lcd_goto_screen(_lcd_calibrate_homing);
|
||||
}
|
||||
|
||||
// Move directly to the tower position with uninterpolated moves
|
||||
// If we used interpolated moves it would cause this to become re-entrant
|
||||
void _goto_tower_pos(const float &a) {
|
||||
void _man_probe_pt(const float &lx, const float &ly) {
|
||||
#if HAS_LEVELING
|
||||
reset_bed_level(); // After calibration bed-level data is no longer valid
|
||||
#endif
|
||||
|
||||
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;
|
||||
float z_dest = LOGICAL_Z_POSITION((Z_CLEARANCE_BETWEEN_PROBES) + (DELTA_PRINTABLE_RADIUS) / 5);
|
||||
line_to_z(z_dest);
|
||||
current_position[X_AXIS] = LOGICAL_X_POSITION(lx);
|
||||
current_position[Y_AXIS] = LOGICAL_Y_POSITION(ly);
|
||||
line_to_current_z();
|
||||
|
||||
line_to_z(4.0);
|
||||
z_dest = LOGICAL_Z_POSITION(Z_CLEARANCE_BETWEEN_PROBES);
|
||||
line_to_z(z_dest);
|
||||
|
||||
lcd_synchronize();
|
||||
|
||||
move_menu_scale = 0.1;
|
||||
lcd_goto_screen(lcd_move_z);
|
||||
}
|
||||
|
||||
void _goto_tower_x() { _goto_tower_pos(210); }
|
||||
void _goto_tower_y() { _goto_tower_pos(330); }
|
||||
void _goto_tower_z() { _goto_tower_pos(90); }
|
||||
void _goto_center() { _goto_tower_pos(-1); }
|
||||
float lcd_probe_pt(const float &lx, const float &ly) {
|
||||
_man_probe_pt(lx, ly);
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
wait_for_user = true;
|
||||
while (wait_for_user) idle();
|
||||
KEEPALIVE_STATE(IN_HANDLER);
|
||||
return current_position[Z_AXIS];
|
||||
}
|
||||
|
||||
void _goto_tower_x() { _man_probe_pt(cos(RADIANS(210)) * delta_calibration_radius, sin(RADIANS(210)) * delta_calibration_radius); }
|
||||
void _goto_tower_y() { _man_probe_pt(cos(RADIANS(330)) * delta_calibration_radius, sin(RADIANS(330)) * delta_calibration_radius); }
|
||||
void _goto_tower_z() { _man_probe_pt(cos(RADIANS( 90)) * delta_calibration_radius, sin(RADIANS( 90)) * delta_calibration_radius); }
|
||||
void _goto_center() { _man_probe_pt(0,0); }
|
||||
|
||||
void lcd_delta_calibrate_menu() {
|
||||
START_MENU();
|
||||
|
|
|
@ -197,4 +197,8 @@ void lcd_reset_status();
|
|||
float lcd_z_offset_edit();
|
||||
#endif
|
||||
|
||||
#if ENABLED(DELTA_CALIBRATION_MENU)
|
||||
float lcd_probe_pt(const float &lx, const float &ly);
|
||||
#endif
|
||||
|
||||
#endif // ULTRALCD_H
|
||||
|
|
Loading…
Reference in a new issue