Skip to content

Commit d9ba04a

Browse files
tombrazierTracy Spiva
authored and
Tracy Spiva
committed
🐛 Prevent Linear Advance stall (MarlinFirmware#25696)
1 parent 3582113 commit d9ba04a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Marlin/src/module/stepper.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -1578,7 +1578,7 @@ void Stepper::isr() {
15781578
advance_isr();
15791579
nextAdvanceISR = la_interval;
15801580
}
1581-
else if (nextAdvanceISR == LA_ADV_NEVER) // Start LA steps if necessary
1581+
else if (nextAdvanceISR > la_interval) // Start/accelerate LA steps if necessary
15821582
nextAdvanceISR = la_interval;
15831583
#endif
15841584

@@ -2169,7 +2169,8 @@ hal_timer_t Stepper::calc_timer_interval(uint32_t step_rate) {
21692169
#ifdef CPU_32_BIT
21702170

21712171
// A fast processor can just do integer division
2172-
return step_rate ? uint32_t(STEPPER_TIMER_RATE) / step_rate : HAL_TIMER_TYPE_MAX;
2172+
constexpr uint32_t min_step_rate = uint32_t(STEPPER_TIMER_RATE) / HAL_TIMER_TYPE_MAX;
2173+
return step_rate > min_step_rate ? uint32_t(STEPPER_TIMER_RATE) / step_rate : HAL_TIMER_TYPE_MAX;
21732174

21742175
#else
21752176

0 commit comments

Comments
 (0)