diff --git a/libraries/AP_Scheduler/AP_Scheduler.cpp b/libraries/AP_Scheduler/AP_Scheduler.cpp index 73549302a7..cb2ec29e22 100644 --- a/libraries/AP_Scheduler/AP_Scheduler.cpp +++ b/libraries/AP_Scheduler/AP_Scheduler.cpp @@ -39,8 +39,6 @@ extern const AP_HAL::HAL& hal; -int8_t AP_Scheduler::current_task = -1; - const AP_Param::GroupInfo AP_Scheduler::var_info[] = { // @Param: DEBUG // @DisplayName: Scheduler debug level @@ -163,7 +161,7 @@ void AP_Scheduler::run(uint32_t time_available) // run it _task_time_started = now; - current_task = i; + hal.util->persistent_data.scheduler_task = i; if (_debug > 1 && _perf_counters && _perf_counters[i]) { hal.util->perf_begin(_perf_counters[i]); } @@ -171,7 +169,7 @@ void AP_Scheduler::run(uint32_t time_available) if (_debug > 1 && _perf_counters && _perf_counters[i]) { hal.util->perf_end(_perf_counters[i]); } - current_task = -1; + hal.util->persistent_data.scheduler_task = -1; // record the tick counter when we ran. This drives // when we next run the event @@ -248,7 +246,9 @@ void AP_Scheduler::loop() // Execute the fast loop // --------------------- if (_fastloop_fn) { + hal.util->persistent_data.scheduler_task = -2; _fastloop_fn(); + hal.util->persistent_data.scheduler_task = -1; } // tell the scheduler one tick has passed diff --git a/libraries/AP_Scheduler/AP_Scheduler.h b/libraries/AP_Scheduler/AP_Scheduler.h index 28a070027f..ca49f4dba8 100644 --- a/libraries/AP_Scheduler/AP_Scheduler.h +++ b/libraries/AP_Scheduler/AP_Scheduler.h @@ -142,9 +142,6 @@ public: static const struct AP_Param::GroupInfo var_info[]; - // current running task, or -1 if none. Used to debug stuck tasks - static int8_t current_task; - // loop performance monitoring: AP::PerfInfo perf_info;