From 81186e5416c19e1512684ded3db869b97f807814 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Fri, 20 Nov 2015 12:14:32 +0900 Subject: [PATCH] AP_Scheduler: use millis/micros/panic functions --- libraries/AP_Scheduler/AP_Scheduler.cpp | 6 +++--- .../AP_Scheduler/examples/Scheduler_test/Scheduler_test.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libraries/AP_Scheduler/AP_Scheduler.cpp b/libraries/AP_Scheduler/AP_Scheduler.cpp index 2045479690..0e17af59e3 100644 --- a/libraries/AP_Scheduler/AP_Scheduler.cpp +++ b/libraries/AP_Scheduler/AP_Scheduler.cpp @@ -61,7 +61,7 @@ void AP_Scheduler::tick(void) */ void AP_Scheduler::run(uint16_t time_available) { - uint32_t run_started_usec = hal.scheduler->micros(); + uint32_t run_started_usec = AP_HAL::micros(); uint32_t now = run_started_usec; for (uint8_t i=0; i<_num_tasks; i++) { @@ -97,7 +97,7 @@ void AP_Scheduler::run(uint16_t time_available) _last_run[i] = _tick_counter; // work out how long the event actually took - now = hal.scheduler->micros(); + now = AP_HAL::micros(); uint32_t time_taken = now - _task_time_started; if (time_taken > _task_time_allowed) { @@ -134,7 +134,7 @@ update_spare_ticks: */ uint16_t AP_Scheduler::time_available_usec(void) { - uint32_t dt = hal.scheduler->micros() - _task_time_started; + uint32_t dt = AP_HAL::micros() - _task_time_started; if (dt > _task_time_allowed) { return 0; } diff --git a/libraries/AP_Scheduler/examples/Scheduler_test/Scheduler_test.cpp b/libraries/AP_Scheduler/examples/Scheduler_test/Scheduler_test.cpp index 29ca1ef9f2..aea128d524 100644 --- a/libraries/AP_Scheduler/examples/Scheduler_test/Scheduler_test.cpp +++ b/libraries/AP_Scheduler/examples/Scheduler_test/Scheduler_test.cpp @@ -84,7 +84,7 @@ void SchedTest::ins_update(void) */ void SchedTest::one_hz_print(void) { - hal.console->printf("one_hz: t=%lu\n", (unsigned long)hal.scheduler->millis()); + hal.console->printf("one_hz: t=%lu\n", (unsigned long)AP_HAL::millis()); } /* @@ -92,7 +92,7 @@ void SchedTest::one_hz_print(void) */ void SchedTest::five_second_call(void) { - hal.console->printf("five_seconds: t=%lu ins_counter=%u\n", (unsigned long)hal.scheduler->millis(), ins_counter); + hal.console->printf("five_seconds: t=%lu ins_counter=%u\n", (unsigned long)AP_HAL::millis(), ins_counter); } /*