Browse Source

AP_Scheduler: use persistent_data for current_task

master
Andrew Tridgell 6 years ago
parent
commit
49061aae67
  1. 8
      libraries/AP_Scheduler/AP_Scheduler.cpp
  2. 3
      libraries/AP_Scheduler/AP_Scheduler.h

8
libraries/AP_Scheduler/AP_Scheduler.cpp

@ -39,8 +39,6 @@ @@ -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) @@ -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) @@ -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() @@ -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

3
libraries/AP_Scheduler/AP_Scheduler.h

@ -142,9 +142,6 @@ public: @@ -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;

Loading…
Cancel
Save