⚡️ Improve Sensorless homing/probing for G28, G33 (#21899)
This commit is contained in:
@ -167,12 +167,15 @@
|
||||
motion_state_t begin_slow_homing() {
|
||||
motion_state_t motion_state{0};
|
||||
motion_state.acceleration.set(planner.settings.max_acceleration_mm_per_s2[X_AXIS],
|
||||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
|
||||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS]
|
||||
OPTARG(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS])
|
||||
);
|
||||
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = 100;
|
||||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = 100;
|
||||
TERN_(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = 100);
|
||||
#if HAS_CLASSIC_JERK
|
||||
motion_state.jerk_state = planner.max_jerk;
|
||||
planner.max_jerk.set(0, 0);
|
||||
planner.max_jerk.set(0, 0 OPTARG(DELTA, 0));
|
||||
#endif
|
||||
planner.reset_acceleration_rates();
|
||||
return motion_state;
|
||||
@ -181,6 +184,7 @@
|
||||
void end_slow_homing(const motion_state_t &motion_state) {
|
||||
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = motion_state.acceleration.x;
|
||||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = motion_state.acceleration.y;
|
||||
TERN_(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = motion_state.acceleration.z);
|
||||
TERN_(HAS_CLASSIC_JERK, planner.max_jerk = motion_state.jerk_state);
|
||||
planner.reset_acceleration_rates();
|
||||
}
|
||||
@ -259,7 +263,7 @@ void GcodeSuite::G28() {
|
||||
reset_stepper_timeout();
|
||||
|
||||
#define HAS_CURRENT_HOME(N) (defined(N##_CURRENT_HOME) && N##_CURRENT_HOME != N##_CURRENT)
|
||||
#if HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(X2) || HAS_CURRENT_HOME(Y) || HAS_CURRENT_HOME(Y2)
|
||||
#if HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(X2) || HAS_CURRENT_HOME(Y) || HAS_CURRENT_HOME(Y2) || (ENABLED(DELTA) && HAS_CURRENT_HOME(Z))
|
||||
#define HAS_HOMING_CURRENT 1
|
||||
#endif
|
||||
|
||||
@ -287,6 +291,11 @@ void GcodeSuite::G28() {
|
||||
stepperY2.rms_current(Y2_CURRENT_HOME);
|
||||
if (DEBUGGING(LEVELING)) debug_current(PSTR("Y2"), tmc_save_current_Y2, Y2_CURRENT_HOME);
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME(Z) && ENABLED(DELTA)
|
||||
const int16_t tmc_save_current_Z = stepperZ.getMilliamps();
|
||||
stepperZ.rms_current(Z_CURRENT_HOME);
|
||||
if (DEBUGGING(LEVELING)) debug_current(PSTR("Z"), tmc_save_current_Z, Z_CURRENT_HOME);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
|
||||
@ -497,6 +506,9 @@ void GcodeSuite::G28() {
|
||||
#if HAS_CURRENT_HOME(Y2)
|
||||
stepperY2.rms_current(tmc_save_current_Y2);
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME(Z) && ENABLED(DELTA)
|
||||
stepperZ.rms_current(tmc_save_current_Z);
|
||||
#endif
|
||||
#if HAS_CURRENT_HOME(I)
|
||||
stepperI.rms_current(tmc_save_current_I);
|
||||
#endif
|
||||
|
@ -71,7 +71,9 @@ float lcd_probe_pt(const xy_pos_t &xy);
|
||||
|
||||
void ac_home() {
|
||||
endstops.enable(true);
|
||||
TERN_(SENSORLESS_HOMING, probe.set_homing_current(true));
|
||||
home_delta();
|
||||
TERN_(SENSORLESS_HOMING, probe.set_homing_current(false));
|
||||
endstops.not_homing();
|
||||
}
|
||||
|
||||
@ -384,6 +386,12 @@ static float auto_tune_a() {
|
||||
* V3 Report settings and probe results
|
||||
*
|
||||
* E Engage the probe for each point
|
||||
*
|
||||
* With SENSORLESS_PROBING:
|
||||
* Use these flags to calibrate stall sensitivity: (e.g., `G33 P1 Y Z` to calibrate X only.)
|
||||
* X Don't activate stallguard on X.
|
||||
* Y Don't activate stallguard on Y.
|
||||
* Z Don't activate stallguard on Z.
|
||||
*/
|
||||
void GcodeSuite::G33() {
|
||||
|
||||
@ -417,6 +425,12 @@ void GcodeSuite::G33() {
|
||||
|
||||
const bool stow_after_each = parser.seen_test('E');
|
||||
|
||||
#if ENABLED(SENSORLESS_PROBING)
|
||||
probe.test_sensitivity.x = !parser.seen_test('X');
|
||||
TERN_(HAS_Y_AXIS, probe.test_sensitivity.y = !parser.seen_test('Y'));
|
||||
TERN_(HAS_Z_AXIS, probe.test_sensitivity.z = !parser.seen_test('Z'));
|
||||
#endif
|
||||
|
||||
const bool _0p_calibration = probe_points == 0,
|
||||
_1p_calibration = probe_points == 1 || probe_points == -1,
|
||||
_4p_calibration = probe_points == 2,
|
||||
@ -587,7 +601,7 @@ void GcodeSuite::G33() {
|
||||
|
||||
// print report
|
||||
|
||||
if (verbose_level == 3)
|
||||
if (verbose_level == 3 || verbose_level == 0)
|
||||
print_calibration_results(z_at_pt, _tower_results, _opposite_results);
|
||||
|
||||
if (verbose_level != 0) { // !dry run
|
||||
|
Reference in New Issue
Block a user