mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-23 14:47:44 +08:00
libtunes: handle tune override
This commit is contained in:
committed by
Daniel Agar
parent
6c8b16391e
commit
3f123acd7e
+23
-19
@@ -1,22 +1,26 @@
|
||||
# This message is used to control the tunes, when the tune_id is set to CUSTOM
|
||||
# then the frequency, duration are used otherwise those values are ignored.
|
||||
|
||||
# definition of the different tune_id
|
||||
uint8 CUSTOM = 0 # using frequency, duration and strength
|
||||
uint8 STARTUP = 1
|
||||
uint8 ERROR = 2
|
||||
uint8 NOTIFY_POSITIVE = 3
|
||||
uint8 NOTIFY_NEUTRAL = 4
|
||||
uint8 NOTIFY_NEGATIVE = 5
|
||||
uint8 ARMING_WARNING = 6
|
||||
uint8 BATTERY_WARNING_SLOW = 7
|
||||
uint8 BATTERY_WARNING_FAST = 8
|
||||
uint8 GPS_WARNING = 9
|
||||
uint8 ARMING_FAILURE = 10
|
||||
uint8 PARACHUTE_RELEASE = 11
|
||||
uint8 EKF_WARNING = 12
|
||||
uint8 BARO_WARNING = 13
|
||||
uint8 SINGLE_BEEP = 14
|
||||
uint8 HOME_SET = 15
|
||||
uint8 TUNE_ID_CUSTOM = 0
|
||||
uint8 TUNE_ID_STARTUP = 1
|
||||
uint8 TUNE_ID_ERROR = 2
|
||||
uint8 TUNE_ID_NOTIFY_POSITIVE = 3
|
||||
uint8 TUNE_ID_NOTIFY_NEUTRAL = 4
|
||||
uint8 TUNE_ID_NOTIFY_NEGATIVE = 5
|
||||
uint8 TUNE_ID_ARMING_WARNING = 6
|
||||
uint8 TUNE_ID_BATTERY_WARNING_SLOW = 7
|
||||
uint8 TUNE_ID_BATTERY_WARNING_FAST = 8
|
||||
uint8 TUNE_ID_GPS_WARNING = 9
|
||||
uint8 TUNE_ID_ARMING_FAILURE = 10
|
||||
uint8 TUNE_ID_PARACHUTE_RELEASE = 11
|
||||
uint8 TUNE_ID_EKF_WARNING = 12
|
||||
uint8 TUNE_ID_BARO_WARNING = 13
|
||||
uint8 TUNE_ID_SINGLE_BEEP = 14
|
||||
uint8 TUNE_ID_HOME_SET = 15
|
||||
|
||||
uint8 tune_id
|
||||
uint16 frequency
|
||||
uint32 duration # in us
|
||||
uint8 strength # value between 0-100 if supported by backend
|
||||
uint8 tune_override # if set to 1 the tune which is playing will be stopped and the new started
|
||||
uint16 frequency # in Hz
|
||||
uint32 duration # in us
|
||||
uint8 strength # value between 0-100 if supported by backend
|
||||
|
||||
@@ -122,7 +122,7 @@ void Tunes::set_control(const tune_control_s &tune_control)
|
||||
case tune_control_s::TUNE_ID_HOME_SET:
|
||||
|
||||
// TODO: come up with a better strategy
|
||||
if (_tune == nullptr || reset_playing_tune) {
|
||||
if (_tune == nullptr || reset_playing_tune || tune_control.tune_override) {
|
||||
_tune = _default_tunes[tune_control.tune_id];
|
||||
_next = _tune;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user