mirror of https://github.com/ArduPilot/ardupilot
AP_Notify: add parameter for logic level buzzer sounds at
This commit is contained in:
parent
a97c9bdd5b
commit
f8ac5a5419
|
@ -147,6 +147,15 @@ const AP_Param::GroupInfo AP_Notify::var_info[] = {
|
|||
// @User: Advanced
|
||||
AP_GROUPINFO("LED_TYPES", 6, AP_Notify, _led_type, BUILD_DEFAULT_LED_TYPE),
|
||||
|
||||
#if !defined(HAL_BUZZER_PIN)
|
||||
// @Param: BUZZ_ON_LVL
|
||||
// @DisplayName: Buzzer-on pin logic level
|
||||
// @Description: Specifies pin level that indicates buzzer should play
|
||||
// @Values: 0:LowIsOn,1:HighIsOn
|
||||
// @User: Advanced
|
||||
AP_GROUPINFO("BUZZ_ON_LVL", 7, AP_Notify, _buzzer_level, 1),
|
||||
#endif
|
||||
|
||||
AP_GROUPEND
|
||||
};
|
||||
|
||||
|
|
|
@ -151,6 +151,7 @@ public:
|
|||
|
||||
static const struct AP_Param::GroupInfo var_info[];
|
||||
uint8_t get_buzz_pin() const { return _buzzer_pin; }
|
||||
uint8_t get_buzz_level() const { return _buzzer_level; }
|
||||
|
||||
private:
|
||||
|
||||
|
@ -169,6 +170,7 @@ private:
|
|||
AP_Int8 _oreo_theme;
|
||||
AP_Int8 _buzzer_pin;
|
||||
AP_Int32 _led_type;
|
||||
AP_Int8 _buzzer_level;
|
||||
|
||||
char _send_text[NOTIFY_TEXT_BUFFER_SIZE];
|
||||
uint32_t _send_text_updated_millis; // last time text changed
|
||||
|
|
|
@ -22,8 +22,13 @@
|
|||
#include "AP_Notify.h"
|
||||
|
||||
#ifndef HAL_BUZZER_ON
|
||||
#define HAL_BUZZER_ON 1
|
||||
#define HAL_BUZZER_OFF 0
|
||||
#if !defined(HAL_BUZZER_PIN)
|
||||
#define HAL_BUZZER_ON (pNotify->get_buzz_level())
|
||||
#define HAL_BUZZER_OFF (!pNotify->get_buzz_level())
|
||||
#else
|
||||
#define HAL_BUZZER_ON 1
|
||||
#define HAL_BUZZER_OFF 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue