mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 19:40:31 +03:00
Use fixed LED color table in RACE / BEACON LED profiles (#13339)
Use the non-custom color table when requiring fixed colors
This commit is contained in:
parent
b8d99d7542
commit
3ef7a188d0
1 changed files with 9 additions and 3 deletions
|
@ -1264,9 +1264,11 @@ void ledStripInit(void)
|
||||||
ws2811LedStripInit(ledStripConfig()->ioTag);
|
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 (ledStripConfig()->ledstrip_visual_beeper && isBeeperOn()) {
|
||||||
|
if (colorIndexIsCustom)
|
||||||
|
*colorIndexIsCustom = false;
|
||||||
return ledStripConfig()->ledstrip_visual_beeper_color;
|
return ledStripConfig()->ledstrip_visual_beeper_color;
|
||||||
} else {
|
} else {
|
||||||
return colorIndex;
|
return colorIndex;
|
||||||
|
@ -1279,6 +1281,7 @@ static ledProfileSequence_t applySimpleProfile(timeUs_t currentTimeUs)
|
||||||
uint8_t colorIndex = COLOR_BLACK;
|
uint8_t colorIndex = COLOR_BLACK;
|
||||||
bool blinkLed = false;
|
bool blinkLed = false;
|
||||||
bool visualBeeperOverride = true;
|
bool visualBeeperOverride = true;
|
||||||
|
bool useCustomColors = false;
|
||||||
unsigned flashPeriod;
|
unsigned flashPeriod;
|
||||||
unsigned onPercent;
|
unsigned onPercent;
|
||||||
|
|
||||||
|
@ -1308,6 +1311,9 @@ static ledProfileSequence_t applySimpleProfile(timeUs_t currentTimeUs)
|
||||||
freq = vtxSettingsConfig()->freq;
|
freq = vtxSettingsConfig()->freq;
|
||||||
}
|
}
|
||||||
colorIndex = getColorByVtxFrequency(freq);
|
colorIndex = getColorByVtxFrequency(freq);
|
||||||
|
// getColorByVtxFrequency always uses custom colors
|
||||||
|
// as they may be reassigned by the race director
|
||||||
|
useCustomColors = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1335,11 +1341,11 @@ static ledProfileSequence_t applySimpleProfile(timeUs_t currentTimeUs)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visualBeeperOverride) {
|
if (visualBeeperOverride) {
|
||||||
colorIndex = selectVisualBeeperColor(colorIndex);
|
colorIndex = selectVisualBeeperColor(colorIndex, &useCustomColors);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((colorIndex != previousProfileColorIndex) || (currentTimeUs >= colorUpdateTimeUs)) {
|
if ((colorIndex != previousProfileColorIndex) || (currentTimeUs >= colorUpdateTimeUs)) {
|
||||||
setStripColor(&ledStripStatusModeConfig()->colors[colorIndex]);
|
setStripColor((useCustomColors) ? &ledStripStatusModeConfig()->colors[colorIndex] : &hsv[colorIndex]);
|
||||||
previousProfileColorIndex = colorIndex;
|
previousProfileColorIndex = colorIndex;
|
||||||
colorUpdateTimeUs = currentTimeUs + PROFILE_COLOR_UPDATE_INTERVAL_US;
|
colorUpdateTimeUs = currentTimeUs + PROFILE_COLOR_UPDATE_INTERVAL_US;
|
||||||
return LED_PROFILE_ADVANCE;
|
return LED_PROFILE_ADVANCE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue