0
0
Fork 0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2025-01-22 17:52:57 +00:00

[1.1.x] G33 clean up (#12649)

Remove obsolete workarounds in G33 for the now fixed zprobe_zoffset bug
This commit is contained in:
Luc Van Daele 2018-12-18 19:44:17 +01:00 committed by Scott Lahteine
parent d7e82b9b81
commit eddb785bee
2 changed files with 25 additions and 63 deletions

View file

@ -1383,7 +1383,11 @@ bool get_target_extruder_from_command(const uint16_t code) {
} }
#elif ENABLED(DELTA) #elif ENABLED(DELTA)
soft_endstop_min[axis] = base_min_pos(axis); soft_endstop_min[axis] = base_min_pos(axis);
soft_endstop_max[axis] = axis == Z_AXIS ? delta_height : base_max_pos(axis); soft_endstop_max[axis] = axis == Z_AXIS ? delta_height
#if HAS_BED_PROBE
- zprobe_zoffset
#endif
: base_max_pos(axis);
#else #else
soft_endstop_min[axis] = base_min_pos(axis); soft_endstop_min[axis] = base_min_pos(axis);
soft_endstop_max[axis] = base_max_pos(axis); soft_endstop_max[axis] = base_max_pos(axis);
@ -1512,13 +1516,14 @@ static void set_axis_is_at_home(const AxisEnum axis) {
} }
else else
#elif ENABLED(DELTA) #elif ENABLED(DELTA)
if (axis == Z_AXIS) current_position[axis] = (axis == Z_AXIS ? delta_height
current_position[axis] = delta_height; #if HAS_BED_PROBE
else - zprobe_zoffset
#endif #endif
{ : base_home_pos(axis));
#else
current_position[axis] = base_home_pos(axis); current_position[axis] = base_home_pos(axis);
} #endif
/** /**
* Z Probe Z Homing? Account for the probe's Z offset. * Z Probe Z Homing? Account for the probe's Z offset.
@ -5750,12 +5755,6 @@ void home_all_axes() { gcode_G28(true); }
if ((!end_stops && tower_angles) || (end_stops && !tower_angles)) { // XOR if ((!end_stops && tower_angles) || (end_stops && !tower_angles)) { // XOR
SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); SERIAL_PROTOCOLPAIR(" Radius:", delta_radius);
} }
#if HAS_BED_PROBE
if (!end_stops && !tower_angles) {
SERIAL_PROTOCOL_SP(30);
print_signed_float(PSTR("Offset"), zprobe_zoffset);
}
#endif
SERIAL_EOL(); SERIAL_EOL();
} }
@ -5804,30 +5803,19 @@ void home_all_axes() { gcode_G28(true); }
/** /**
* - Probe a point * - Probe a point
*/ */
static float calibration_probe(const float &nx, const float &ny, const bool stow, const bool set_up) { static float calibration_probe(const float &nx, const float &ny, const bool stow) {
#if HAS_BED_PROBE #if HAS_BED_PROBE
return probe_pt(nx, ny, set_up ? PROBE_PT_BIG_RAISE : stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, false); return probe_pt(nx, ny, stow ? PROBE_PT_STOW : PROBE_PT_RAISE, 0, false);
#else #else
UNUSED(stow); UNUSED(stow);
UNUSED(set_up);
return lcd_probe_pt(nx, ny); return lcd_probe_pt(nx, ny);
#endif #endif
} }
#if HAS_BED_PROBE && ENABLED(ULTIPANEL)
static float probe_z_shift(const float center) {
STOW_PROBE();
endstops.enable_z_probe(false);
float z_shift = lcd_probe_pt(0, 0) - center;
endstops.enable_z_probe(true);
return z_shift;
}
#endif
/** /**
* - Probe a grid * - Probe a grid
*/ */
static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_points, const bool towers_set, const bool stow_after_each, const bool set_up) { static bool probe_calibration_points(float z_pt[NPP + 1], const int8_t probe_points, const bool towers_set, const bool stow_after_each) {
const bool _0p_calibration = probe_points == 0, const bool _0p_calibration = probe_points == 0,
_1p_calibration = probe_points == 1 || probe_points == -1, _1p_calibration = probe_points == 1 || probe_points == -1,
_4p_calibration = probe_points == 2, _4p_calibration = probe_points == 2,
@ -5850,7 +5838,7 @@ void home_all_axes() { gcode_G28(true); }
if (!_0p_calibration) { if (!_0p_calibration) {
if (!_7p_no_intermediates && !_7p_4_intermediates && !_7p_11_intermediates) { // probe the center if (!_7p_no_intermediates && !_7p_4_intermediates && !_7p_11_intermediates) { // probe the center
z_pt[CEN] += calibration_probe(0, 0, stow_after_each, set_up); z_pt[CEN] += calibration_probe(0, 0, stow_after_each);
if (isnan(z_pt[CEN])) return false; if (isnan(z_pt[CEN])) return false;
} }
@ -5860,7 +5848,7 @@ void home_all_axes() { gcode_G28(true); }
I_LOOP_CAL_PT(rad, start, steps) { I_LOOP_CAL_PT(rad, start, steps) {
const float a = RADIANS(210 + (360 / NPP) * (rad - 1)), const float a = RADIANS(210 + (360 / NPP) * (rad - 1)),
r = delta_calibration_radius * 0.1; r = delta_calibration_radius * 0.1;
z_pt[CEN] += calibration_probe(cos(a) * r, sin(a) * r, stow_after_each, set_up); z_pt[CEN] += calibration_probe(cos(a) * r, sin(a) * r, stow_after_each);
if (isnan(z_pt[CEN])) return false; if (isnan(z_pt[CEN])) return false;
} }
z_pt[CEN] /= float(_7p_2_intermediates ? 7 : probe_points); z_pt[CEN] /= float(_7p_2_intermediates ? 7 : probe_points);
@ -5884,7 +5872,7 @@ void home_all_axes() { gcode_G28(true); }
const float a = RADIANS(210 + (360 / NPP) * (rad - 1)), const float a = RADIANS(210 + (360 / NPP) * (rad - 1)),
r = delta_calibration_radius * (1 - 0.1 * (zig_zag ? offset - circle : circle)), r = delta_calibration_radius * (1 - 0.1 * (zig_zag ? offset - circle : circle)),
interpol = fmod(rad, 1); interpol = fmod(rad, 1);
const float z_temp = calibration_probe(cos(a) * r, sin(a) * r, stow_after_each, set_up); const float z_temp = calibration_probe(cos(a) * r, sin(a) * r, stow_after_each);
if (isnan(z_temp)) return false; if (isnan(z_temp)) return false;
// split probe point to neighbouring calibration points // split probe point to neighbouring calibration points
z_pt[uint8_t(LROUND(rad - interpol + NPP - 1)) % NPP + 1] += z_temp * sq(cos(RADIANS(interpol * 90))); z_pt[uint8_t(LROUND(rad - interpol + NPP - 1)) % NPP + 1] += z_temp * sq(cos(RADIANS(interpol * 90)));
@ -6013,10 +6001,7 @@ void home_all_axes() { gcode_G28(true); }
* *
* Parameters: * Parameters:
* *
* S Setup mode; disables probe protection
*
* Pn Number of probe points: * Pn Number of probe points:
* P-1 Checks the z_offset with a center probe and paper test.
* P0 Normalizes calibration. * P0 Normalizes calibration.
* P1 Calibrates height only with center probe. * P1 Calibrates height only with center probe.
* P2 Probe center and towers. Calibrate height, endstops and delta radius. * P2 Probe center and towers. Calibrate height, endstops and delta radius.
@ -6039,22 +6024,15 @@ void home_all_axes() { gcode_G28(true); }
*/ */
inline void gcode_G33() { inline void gcode_G33() {
const bool set_up = const int8_t probe_points = parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
#if HAS_BED_PROBE if (!WITHIN(probe_points, 0, 10)) {
parser.seen('S'); SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (0-10).");
#else
false;
#endif
const int8_t probe_points = set_up ? 2 : parser.intval('P', DELTA_CALIBRATION_DEFAULT_POINTS);
if (!WITHIN(probe_points, -1, 10)) {
SERIAL_PROTOCOLLNPGM("?(P)oints is implausible (-1 - 10).");
return; return;
} }
const bool towers_set = !parser.seen('T'); const bool towers_set = !parser.seen('T');
const float calibration_precision = set_up ? Z_CLEARANCE_BETWEEN_PROBES / 5.0 : parser.floatval('C', 0.0); const float calibration_precision = parser.floatval('C', 0.0);
if (calibration_precision < 0) { if (calibration_precision < 0) {
SERIAL_PROTOCOLLNPGM("?(C)alibration precision is implausible (>=0)."); SERIAL_PROTOCOLLNPGM("?(C)alibration precision is implausible (>=0).");
return; return;
@ -6062,26 +6040,18 @@ void home_all_axes() { gcode_G28(true); }
const int8_t force_iterations = parser.intval('F', 0); const int8_t force_iterations = parser.intval('F', 0);
if (!WITHIN(force_iterations, 0, 30)) { if (!WITHIN(force_iterations, 0, 30)) {
SERIAL_PROTOCOLLNPGM("?(F)orce iteration is implausible (0 - 30)."); SERIAL_PROTOCOLLNPGM("?(F)orce iteration is implausible (0-30).");
return; return;
} }
const int8_t verbose_level = parser.byteval('V', 1); const int8_t verbose_level = parser.byteval('V', 1);
if (!WITHIN(verbose_level, 0, 3)) { if (!WITHIN(verbose_level, 0, 3)) {
SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0 - 3)."); SERIAL_PROTOCOLLNPGM("?(V)erbose level is implausible (0-3).");
return; return;
} }
const bool stow_after_each = parser.seen('E'); const bool stow_after_each = parser.seen('E');
if (set_up) {
delta_height = 999.99;
delta_radius = DELTA_PRINTABLE_RADIUS;
ZERO(delta_endstop_adj);
ZERO(delta_tower_angle_trim);
recalc_delta_settings();
}
const bool _0p_calibration = probe_points == 0, const bool _0p_calibration = probe_points == 0,
_1p_calibration = probe_points == 1 || probe_points == -1, _1p_calibration = probe_points == 1 || probe_points == -1,
_4p_calibration = probe_points == 2, _4p_calibration = probe_points == 2,
@ -6130,7 +6100,6 @@ void home_all_axes() { gcode_G28(true); }
const char *checkingac = PSTR("Checking... AC"); const char *checkingac = PSTR("Checking... AC");
serialprintPGM(checkingac); serialprintPGM(checkingac);
if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)"); if (verbose_level == 0) SERIAL_PROTOCOLPGM(" (DRY-RUN)");
if (set_up) SERIAL_PROTOCOLPGM(" (SET-UP)");
SERIAL_EOL(); SERIAL_EOL();
lcd_setstatusPGM(checkingac); lcd_setstatusPGM(checkingac);
@ -6149,7 +6118,7 @@ void home_all_axes() { gcode_G28(true); }
// Probe the points // Probe the points
zero_std_dev_old = zero_std_dev; zero_std_dev_old = zero_std_dev;
if (!probe_calibration_points(z_at_pt, probe_points, towers_set, stow_after_each, set_up)) { if (!probe_calibration_points(z_at_pt, probe_points, towers_set, stow_after_each)) {
SERIAL_PROTOCOLLNPGM("Correct delta settings with M665 and M666"); SERIAL_PROTOCOLLNPGM("Correct delta settings with M665 and M666");
return AC_CLEANUP(); return AC_CLEANUP();
} }
@ -6197,11 +6166,6 @@ void home_all_axes() { gcode_G28(true); }
delta_calibration_radius = cr_old; delta_calibration_radius = cr_old;
switch (probe_points) { switch (probe_points) {
case -1:
#if HAS_BED_PROBE && ENABLED(ULTIPANEL)
zprobe_zoffset += probe_z_shift(z_at_pt[CEN]);
#endif
case 0: case 0:
test_precision = 0.00; // forced end test_precision = 0.00; // forced end
break; break;

View file

@ -2885,8 +2885,6 @@ void lcd_quick_feedback(const bool clear_buttons) {
MENU_BACK(MSG_MAIN); MENU_BACK(MSG_MAIN);
#if ENABLED(DELTA_AUTO_CALIBRATION) #if ENABLED(DELTA_AUTO_CALIBRATION)
MENU_ITEM(gcode, MSG_DELTA_AUTO_CALIBRATE, PSTR("G33")); MENU_ITEM(gcode, MSG_DELTA_AUTO_CALIBRATE, PSTR("G33"));
MENU_ITEM(gcode, MSG_DELTA_HEIGHT_CALIBRATE, PSTR("G33 P1"));
MENU_ITEM(gcode, MSG_DELTA_Z_OFFSET_CALIBRATE, PSTR("G33 P-1"));
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings); MENU_ITEM(function, MSG_STORE_EEPROM, lcd_store_settings);
MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings); MENU_ITEM(function, MSG_LOAD_EEPROM, lcd_load_settings);