Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buzzer mute option. #288

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/buzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ void buzzer(uint8_t mode)
{
uint8_t i = 0;

if (mcfg.buzzer_mute)
return;

// Just return if same or higher priority sound is active.
if (buzzerMode <= mode)
return;
Expand Down Expand Up @@ -166,6 +169,21 @@ void buzzer(uint8_t mode)
*/
void buzzerUpdate(void)
{
if (mcfg.buzzer_mute) {
if (buzzerIsOn && rcOptions[BOXBEEPERON]) {
return;
} else if (!buzzerIsOn && rcOptions[BOXBEEPERON]) {
BEEP_ON;
buzzerIsOn = 1;
return;
} else {
BEEP_OFF;
buzzerIsOn = 0;
return;
}
}


// If beeper option from AUX switch has been selected
if (rcOptions[BOXBEEPERON]) {
if (buzzerMode > BUZZER_TX_SET)
Expand Down
1 change: 1 addition & 0 deletions src/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ const clivalue_t valueTable[] = {
{ "rssi_adc_channel", VAR_INT8, &mcfg.rssi_adc_channel, 0, 9 },
{ "rssi_adc_max", VAR_INT16, &mcfg.rssi_adc_max, 1, 4095 },
{ "rssi_adc_offset", VAR_INT16, &mcfg.rssi_adc_offset, 0, 4095 },
{ "buzzer_mute", VAR_INT8, &mcfg.buzzer_mute, 0, 1 },
{ "yaw_direction", VAR_INT8, &cfg.yaw_direction, -1, 1 },
{ "tri_unarmed_servo", VAR_INT8, &cfg.tri_unarmed_servo, 0, 1 },
{ "gimbal_flags", VAR_UINT8, &cfg.gimbal_flags, 0, 255},
Expand Down
1 change: 1 addition & 0 deletions src/mw.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ typedef struct master_t {
uint8_t rssi_adc_channel; // Read analog-rssi from RC-filter (RSSI-PWM to RSSI-Analog), RC_CH2 (unused when in CPPM mode, = 1), RC_CH8 (last channel in PWM mode, = 9), ADC_EXTERNAL_PAD (Rev5 only, = 5), 0 to disable (disabled if rssi_aux_channel > 0 or rssi_adc_channel == power_adc_channel)
uint16_t rssi_adc_max; // max input voltage defined by RC-filter (is RSSI never 100% reduce the value) (1...4095)
uint16_t rssi_adc_offset; // input offset defined by RC-filter (0...4095)
uint8_t buzzer_mute; // buzzer is only activated when BOXITEM is selected

// gps-related stuff
uint8_t gps_type; // See GPSHardware enum.
Expand Down