Add PROBE_MANUALLY support to G33

This commit is contained in:
LVD-AC 2017-07-03 17:06:23 +02:00 committed by Scott Lahteine
parent 28deff01b8
commit 3efe4aeef8
4 changed files with 81 additions and 50 deletions

View file

@ -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