From 3ef7a188d0dc89e7a42967ad82145de1c8d1df54 Mon Sep 17 00:00:00 2001 From: Bryan Mayland Date: Tue, 13 Feb 2024 18:01:09 -0500 Subject: [PATCH] Use fixed LED color table in RACE / BEACON LED profiles (#13339) Use the non-custom color table when requiring fixed colors --- src/main/io/ledstrip.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/io/ledstrip.c b/src/main/io/ledstrip.c index 3e04086912..3a1fea4851 100644 --- a/src/main/io/ledstrip.c +++ b/src/main/io/ledstrip.c @@ -1264,9 +1264,11 @@ void ledStripInit(void) ws2811LedStripInit(ledStripConfig()->ioTag); } -static uint8_t selectVisualBeeperColor(uint8_t colorIndex) +static uint8_t selectVisualBeeperColor(uint8_t colorIndex, bool *colorIndexIsCustom) { if (ledStripConfig()->ledstrip_visual_beeper && isBeeperOn()) { + if (colorIndexIsCustom) + *colorIndexIsCustom = false; return ledStripConfig()->ledstrip_visual_beeper_color; } else { return colorIndex; @@ -1279,6 +1281,7 @@ static ledProfileSequence_t applySimpleProfile(timeUs_t currentTimeUs) uint8_t colorIndex = COLOR_BLACK; bool blinkLed = false; bool visualBeeperOverride = true; + bool useCustomColors = false; unsigned flashPeriod; unsigned onPercent; @@ -1308,6 +1311,9 @@ static ledProfileSequence_t applySimpleProfile(timeUs_t currentTimeUs) freq = vtxSettingsConfig()->freq; } colorIndex = getColorByVtxFrequency(freq); + // getColorByVtxFrequency always uses custom colors + // as they may be reassigned by the race director + useCustomColors = true; } } #endif @@ -1335,11 +1341,11 @@ static ledProfileSequence_t applySimpleProfile(timeUs_t currentTimeUs) } if (visualBeeperOverride) { - colorIndex = selectVisualBeeperColor(colorIndex); + colorIndex = selectVisualBeeperColor(colorIndex, &useCustomColors); } if ((colorIndex != previousProfileColorIndex) || (currentTimeUs >= colorUpdateTimeUs)) { - setStripColor(&ledStripStatusModeConfig()->colors[colorIndex]); + setStripColor((useCustomColors) ? &ledStripStatusModeConfig()->colors[colorIndex] : &hsv[colorIndex]); previousProfileColorIndex = colorIndex; colorUpdateTimeUs = currentTimeUs + PROFILE_COLOR_UPDATE_INTERVAL_US; return LED_PROFILE_ADVANCE;