diff --git a/docs/LedStrip.md b/docs/LedStrip.md index 86c2076dc1..08b441a29e 100644 --- a/docs/LedStrip.md +++ b/docs/LedStrip.md @@ -12,6 +12,7 @@ supports the following: * Heading/Orientation lights. * Flight mode specific color schemes. * 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.. diff --git a/src/main/io/ledstrip.c b/src/main/io/ledstrip.c index 75eadc25da..e96a5eabbf 100644 --- a/src/main/io/ledstrip.c +++ b/src/main/io/ledstrip.c @@ -48,8 +48,12 @@ #include "io/ledstrip.h" static bool ledStripInitialised = false; + static failsafe_t* failsafe; +static bool ledStripEnabled = true; +static void ledStripDisable(void); + //#define USE_LED_ANIMATION // timers @@ -741,6 +745,20 @@ void updateLedStrip(void) return; } + if ( IS_RC_MODE_ACTIVE(BOXLEDLOW)){ + if (ledStripEnabled){ + ledStripDisable(); + ledStripEnabled = false; + } + }else{ + ledStripEnabled = true; + } + + if (!ledStripEnabled){ + return; + } + + uint32_t now = micros(); bool indicatorFlashNow = indicatorFlashNow = (int32_t)(now - nextIndicatorFlashAt) >= 0L; @@ -883,4 +901,11 @@ void ledStripEnable(void) ws2811LedStripInit(); } + +static void ledStripDisable(void) +{ + setStripColor(&hsv_black); + + ws2811UpdateStrip(); +} #endif diff --git a/src/main/io/ledstrip.h b/src/main/io/ledstrip.h index 83776b7c21..4e434b4003 100644 --- a/src/main/io/ledstrip.h +++ b/src/main/io/ledstrip.h @@ -74,3 +74,4 @@ void applyDefaultColors(hsvColor_t *colors, uint8_t colorCount); void ledStripEnable(void); + diff --git a/src/main/io/serial_msp.c b/src/main/io/serial_msp.c index e7b1d1a43b..5f2064f92f 100644 --- a/src/main/io/serial_msp.c +++ b/src/main/io/serial_msp.c @@ -617,6 +617,12 @@ void mspInit(serialConfig_t *serialConfig) activeBoxIds[activeBoxIdCount++] = BOXBEEPERON; +#ifdef LED_STRIP + if (feature(FEATURE_LED_STRIP)) { + activeBoxIds[activeBoxIdCount++] = BOXLEDLOW; + } +#endif + if (feature(FEATURE_INFLIGHT_ACC_CAL)) activeBoxIds[activeBoxIdCount++] = BOXCALIB; @@ -746,6 +752,7 @@ static bool processOutCommand(uint8_t cmdMSP) IS_ENABLED(FLIGHT_MODE(PASSTHRU_MODE)) << BOXPASSTHRU | IS_ENABLED(IS_RC_MODE_ACTIVE(BOXBEEPERON)) << BOXBEEPERON | 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(BOXCALIB)) << BOXCALIB | IS_ENABLED(IS_RC_MODE_ACTIVE(BOXGOV)) << BOXGOV |