AP_Scheduler: use persistent_data for current_task

This commit is contained in:
Andrew Tridgell 2019-05-09 20:47:10 +10:00
parent 0873e54cc0
commit 49061aae67
2 changed files with 4 additions and 7 deletions

View File

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

View File

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