mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-29 03:36:07 +08:00
tone_alarm move to px4 work queue
This commit is contained in:
@@ -40,7 +40,8 @@
|
||||
#include <px4_time.h>
|
||||
|
||||
ToneAlarm::ToneAlarm() :
|
||||
CDev(TONE_ALARM0_DEVICE_PATH)
|
||||
CDev(TONE_ALARM0_DEVICE_PATH),
|
||||
ScheduledWorkItem(px4::wq_configurations::hp_default)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -65,7 +66,9 @@ int ToneAlarm::init()
|
||||
ToneAlarmInterface::init();
|
||||
|
||||
_running = true;
|
||||
work_queue(HPWORK, &_work, (worker_t)&ToneAlarm::next_trampoline, this, 0);
|
||||
|
||||
ScheduleNow();
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -122,13 +125,12 @@ void ToneAlarm::next_note()
|
||||
}
|
||||
|
||||
// Schedule a callback when the note should stop.
|
||||
work_queue(HPWORK, &_work, (worker_t)&ToneAlarm::next_trampoline, this, USEC2TICK(duration));
|
||||
ScheduleDelayed(duration);
|
||||
}
|
||||
|
||||
void ToneAlarm::next_trampoline(void *argv)
|
||||
void ToneAlarm::Run()
|
||||
{
|
||||
ToneAlarm *toneAlarm = (ToneAlarm *)argv;
|
||||
toneAlarm->next_note();
|
||||
next_note();
|
||||
}
|
||||
|
||||
void ToneAlarm::orb_update()
|
||||
@@ -177,9 +179,6 @@ void ToneAlarm::stop_note()
|
||||
ToneAlarmInterface::stop_note();
|
||||
}
|
||||
|
||||
|
||||
struct work_s ToneAlarm::_work = {};
|
||||
|
||||
/**
|
||||
* Local functions in support of the shell command.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user