From 7e0162b59071024133e730345ea8fbe69da976ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Wed, 8 May 2019 11:24:35 +0200 Subject: [PATCH] ToneAlarm: ignore topic updates with 0 timestamp Commander initially publishes a tune_control topic set to 0, which can interfere with the startup tone (as happening on the Pixhawk Cube). --- src/drivers/tone_alarm/ToneAlarm.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/drivers/tone_alarm/ToneAlarm.cpp b/src/drivers/tone_alarm/ToneAlarm.cpp index 3a8094f75a94..7acacf18458b 100644 --- a/src/drivers/tone_alarm/ToneAlarm.cpp +++ b/src/drivers/tone_alarm/ToneAlarm.cpp @@ -139,7 +139,10 @@ void ToneAlarm::orb_update() if (updated) { orb_copy(ORB_ID(tune_control), _tune_control_sub, &_tune); - _play_tone = _tunes.set_control(_tune) == 0; + + if (_tune.timestamp > 0) { + _play_tone = _tunes.set_control(_tune) == 0; + } } }