mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 23:13:34 +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
+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