motion: correctly reset residuals of a stopping axes

Fixes the motion stutters generally happening as more than a single
axis are active and one completes in the middle of the motion.

Do not generate a spourious interval as one axis exits the queue. This
short interval didn't account for the minimal stepping quantum,
potentially causing a timer overflow.
pull/153/head
Yuri D'Elia 2022-01-31 00:59:42 +01:00 committed by DRracer
parent e7003133f5
commit 5af7d9a10f
1 changed files with 5 additions and 1 deletions

View File

@ -250,11 +250,15 @@ public:
timers[i] = axisData[i].residual;
if (timers[i] <= config::stepTimerQuantum) {
if (timers[i] || !axisData[i].ctrl.QueueEmpty()) {
if (st_timer_t next = axisData[i].ctrl.Step(axisParams[i].params)) {
st_timer_t next = axisData[i].ctrl.Step(axisParams[i].params);
if (next) {
timers[i] += next;
// axis has been moved, run the tmc2130 Isr for this axis
axisData[i].drv.Isr(axisParams[i].params);
} else {
// axis finished, reset residual
timers[i] = 0;
}
}
}