1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-18 22:05:17 +03:00

Merge remote-tracking branch 'Pierre-A/CLI_beeper_off' into betaflight

This commit is contained in:
borisbstyle 2015-09-29 12:21:18 +02:00
commit babab7aa4e
8 changed files with 82 additions and 15 deletions

View file

@ -361,6 +361,7 @@ static void resetConf(void)
setProfile(0); setProfile(0);
setControlRateProfile(0); setControlRateProfile(0);
masterConfig.beeper_off.flags = BEEPER_OFF_FLAGS_MIN;
masterConfig.version = EEPROM_CONF_VERSION; masterConfig.version = EEPROM_CONF_VERSION;
masterConfig.mixerMode = MIXER_QUADX; masterConfig.mixerMode = MIXER_QUADX;
featureClearAll(); featureClearAll();

View file

@ -99,6 +99,8 @@ typedef struct master_t {
uint8_t blackbox_device; uint8_t blackbox_device;
#endif #endif
beeperOffConditions_t beeper_off;
uint8_t magic_ef; // magic number, should be 0xEF uint8_t magic_ef; // magic number, should be 0xEF
uint8_t chk; // XOR checksum uint8_t chk; // XOR checksum
} master_t; } master_t;

View file

@ -15,33 +15,64 @@
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>. * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "stdbool.h" #include <stdbool.h>
#include "stdint.h"
#include "stdlib.h"
#include "platform.h" #include "platform.h"
#include "build_config.h"
#include "common/maths.h"
#include "common/axis.h"
#include "common/color.h"
#include "common/utils.h"
#include "drivers/gpio.h" #include "drivers/gpio.h"
#include "drivers/sound_beeper.h" #include "drivers/sensor.h"
#include "drivers/system.h" #include "drivers/system.h"
#include "sensors/battery.h" #include "drivers/serial.h"
#include "sensors/sensors.h" #include "drivers/compass.h"
#include "drivers/timer.h"
#include "drivers/pwm_rx.h"
#include "drivers/accgyro.h"
#include "drivers/light_led.h"
#include "drivers/sound_beeper.h"
#include "rx/rx.h" #include "sensors/sensors.h"
#include "sensors/boardalignment.h"
#include "sensors/sonar.h"
#include "sensors/compass.h"
#include "sensors/acceleration.h"
#include "sensors/barometer.h"
#include "sensors/gyro.h"
#include "sensors/battery.h"
#include "io/display.h"
#include "io/escservo.h"
#include "io/rc_controls.h" #include "io/rc_controls.h"
#include "io/gimbal.h"
#include "io/gps.h"
#include "io/ledstrip.h"
#include "io/serial.h"
#include "io/serial_cli.h"
#include "io/serial_msp.h"
#include "io/statusindicator.h" #include "io/statusindicator.h"
#ifdef GPS #include "rx/rx.h"
#include "io/gps.h" #include "rx/msp.h"
#endif
#include "telemetry/telemetry.h"
#include "flight/mixer.h"
#include "flight/altitudehold.h"
#include "flight/failsafe.h"
#include "flight/imu.h"
#include "flight/navigation.h"
#include "io/beeper.h"
#include "config/runtime_config.h" #include "config/runtime_config.h"
#include "config/config.h" #include "config/config.h"
#include "config/config_profile.h"
#include "config/config_master.h"
#include "io/beeper.h"
#if FLASH_SIZE > 64 #if FLASH_SIZE > 64
#define BEEPER_NAMES #define BEEPER_NAMES
#endif #endif
@ -302,6 +333,7 @@ void beeperUpdate(void)
if (!beeperIsOn) { if (!beeperIsOn) {
beeperIsOn = 1; beeperIsOn = 1;
if (currentBeeperEntry->sequence[beeperPos] != 0) { if (currentBeeperEntry->sequence[beeperPos] != 0) {
if (!(masterConfig.beeper_off.flags & (1 << (currentBeeperEntry->mode - 1))))
BEEP_ON; BEEP_ON;
warningLedEnable(); warningLedEnable();
warningLedRefresh(); warningLedRefresh();

View file

@ -37,8 +37,16 @@ typedef enum {
BEEPER_READY_BEEP, // Ring a tone when GPS is locked and ready BEEPER_READY_BEEP, // Ring a tone when GPS is locked and ready
BEEPER_MULTI_BEEPS, // Internal value used by 'beeperConfirmationBeeps()'. BEEPER_MULTI_BEEPS, // Internal value used by 'beeperConfirmationBeeps()'.
BEEPER_ARMED, // Warning beeps when board is armed (repeats until board is disarmed or throttle is increased) BEEPER_ARMED, // Warning beeps when board is armed (repeats until board is disarmed or throttle is increased)
BEEPER_CASE_MAX
} beeperMode_e; } beeperMode_e;
#define BEEPER_OFF_FLAGS_MIN 0
#define BEEPER_OFF_FLAGS_MAX ((1 << (BEEPER_CASE_MAX - 1)) - 1)
typedef struct beeperOffConditions_t {
uint32_t flags;
} beeperOffConditions_t;
void beeper(beeperMode_e mode); void beeper(beeperMode_e mode);
void beeperSilence(void); void beeperSilence(void);
void beeperUpdate(void); void beeperUpdate(void);
@ -47,3 +55,22 @@ uint32_t getArmingBeepTimeMicros(void);
beeperMode_e beeperModeForTableIndex(int idx); beeperMode_e beeperModeForTableIndex(int idx);
const char *beeperNameForTableIndex(int idx); const char *beeperNameForTableIndex(int idx);
int beeperTableEntryCount(void); int beeperTableEntryCount(void);
/* CLI beeper_off_flags = sum of each desired beeper turned off case
BEEPER_GYRO_CALIBRATED, 1
BEEPER_RX_LOST_LANDING, 2 // Beeps SOS when armed and TX is turned off or signal lost (autolanding/autodisarm)
BEEPER_RX_LOST, 4 // Beeps when TX is turned off or signal lost (repeat until TX is okay)
BEEPER_DISARMING, 8 // Beep when disarming the board
BEEPER_ARMING, 16 // Beep when arming the board
BEEPER_ARMING_GPS_FIX, 32 // Beep a special tone when arming the board and GPS has fix
BEEPER_BAT_CRIT_LOW, 64 // Longer warning beeps when battery is critically low (repeats)
BEEPER_BAT_LOW, 128 // Warning beeps when battery is getting low (repeats)
BEEPER_GPS_STATUS, 256
BEEPER_RX_SET, 512 // Beeps when aux channel is set for beep or beep sequence how many satellites has found if GPS enabled
BEEPER_DISARM_REPEAT, 1024 // Beeps sounded while stick held in disarm position
BEEPER_ACC_CALIBRATION, 2048 // ACC inflight calibration completed confirmation
BEEPER_ACC_CALIBRATION_FAIL, 4096 // ACC inflight calibration failed
BEEPER_READY_BEEP, 8192 // Ring a tone when GPS is locked and ready
BEEPER_MULTI_BEEPS, 16384 // Internal value used by 'beeperConfirmationBeeps()'.
BEEPER_ARMED, 32768 // Warning beeps when board is armed (repeats until board is disarmed or throttle is increased)
*/

View file

@ -526,6 +526,8 @@ const clivalue_t valueTable[] = {
{ "magzero_x", VAR_INT16 | MASTER_VALUE, &masterConfig.magZero.raw[X], -32768, 32767 }, { "magzero_x", VAR_INT16 | MASTER_VALUE, &masterConfig.magZero.raw[X], -32768, 32767 },
{ "magzero_y", VAR_INT16 | MASTER_VALUE, &masterConfig.magZero.raw[Y], -32768, 32767 }, { "magzero_y", VAR_INT16 | MASTER_VALUE, &masterConfig.magZero.raw[Y], -32768, 32767 },
{ "magzero_z", VAR_INT16 | MASTER_VALUE, &masterConfig.magZero.raw[Z], -32768, 32767 }, { "magzero_z", VAR_INT16 | MASTER_VALUE, &masterConfig.magZero.raw[Z], -32768, 32767 },
{ "beeper_off_flags", VAR_UINT32 | MASTER_VALUE, &masterConfig.beeper_off.flags, BEEPER_OFF_FLAGS_MIN, BEEPER_OFF_FLAGS_MAX },
}; };
#define VALUE_COUNT (sizeof(valueTable) / sizeof(clivalue_t)) #define VALUE_COUNT (sizeof(valueTable) / sizeof(clivalue_t))

View file

@ -45,6 +45,7 @@
#include "rx/rx.h" #include "rx/rx.h"
#include "rx/msp.h" #include "rx/msp.h"
#include "io/beeper.h"
#include "io/escservo.h" #include "io/escservo.h"
#include "io/rc_controls.h" #include "io/rc_controls.h"
#include "io/gps.h" #include "io/gps.h"

View file

@ -51,6 +51,7 @@
#include "rx/rx.h" #include "rx/rx.h"
#include "io/beeper.h"
#include "io/serial.h" #include "io/serial.h"
#include "io/flashfs.h" #include "io/flashfs.h"
#include "io/gps.h" #include "io/gps.h"

View file

@ -30,6 +30,7 @@
#include "rx/rx.h" #include "rx/rx.h"
#include "rx/msp.h" #include "rx/msp.h"
#include "io/beeper.h"
#include "io/escservo.h" #include "io/escservo.h"
#include "io/rc_controls.h" #include "io/rc_controls.h"
#include "io/gps.h" #include "io/gps.h"