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

Merge branch 'ledOnOff' of https://github.com/chris-penny/cleanflight into chris-penny-ledOnOff

This commit is contained in:
Dominic Clifton 2015-01-22 20:10:21 +01:00
commit aadf6de5ae
4 changed files with 34 additions and 0 deletions

View file

@ -12,6 +12,7 @@ supports the following:
* Heading/Orientation lights. * Heading/Orientation lights.
* Flight mode specific color schemes. * Flight mode specific color schemes.
* Low battery warning. * Low battery warning.
* AUX operated on/off switch
The function and orientation configuration is fixed for now but later it should be able to be set via the UI or CLI.. The function and orientation configuration is fixed for now but later it should be able to be set via the UI or CLI..

View file

@ -48,8 +48,12 @@
#include "io/ledstrip.h" #include "io/ledstrip.h"
static bool ledStripInitialised = false; static bool ledStripInitialised = false;
static failsafe_t* failsafe; static failsafe_t* failsafe;
static bool ledStripEnabled = true;
static void ledStripDisable(void);
//#define USE_LED_ANIMATION //#define USE_LED_ANIMATION
// timers // timers
@ -741,6 +745,20 @@ void updateLedStrip(void)
return; return;
} }
if ( IS_RC_MODE_ACTIVE(BOXLEDLOW)){
if (ledStripEnabled){
ledStripDisable();
ledStripEnabled = false;
}
}else{
ledStripEnabled = true;
}
if (!ledStripEnabled){
return;
}
uint32_t now = micros(); uint32_t now = micros();
bool indicatorFlashNow = indicatorFlashNow = (int32_t)(now - nextIndicatorFlashAt) >= 0L; bool indicatorFlashNow = indicatorFlashNow = (int32_t)(now - nextIndicatorFlashAt) >= 0L;
@ -883,4 +901,11 @@ void ledStripEnable(void)
ws2811LedStripInit(); ws2811LedStripInit();
} }
static void ledStripDisable(void)
{
setStripColor(&hsv_black);
ws2811UpdateStrip();
}
#endif #endif

View file

@ -74,3 +74,4 @@ void applyDefaultColors(hsvColor_t *colors, uint8_t colorCount);
void ledStripEnable(void); void ledStripEnable(void);

View file

@ -617,6 +617,12 @@ void mspInit(serialConfig_t *serialConfig)
activeBoxIds[activeBoxIdCount++] = BOXBEEPERON; activeBoxIds[activeBoxIdCount++] = BOXBEEPERON;
#ifdef LED_STRIP
if (feature(FEATURE_LED_STRIP)) {
activeBoxIds[activeBoxIdCount++] = BOXLEDLOW;
}
#endif
if (feature(FEATURE_INFLIGHT_ACC_CAL)) if (feature(FEATURE_INFLIGHT_ACC_CAL))
activeBoxIds[activeBoxIdCount++] = BOXCALIB; activeBoxIds[activeBoxIdCount++] = BOXCALIB;
@ -746,6 +752,7 @@ static bool processOutCommand(uint8_t cmdMSP)
IS_ENABLED(FLIGHT_MODE(PASSTHRU_MODE)) << BOXPASSTHRU | IS_ENABLED(FLIGHT_MODE(PASSTHRU_MODE)) << BOXPASSTHRU |
IS_ENABLED(IS_RC_MODE_ACTIVE(BOXBEEPERON)) << BOXBEEPERON | IS_ENABLED(IS_RC_MODE_ACTIVE(BOXBEEPERON)) << BOXBEEPERON |
IS_ENABLED(IS_RC_MODE_ACTIVE(BOXLEDMAX)) << BOXLEDMAX | IS_ENABLED(IS_RC_MODE_ACTIVE(BOXLEDMAX)) << BOXLEDMAX |
IS_ENABLED(IS_RC_MODE_ACTIVE(BOXLEDLOW)) << BOXLEDLOW |
IS_ENABLED(IS_RC_MODE_ACTIVE(BOXLLIGHTS)) << BOXLLIGHTS | IS_ENABLED(IS_RC_MODE_ACTIVE(BOXLLIGHTS)) << BOXLLIGHTS |
IS_ENABLED(IS_RC_MODE_ACTIVE(BOXCALIB)) << BOXCALIB | IS_ENABLED(IS_RC_MODE_ACTIVE(BOXCALIB)) << BOXCALIB |
IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGOV)) << BOXGOV | IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGOV)) << BOXGOV |