mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 00:30:50 +08:00
fix(tone_alarm): stop without waiting for the next note
The driver only checks should_exit() in Run(), which is not scheduled while no tune is played, and is scheduled at the next note while a tune is played. "tone_alarm stop" then waited for the next note, or for its 5 s timeout and deleted the driver with "timeout, forcing stop" when no tune was played. The driver now schedules Run() when it is asked to stop. Assisted-by: Claude:opus-5.5 Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
This commit is contained in:
1 parent
0ea6a82b3d
commit
f9858e1fb7
2 files changed
+11
No files matched your search
@@ -73,6 +73,14 @@ bool ToneAlarm::Init()
|
||||
return true;
|
||||
}
|
||||
|
||||
void ToneAlarm::request_stop()
|
||||
{
|
||||
ModuleBase::request_stop();
|
||||
|
||||
// Run() is not scheduled while no tune is played
|
||||
ScheduleNow();
|
||||
}
|
||||
|
||||
void ToneAlarm::InterruptStopNote(void *arg)
|
||||
{
|
||||
ToneAlarmInterface::stop_note();
|
||||
|
||||
@@ -72,6 +72,9 @@ public:
|
||||
/** @see ModuleBase */
|
||||
static int print_usage(const char *reason = nullptr);
|
||||
|
||||
/** @see ModuleBase */
|
||||
void request_stop() override;
|
||||
|
||||
private:
|
||||
static void InterruptStopNote(void *arg);
|
||||
|
||||
|
||||
Reference in new issue
Block a user