mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-26 01:17:51 +08:00
drivers/tone_alarm and tune_control small improvements/cleanup
- drivers/tone_alarm: move to ModuleBase and purge CDev (/dev/tone_alarm0) - drivers/tone_alarm: only run on tune_control publication (or scheduled note) rather than continuously - drivers/tone_alarm: use HRT to schedule tone stop (prevents potential disruption) - msg/tune_control: add tune_id numbering - systemcmds/tune_control: add "error" special case tune_id - move all tune_control publication to new uORB::PublicationQueued<> - start tone_alarm immediately after board defaults are loaded to fix potential startup issues - for SITL (or other boards with no TONE output) print common messages (startup, error, etc)
This commit is contained in:
@@ -44,6 +44,8 @@ class ScheduledWorkItem : public WorkItem
|
||||
{
|
||||
public:
|
||||
|
||||
bool Scheduled() { return !hrt_called(&_call); }
|
||||
|
||||
/**
|
||||
* Schedule next run with a delay in microseconds.
|
||||
*
|
||||
@@ -59,6 +61,13 @@ public:
|
||||
*/
|
||||
void ScheduleOnInterval(uint32_t interval_us, uint32_t delay_us = 0);
|
||||
|
||||
/**
|
||||
* Schedule next run at a specific time.
|
||||
*
|
||||
* @param time_us The time in microseconds.
|
||||
*/
|
||||
void ScheduleAt(hrt_abstime time_us);
|
||||
|
||||
/**
|
||||
* Clear any scheduled work.
|
||||
*/
|
||||
|
||||
@@ -57,6 +57,11 @@ void ScheduledWorkItem::ScheduleOnInterval(uint32_t interval_us, uint32_t delay_
|
||||
hrt_call_every(&_call, delay_us, interval_us, (hrt_callout)&ScheduledWorkItem::schedule_trampoline, this);
|
||||
}
|
||||
|
||||
void ScheduledWorkItem::ScheduleAt(hrt_abstime time_us)
|
||||
{
|
||||
hrt_call_at(&_call, time_us, (hrt_callout)&ScheduledWorkItem::schedule_trampoline, this);
|
||||
}
|
||||
|
||||
void ScheduledWorkItem::ScheduleClear()
|
||||
{
|
||||
// first clear any scheduled hrt call, then remove the item from the runnable queue
|
||||
|
||||
Reference in New Issue
Block a user