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>
This commit is contained in:
Kevin O'Connor
2017-07-27 12:05:29 -04:00
parent 88a10fb31c
commit 62f77f6bc5
4 changed files with 53 additions and 37 deletions

View File

@@ -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;