Browse Source

tune_control: use orb queue advertisement consistently

sbg
Beat Küng 6 years ago committed by Daniel Agar
parent
commit
72ddf3e0aa
  1. 2
      msg/tune_control.msg
  2. 2
      src/drivers/mkblctrl/mkblctrl.cpp
  3. 2
      src/modules/commander/commander_helper.cpp
  4. 4
      src/modules/events/rc_loss_alarm.cpp
  5. 3
      src/systemcmds/tests/test_tone.cpp
  6. 2
      src/systemcmds/tune_control/tune_control.cpp

2
msg/tune_control.msg

@ -13,3 +13,5 @@ uint8 volume # value between 0-100 if supported by backend @@ -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

2
src/drivers/mkblctrl/mkblctrl.cpp

@ -495,7 +495,7 @@ MK::task_main() @@ -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;

2
src/modules/commander/commander_helper.cpp

@ -145,7 +145,7 @@ int buzzer_init() @@ -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;
}

4
src/modules/events/rc_loss_alarm.cpp

@ -104,7 +104,7 @@ void RC_Loss_Alarm::play_tune() @@ -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() @@ -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);

3
src/systemcmds/tests/test_tone.cpp

@ -52,7 +52,8 @@ int test_tone(int argc, char *argv[]) @@ -52,7 +52,8 @@ int test_tone(int argc, char *argv[])
tune_control_s tune_control = {};
tune_control.tune_id = static_cast<int>(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.");

2
src/systemcmds/tune_control/tune_control.cpp

@ -69,7 +69,7 @@ static void publish_tune_control(tune_control_s &tune_control) @@ -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);

Loading…
Cancel
Save