aboutsummaryrefslogtreecommitdiffstats
path: root/src/generic/timer_irq.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2024-10-21 14:26:48 -0400
committerKevin O'Connor <kevin@koconnor.net>2024-10-26 22:09:14 -0400
commitea546c789b4d1278078187b386ba85f324267892 (patch)
treee8259e73ac8385ff1644026c5da24c9c8c38634c /src/generic/timer_irq.c
parentf0a779771249948429e9c88dbec93cb467b606c5 (diff)
downloadkutter-ea546c789b4d1278078187b386ba85f324267892.tar.gz
kutter-ea546c789b4d1278078187b386ba85f324267892.tar.xz
kutter-ea546c789b4d1278078187b386ba85f324267892.zip
sched: Improve timer vs task priority check
Rename sched_tasks_busy() to sched_check_set_tasks_busy() and change it to only return true if tasks are active (running or requested) for two consecutive calls. This makes it less likely that timers will yield to tasks except when tasks really are notably backlogged. This also makes it less likely that multiple steppers controlling the same rail will be interrupted by tasks mid-step. This should slightly improve the timing, and make it less likely that a halt during homing/probing will occur with these steppers taking a different number of total steps. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/generic/timer_irq.c')
-rw-r--r--src/generic/timer_irq.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/generic/timer_irq.c b/src/generic/timer_irq.c
index 40e9336b..7c2e871b 100644
--- a/src/generic/timer_irq.c
+++ b/src/generic/timer_irq.c
@@ -55,7 +55,7 @@ timer_dispatch_many(void)
// Check if there are too many repeat timers
if (diff < (int32_t)(-timer_from_us(1000)))
try_shutdown("Rescheduled timer in the past");
- if (sched_tasks_busy()) {
+ if (sched_check_set_tasks_busy()) {
timer_repeat_until = now + TIMER_REPEAT_TICKS;
return now + TIMER_DEFER_REPEAT_TICKS;
}