Skip to content

Commit

Permalink
🩹 Wrap SENSORLESS_STALLGUARD_DELAY
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jun 4, 2022
1 parent 2c0b8b5 commit 3522d53
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
8 changes: 6 additions & 2 deletions Marlin/src/gcode/calibrate/G28.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@ void GcodeSuite::G28() {
stepperW.rms_current(W_CURRENT_HOME);
if (DEBUGGING(LEVELING)) debug_current(F(STR_W), tmc_save_current_W, W_CURRENT_HOME);
#endif
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
#if SENSORLESS_STALLGUARD_DELAY
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
#endif
#endif

#if ENABLED(IMPROVE_HOMING_RELIABILITY)
Expand Down Expand Up @@ -577,7 +579,9 @@ void GcodeSuite::G28() {
#if HAS_CURRENT_HOME(W)
stepperW.rms_current(tmc_save_current_W);
#endif
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
#if SENSORLESS_STALLGUARD_DELAY
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
#endif
#endif // HAS_HOMING_CURRENT

ui.refresh();
Expand Down
5 changes: 0 additions & 5 deletions Marlin/src/inc/Conditionals_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1048,8 +1048,3 @@
#if ANY(DISABLE_INACTIVE_X, DISABLE_INACTIVE_Y, DISABLE_INACTIVE_Z, DISABLE_INACTIVE_I, DISABLE_INACTIVE_J, DISABLE_INACTIVE_K, DISABLE_INACTIVE_U, DISABLE_INACTIVE_V, DISABLE_INACTIVE_W, DISABLE_INACTIVE_E)
#define HAS_DISABLE_INACTIVE_AXIS 1
#endif

// Delay Sensorless Homing/Probing
#if EITHER(SENSORLESS_HOMING, SENSORLESS_PROBING) && !defined(SENSORLESS_STALLGUARD_DELAY)
#define SENSORLESS_STALLGUARD_DELAY 0
#endif
8 changes: 6 additions & 2 deletions Marlin/src/module/delta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,9 @@ void home_delta() {
TERN_(U_SENSORLESS, sensorless_t stealth_states_u = start_sensorless_homing_per_axis(U_AXIS));
TERN_(V_SENSORLESS, sensorless_t stealth_states_v = start_sensorless_homing_per_axis(V_AXIS));
TERN_(W_SENSORLESS, sensorless_t stealth_states_w = start_sensorless_homing_per_axis(W_AXIS));
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
#if SENSORLESS_STALLGUARD_DELAY
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
#endif
#endif

// Move all carriages together linearly until an endstop is hit.
Expand All @@ -260,7 +262,9 @@ void home_delta() {
TERN_(U_SENSORLESS, end_sensorless_homing_per_axis(U_AXIS, stealth_states_u));
TERN_(V_SENSORLESS, end_sensorless_homing_per_axis(V_AXIS, stealth_states_v));
TERN_(W_SENSORLESS, end_sensorless_homing_per_axis(W_AXIS, stealth_states_w));
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
#if SENSORLESS_STALLGUARD_DELAY
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
#endif
#endif

endstops.validate_homing_move();
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/module/endstops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1679,7 +1679,10 @@ void Endstops::update() {
}

TERN_(IMPROVE_HOMING_RELIABILITY, planner.enable_stall_prevention(onoff));
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle

#if SENSORLESS_STALLGUARD_DELAY
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
#endif

#endif // XYZ
}
Expand Down
8 changes: 6 additions & 2 deletions Marlin/src/module/motion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1665,7 +1665,9 @@ void prepare_line_to_destination() {
// Disable stealthChop if used. Enable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING)
stealth_states = start_sensorless_homing_per_axis(axis);
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
#if SENSORLESS_STALLGUARD_DELAY
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
#endif
#endif
}

Expand Down Expand Up @@ -1704,7 +1706,9 @@ void prepare_line_to_destination() {
// Re-enable stealthChop if used. Disable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING)
end_sensorless_homing_per_axis(axis, stealth_states);
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
#if SENSORLESS_STALLGUARD_DELAY
safe_delay(SENSORLESS_STALLGUARD_DELAY); // Short delay needed to settle
#endif
#endif
}
}
Expand Down

0 comments on commit 3522d53

Please sign in to comment.