diff --git a/src/main/config/config_master.h b/src/main/config/config_master.h index 2e74441969..4caf57f1e0 100644 --- a/src/main/config/config_master.h +++ b/src/main/config/config_master.h @@ -166,6 +166,7 @@ typedef struct master_s { modeColorIndexes_t modeColors[LED_MODE_COUNT]; specialColorIndexes_t specialColors; uint8_t ledstrip_visual_beeper; // suppress LEDLOW mode if beeper is on + rc_alias_e ledstrip_aux_channel; #endif #ifdef TRANSPONDER diff --git a/src/main/fc/config.c b/src/main/fc/config.c index 027a80b0f6..c4668bf077 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -672,6 +672,7 @@ void createDefaultConfig(master_t *config) applyDefaultModeColors(config->modeColors); applyDefaultSpecialColors(&(config->specialColors)); config->ledstrip_visual_beeper = 0; + config->ledstrip_aux_channel = THROTTLE; #endif #ifdef VTX diff --git a/src/main/fc/fc_msp.c b/src/main/fc/fc_msp.c index 8fe284997f..1662bc1f7b 100755 --- a/src/main/fc/fc_msp.c +++ b/src/main/fc/fc_msp.c @@ -960,6 +960,11 @@ static bool mspFcProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProcessFn sbufWriteU8(dst, j); sbufWriteU8(dst, masterConfig.specialColors.color[j]); } + + sbufWriteU8(dst, LED_AUX_CHANNEL); + sbufWriteU8(dst, 0); + sbufWriteU8(dst, masterConfig.ledstrip_aux_channel); + break; #endif diff --git a/src/main/io/ledstrip.c b/src/main/io/ledstrip.c index baeb80c957..1892afa876 100644 --- a/src/main/io/ledstrip.c +++ b/src/main/io/ledstrip.c @@ -170,6 +170,7 @@ static const specialColorIndexes_t defaultSpecialColors[] = { }; static int scaledThrottle; +static int scaledAux; static void updateLedRingCounts(void); @@ -253,7 +254,7 @@ bool parseLedStripConfig(int ledIndex, const char *config) RING_COLORS, PARSE_STATE_COUNT }; - static const char chunkSeparators[PARSE_STATE_COUNT] = {',', ':', ':',':', '\0'}; + static const char chunkSeparators[PARSE_STATE_COUNT] = {',', ':', ':', ':', '\0'}; ledConfig_t *ledConfig = &masterConfig.ledConfigs[ledIndex]; memset(ledConfig, 0, sizeof(ledConfig_t)); @@ -492,7 +493,7 @@ static void applyLedFixedLayers() } if (ledGetOverlayBit(ledConfig, LED_OVERLAY_THROTTLE)) { - hOffset += ((scaledThrottle - 10) * 4) / 3; + hOffset += scaledAux; } color.h = (color.h + hOffset) % (HSV_HUE_MAX + 1); @@ -962,6 +963,7 @@ void ledStripUpdate(uint32_t currentTime) // apply all layers; triggered timed functions has to update timers scaledThrottle = ARMING_FLAG(ARMED) ? scaleRange(rcData[THROTTLE], PWM_RANGE_MIN, PWM_RANGE_MAX, 10, 100) : 10; + scaledAux = scaleRange(rcData[masterConfig.ledstrip_aux_channel], PWM_RANGE_MIN, PWM_RANGE_MAX, 0, HSV_HUE_MAX + 1); applyLedFixedLayers(); @@ -1035,6 +1037,10 @@ bool setModeColor(ledModeIndex_e modeIndex, int modeColorIndex, int colorIndex) if (modeColorIndex < 0 || modeColorIndex >= LED_SPECIAL_COLOR_COUNT) return false; masterConfig.specialColors.color[modeColorIndex] = colorIndex; + } else if (modeIndex == LED_AUX_CHANNEL) { + if (modeColorIndex < 0 || modeColorIndex >= 1) + return false; + masterConfig.ledstrip_aux_channel = colorIndex; } else { return false; } diff --git a/src/main/io/ledstrip.h b/src/main/io/ledstrip.h index 351708abcb..de5439902a 100644 --- a/src/main/io/ledstrip.h +++ b/src/main/io/ledstrip.h @@ -75,7 +75,8 @@ typedef enum { LED_MODE_ANGLE, LED_MODE_MAG, LED_MODE_BARO, - LED_SPECIAL + LED_SPECIAL, + LED_AUX_CHANNEL } ledModeIndex_e; typedef enum { diff --git a/src/main/io/serial_cli.c b/src/main/io/serial_cli.c index f757a87b25..ba21f1ed74 100755 --- a/src/main/io/serial_cli.c +++ b/src/main/io/serial_cli.c @@ -1797,13 +1797,18 @@ static void printModeColor(uint8_t dumpMask, master_t *defaultConfig) } } + const char *format = "mode_color %u %u %u\r\n"; for (uint32_t j = 0; j < LED_SPECIAL_COLOR_COUNT; j++) { int colorIndex = masterConfig.specialColors.color[j]; int colorIndexDefault = defaultConfig->specialColors.color[j]; - const char *format = "mode_color %u %u %u\r\n"; cliDefaultPrintf(dumpMask, colorIndex == colorIndexDefault, format, LED_SPECIAL, j, colorIndexDefault); cliDumpPrintf(dumpMask, colorIndex == colorIndexDefault, format, LED_SPECIAL, j, colorIndex); } + + int ledStripAuxChannel = masterConfig.ledstrip_aux_channel; + int ledStripAuxChannelDefault = defaultConfig->ledstrip_aux_channel; + cliDefaultPrintf(dumpMask, ledStripAuxChannel == ledStripAuxChannelDefault, format, LED_AUX_CHANNEL, 0, ledStripAuxChannelDefault); + cliDumpPrintf(dumpMask, ledStripAuxChannel == ledStripAuxChannelDefault, format, LED_AUX_CHANNEL, 0, ledStripAuxChannel); } static void cliModeColor(char *cmdline) diff --git a/src/main/msp/msp_protocol.h b/src/main/msp/msp_protocol.h index 8d14b4d698..338867e55f 100644 --- a/src/main/msp/msp_protocol.h +++ b/src/main/msp/msp_protocol.h @@ -59,7 +59,7 @@ #define MSP_PROTOCOL_VERSION 0 #define API_VERSION_MAJOR 1 // increment when major changes are made -#define API_VERSION_MINOR 21 // increment when any change is made, reset to zero when major changes are released after changing API_VERSION_MAJOR +#define API_VERSION_MINOR 22 // increment when any change is made, reset to zero when major changes are released after changing API_VERSION_MAJOR #define API_VERSION_LENGTH 2