mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-22 06:14:14 +08:00
libtunes: Update tunes and mkblctrl to use the tune_definition
This commit is contained in:
committed by
Beat Küng
parent
26b721ac8b
commit
4c6daf0748
@@ -450,7 +450,7 @@ void
|
||||
MK::play_beep(int count)
|
||||
{
|
||||
tune_control_s tune = {};
|
||||
tune.tune_id = tune_control_s::TUNE_ID_SINGLE_BEEP;
|
||||
tune.tune_id = static_cast<int>(TuneID::SINGLE_BEEP);
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
orb_publish(ORB_ID(tune_control), _tune_control_sub, &tune);
|
||||
|
||||
+7
-16
@@ -91,31 +91,22 @@ int Tunes::set_control(const tune_control_s &tune_control)
|
||||
|
||||
if (tune_control.tune_id < _default_tunes_size) {
|
||||
switch (tune_control.tune_id) {
|
||||
case tune_control_s::TUNE_ID_CUSTOM:
|
||||
case static_cast<int>(TuneID::CUSTOM):
|
||||
_frequency = (unsigned)tune_control.frequency;
|
||||
_duration = (unsigned)tune_control.duration;
|
||||
_silence = (unsigned)tune_control.silence;
|
||||
_using_custom_msg = true;
|
||||
break;
|
||||
|
||||
case tune_control_s::TUNE_ID_STARTUP:
|
||||
case tune_control_s::TUNE_ID_ERROR:
|
||||
case tune_control_s::TUNE_ID_NOTIFY_POSITIVE:
|
||||
case tune_control_s::TUNE_ID_NOTIFY_NEUTRAL:
|
||||
case tune_control_s::TUNE_ID_NOTIFY_NEGATIVE:
|
||||
// tunes that have a high priority
|
||||
case static_cast<int>(TuneID::STARTUP):
|
||||
case static_cast<int>(TuneID::ERROR):
|
||||
case static_cast<int>(TuneID::NOTIFY_POSITIVE):
|
||||
case static_cast<int>(TuneID::NOTIFY_NEUTRAL):
|
||||
case static_cast<int>(TuneID::NOTIFY_NEGATIVE):
|
||||
reset_playing_tune = true;
|
||||
config_tone(false);
|
||||
|
||||
/* FALLTHROUGH */
|
||||
case tune_control_s::TUNE_ID_ARMING_WARNING:
|
||||
case tune_control_s::TUNE_ID_BATTERY_WARNING_SLOW:
|
||||
case tune_control_s::TUNE_ID_BATTERY_WARNING_FAST:
|
||||
case tune_control_s::TUNE_ID_GPS_WARNING:
|
||||
case tune_control_s::TUNE_ID_PARACHUTE_RELEASE:
|
||||
case tune_control_s::TUNE_ID_EKF_WARNING:
|
||||
case tune_control_s::TUNE_ID_BARO_WARNING:
|
||||
case tune_control_s::TUNE_ID_SINGLE_BEEP:
|
||||
case tune_control_s::TUNE_ID_HOME_SET:
|
||||
default:
|
||||
|
||||
// TODO: come up with a better strategy
|
||||
|
||||
@@ -39,8 +39,7 @@
|
||||
|
||||
#include <uORB/uORB.h>
|
||||
#include <uORB/topics/tune_control.h>
|
||||
// TODO: find better way to include the number of tunes, maybe include them in the lib directly?
|
||||
#include <drivers/drv_tone_alarm.h>
|
||||
#include "tune_definition.h"
|
||||
|
||||
#define TUNE_MAX_UPDATE_INTERVAL_US 100000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user