AP_Scheduler: use designated initializers for tasks structs

Makes code less prone to break build and semantics (e.g., when a new field is
added).
This commit is contained in:
Gustavo Jose de Sousa 2015-07-28 11:08:40 -03:00 committed by Andrew Tridgell
parent b0258d902c
commit 2e6074c108

View File

@ -62,7 +62,10 @@ private:
static SchedTest schedtest;
#define SCHED_TASK(func) FUNCTOR_BIND(&schedtest, &SchedTest::func, void)
#define SCHED_TASK(func, _interval_ticks, _max_time_micros) {\
.function = FUNCTOR_BIND(&schedtest, &SchedTest::func, void),\
.interval_ticks = _interval_ticks,\
.max_time_micros = _max_time_micros}
/*
scheduler table - all regular tasks are listed here, along with how
@ -70,9 +73,9 @@ static SchedTest schedtest;
they are expected to take (in microseconds)
*/
const AP_Scheduler::Task SchedTest::scheduler_tasks[] PROGMEM = {
{ SCHED_TASK(ins_update), 1, 1000 },
{ SCHED_TASK(one_hz_print), 50, 1000 },
{ SCHED_TASK(five_second_call), 250, 1800 },
SCHED_TASK(ins_update, 1, 1000),
SCHED_TASK(one_hz_print, 50, 1000),
SCHED_TASK(five_second_call, 250, 1800),
};