diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-07-27 12:05:29 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-08-08 00:27:27 -0400 |
commit | 62f77f6bc56e0fcffdcdd4dcf2cfd6a7669099f2 (patch) | |
tree | 2f711635897b054d1f82f1d967028b8a1573a19f /src/endstop.c | |
parent | 88a10fb31cce34bf3d3a740a70f661d1656b28c5 (diff) | |
download | kutter-62f77f6bc56e0fcffdcdd4dcf2cfd6a7669099f2.tar.gz kutter-62f77f6bc56e0fcffdcdd4dcf2cfd6a7669099f2.tar.xz kutter-62f77f6bc56e0fcffdcdd4dcf2cfd6a7669099f2.zip |
sched: Don't count milliseconds in the periodic timer
It's not necessary to keep a millisecond counter. Replace the two
users of sched_check_periodic() with explicit task wakeup flags.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/endstop.c')
-rw-r--r-- | src/endstop.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/endstop.c b/src/endstop.c index aaaf1baa..5bd863ea 100644 --- a/src/endstop.c +++ b/src/endstop.c @@ -21,6 +21,8 @@ struct end_stop { enum { ESF_PIN_HIGH=1<<0, ESF_HOMING=1<<1, ESF_REPORT=1<<2 }; +static struct task_wake endstop_wake; + static void stop_steppers(struct end_stop *e) { @@ -29,6 +31,7 @@ stop_steppers(struct end_stop *e) while (count--) if (e->steppers[count]) stepper_stop(e->steppers[count]); + sched_wake_task(&endstop_wake); } // Timer callback for an end stop @@ -115,8 +118,7 @@ DECL_COMMAND(command_end_stop_query, "end_stop_query oid=%c"); void end_stop_task(void) { - static uint16_t next; - if (!sched_check_periodic(50, &next)) + if (!sched_check_wake(&endstop_wake)) return; uint8_t oid; struct end_stop *e; |