mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 17:01:35 +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)
|
MK::play_beep(int count)
|
||||||
{
|
{
|
||||||
tune_control_s tune = {};
|
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++) {
|
for (int i = 0; i < count; i++) {
|
||||||
orb_publish(ORB_ID(tune_control), _tune_control_sub, &tune);
|
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) {
|
if (tune_control.tune_id < _default_tunes_size) {
|
||||||
switch (tune_control.tune_id) {
|
switch (tune_control.tune_id) {
|
||||||
case tune_control_s::TUNE_ID_CUSTOM:
|
case static_cast<int>(TuneID::CUSTOM):
|
||||||
_frequency = (unsigned)tune_control.frequency;
|
_frequency = (unsigned)tune_control.frequency;
|
||||||
_duration = (unsigned)tune_control.duration;
|
_duration = (unsigned)tune_control.duration;
|
||||||
_silence = (unsigned)tune_control.silence;
|
_silence = (unsigned)tune_control.silence;
|
||||||
_using_custom_msg = true;
|
_using_custom_msg = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case tune_control_s::TUNE_ID_STARTUP:
|
// tunes that have a high priority
|
||||||
case tune_control_s::TUNE_ID_ERROR:
|
case static_cast<int>(TuneID::STARTUP):
|
||||||
case tune_control_s::TUNE_ID_NOTIFY_POSITIVE:
|
case static_cast<int>(TuneID::ERROR):
|
||||||
case tune_control_s::TUNE_ID_NOTIFY_NEUTRAL:
|
case static_cast<int>(TuneID::NOTIFY_POSITIVE):
|
||||||
case tune_control_s::TUNE_ID_NOTIFY_NEGATIVE:
|
case static_cast<int>(TuneID::NOTIFY_NEUTRAL):
|
||||||
|
case static_cast<int>(TuneID::NOTIFY_NEGATIVE):
|
||||||
reset_playing_tune = true;
|
reset_playing_tune = true;
|
||||||
config_tone(false);
|
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:
|
default:
|
||||||
|
|
||||||
// TODO: come up with a better strategy
|
// TODO: come up with a better strategy
|
||||||
|
|||||||
@@ -39,8 +39,7 @@
|
|||||||
|
|
||||||
#include <uORB/uORB.h>
|
#include <uORB/uORB.h>
|
||||||
#include <uORB/topics/tune_control.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 "tune_definition.h"
|
||||||
#include <drivers/drv_tone_alarm.h>
|
|
||||||
|
|
||||||
#define TUNE_MAX_UPDATE_INTERVAL_US 100000
|
#define TUNE_MAX_UPDATE_INTERVAL_US 100000
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user