1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +03:00

Merge pull request #357 from mikeller/ledstrip_visual_beeper

Added 'ledstrip_visual_beeper' option.
This commit is contained in:
borisbstyle 2016-05-24 09:55:42 +02:00
commit 81df1ddda0
6 changed files with 37 additions and 1 deletions

View file

@ -564,6 +564,7 @@ static void resetConf(void)
#ifdef LED_STRIP #ifdef LED_STRIP
applyDefaultColors(masterConfig.colors, CONFIGURABLE_COLOR_COUNT); applyDefaultColors(masterConfig.colors, CONFIGURABLE_COLOR_COUNT);
applyDefaultLedStripConfig(masterConfig.ledConfigs); applyDefaultLedStripConfig(masterConfig.ledConfigs);
masterConfig.ledstrip_visual_beeper = 0;
#endif #endif
#ifdef SPRACINGF3 #ifdef SPRACINGF3

View file

@ -119,6 +119,7 @@ typedef struct master_t {
#ifdef LED_STRIP #ifdef LED_STRIP
ledConfig_t ledConfigs[MAX_LED_STRIP_LENGTH]; ledConfig_t ledConfigs[MAX_LED_STRIP_LENGTH];
hsvColor_t colors[CONFIGURABLE_COLOR_COUNT]; hsvColor_t colors[CONFIGURABLE_COLOR_COUNT];
uint8_t ledstrip_visual_beeper; // suppress LEDLOW mode if beeper is on
#endif #endif
#ifdef TRANSPONDER #ifdef TRANSPONDER

View file

@ -386,6 +386,13 @@ int beeperTableEntryCount(void)
return (int)BEEPER_TABLE_ENTRY_COUNT; return (int)BEEPER_TABLE_ENTRY_COUNT;
} }
/*
* Returns true if the beeper is on, false otherwise
*/
bool isBeeperOn(void) {
return beeperIsOn;
}
#else #else
// Stub out beeper functions if #BEEPER not defined // Stub out beeper functions if #BEEPER not defined
@ -397,5 +404,6 @@ uint32_t getArmingBeepTimeMicros(void) {return 0;}
beeperMode_e beeperModeForTableIndex(int idx) {UNUSED(idx); return BEEPER_SILENCE;} beeperMode_e beeperModeForTableIndex(int idx) {UNUSED(idx); return BEEPER_SILENCE;}
const char *beeperNameForTableIndex(int idx) {UNUSED(idx); return NULL;} const char *beeperNameForTableIndex(int idx) {UNUSED(idx); return NULL;}
int beeperTableEntryCount(void) {return 0;} int beeperTableEntryCount(void) {return 0;}
bool isBeeperOn(void) {return false;}
#endif #endif

View file

@ -53,3 +53,4 @@ 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);
bool isBeeperOn(void);

View file

@ -34,19 +34,41 @@
#include "drivers/light_ws2811strip.h" #include "drivers/light_ws2811strip.h"
#include "drivers/system.h" #include "drivers/system.h"
#include "drivers/serial.h" #include "drivers/serial.h"
#include "drivers/sensor.h"
#include "drivers/accgyro.h"
#include "drivers/gpio.h"
#include "drivers/timer.h"
#include "drivers/pwm_rx.h"
#include <common/printf.h> #include <common/printf.h>
#include "common/axis.h"
#include "io/rc_controls.h" #include "io/rc_controls.h"
#include "sensors/battery.h" #include "sensors/battery.h"
#include "sensors/sensors.h"
#include "sensors/boardalignment.h"
#include "sensors/gyro.h"
#include "sensors/acceleration.h"
#include "sensors/barometer.h"
#include "io/ledstrip.h" #include "io/ledstrip.h"
#include "io/beeper.h"
#include "io/escservo.h"
#include "io/gimbal.h"
#include "io/serial.h"
#include "flight/failsafe.h" #include "flight/failsafe.h"
#include "flight/mixer.h"
#include "flight/pid.h"
#include "flight/imu.h"
#include "telemetry/telemetry.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"
static bool ledStripInitialised = false; static bool ledStripInitialised = false;
static bool ledStripEnabled = true; static bool ledStripEnabled = true;
@ -916,7 +938,7 @@ void updateLedStrip(void)
return; return;
} }
if (IS_RC_MODE_ACTIVE(BOXLEDLOW)) { if (IS_RC_MODE_ACTIVE(BOXLEDLOW) && !(masterConfig.ledstrip_visual_beeper && isBeeperOn())) {
if (ledStripEnabled) { if (ledStripEnabled) {
ledStripDisable(); ledStripDisable();
ledStripEnabled = false; ledStripEnabled = false;

View file

@ -770,6 +770,9 @@ const clivalue_t valueTable[] = {
{ "magzero_x", VAR_INT16 | MASTER_VALUE, &masterConfig.magZero.raw[X], .config.minmax = { -32768, 32767 } }, { "magzero_x", VAR_INT16 | MASTER_VALUE, &masterConfig.magZero.raw[X], .config.minmax = { -32768, 32767 } },
{ "magzero_y", VAR_INT16 | MASTER_VALUE, &masterConfig.magZero.raw[Y], .config.minmax = { -32768, 32767 } }, { "magzero_y", VAR_INT16 | MASTER_VALUE, &masterConfig.magZero.raw[Y], .config.minmax = { -32768, 32767 } },
{ "magzero_z", VAR_INT16 | MASTER_VALUE, &masterConfig.magZero.raw[Z], .config.minmax = { -32768, 32767 } }, { "magzero_z", VAR_INT16 | MASTER_VALUE, &masterConfig.magZero.raw[Z], .config.minmax = { -32768, 32767 } },
#ifdef LED_STRIP
{ "ledstrip_visual_beeper", VAR_UINT8 | MASTER_VALUE | MODE_LOOKUP, &masterConfig.ledstrip_visual_beeper, .config.lookup = { TABLE_OFF_ON } },
#endif
}; };
#define VALUE_COUNT (sizeof(valueTable) / sizeof(clivalue_t)) #define VALUE_COUNT (sizeof(valueTable) / sizeof(clivalue_t))