diff --git a/msg/tune_control.msg b/msg/tune_control.msg index c788dcfc96..832ad4784a 100644 --- a/msg/tune_control.msg +++ b/msg/tune_control.msg @@ -13,3 +13,5 @@ uint8 volume # value between 0-100 if supported by backend uint8 VOLUME_LEVEL_MIN = 0 uint8 VOLUME_LEVEL_DEFAULT = 40 uint8 VOLUME_LEVEL_MAX = 100 + +uint8 ORB_QUEUE_LENGTH = 3 diff --git a/src/drivers/mkblctrl/mkblctrl.cpp b/src/drivers/mkblctrl/mkblctrl.cpp index 79cfd03d74..cc311dbba1 100644 --- a/src/drivers/mkblctrl/mkblctrl.cpp +++ b/src/drivers/mkblctrl/mkblctrl.cpp @@ -495,7 +495,7 @@ MK::task_main() * advertise the tune_control. */ tune_control_s tune = {}; - _tune_control_sub = orb_advertise(ORB_ID(tune_control), &tune); + _tune_control_sub = orb_advertise_queue(ORB_ID(tune_control), &tune, tune_control_s::ORB_QUEUE_LENGTH); pollfd fds[2]; fds[0].fd = _t_actuators; diff --git a/src/modules/commander/commander_helper.cpp b/src/modules/commander/commander_helper.cpp index 8ab34a04c0..a0107297e7 100644 --- a/src/modules/commander/commander_helper.cpp +++ b/src/modules/commander/commander_helper.cpp @@ -145,7 +145,7 @@ int buzzer_init() tune_durations[TONE_BATTERY_WARNING_FAST_TUNE] = 800000; tune_durations[TONE_BATTERY_WARNING_SLOW_TUNE] = 800000; tune_durations[TONE_SINGLE_BEEP_TUNE] = 300000; - tune_control_pub = orb_advertise(ORB_ID(tune_control), &tune_control); + tune_control_pub = orb_advertise_queue(ORB_ID(tune_control), &tune_control, tune_control_s::ORB_QUEUE_LENGTH); return PX4_OK; } diff --git a/src/modules/events/rc_loss_alarm.cpp b/src/modules/events/rc_loss_alarm.cpp index c63c1d8c32..090305475b 100644 --- a/src/modules/events/rc_loss_alarm.cpp +++ b/src/modules/events/rc_loss_alarm.cpp @@ -104,7 +104,7 @@ void RC_Loss_Alarm::play_tune() tune_control.volume = tune_control_s::VOLUME_LEVEL_MAX; if (_tune_control_pub == nullptr) { - _tune_control_pub = orb_advertise(ORB_ID(tune_control), &tune_control); + _tune_control_pub = orb_advertise_queue(ORB_ID(tune_control), &tune_control, tune_control_s::ORB_QUEUE_LENGTH); } else { orb_publish(ORB_ID(tune_control), _tune_control_pub, &tune_control); @@ -118,7 +118,7 @@ void RC_Loss_Alarm::stop_tune() tune_control.timestamp = hrt_absolute_time(); if (_tune_control_pub == nullptr) { - _tune_control_pub = orb_advertise(ORB_ID(tune_control), &tune_control); + _tune_control_pub = orb_advertise_queue(ORB_ID(tune_control), &tune_control, tune_control_s::ORB_QUEUE_LENGTH); } else { orb_publish(ORB_ID(tune_control), _tune_control_pub, &tune_control); diff --git a/src/systemcmds/tests/test_tone.cpp b/src/systemcmds/tests/test_tone.cpp index 79de97216e..5e63019b3c 100644 --- a/src/systemcmds/tests/test_tone.cpp +++ b/src/systemcmds/tests/test_tone.cpp @@ -52,7 +52,8 @@ int test_tone(int argc, char *argv[]) tune_control_s tune_control = {}; tune_control.tune_id = static_cast(TuneID::NOTIFY_NEGATIVE); - orb_advert_t tune_control_pub = orb_advertise(ORB_ID(tune_control), &tune_control); + orb_advert_t tune_control_pub = orb_advertise_queue(ORB_ID(tune_control), &tune_control, + tune_control_s::ORB_QUEUE_LENGTH); if (argc == 1) { PX4_INFO("Volume silenced for testing predefined tunes 0-20."); diff --git a/src/systemcmds/tune_control/tune_control.cpp b/src/systemcmds/tune_control/tune_control.cpp index 0ce5f8842b..87c971198e 100644 --- a/src/systemcmds/tune_control/tune_control.cpp +++ b/src/systemcmds/tune_control/tune_control.cpp @@ -69,7 +69,7 @@ static void publish_tune_control(tune_control_s &tune_control) if (tune_control_pub == nullptr) { // We have a minimum of 3 so that tune, stop, tune will fit - tune_control_pub = orb_advertise_queue(ORB_ID(tune_control), &tune_control, 3); + tune_control_pub = orb_advertise_queue(ORB_ID(tune_control), &tune_control, tune_control_s::ORB_QUEUE_LENGTH); } else { orb_publish(ORB_ID(tune_control), tune_control_pub, &tune_control);