mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 00:35:39 +03:00
Merge pull request #10972 from SteveCEvans/ledstrip_dim
Add ledstrip_brightness to control LED strip brightness by percentage
This commit is contained in:
commit
aa4f0f7517
6 changed files with 16 additions and 9 deletions
|
@ -115,7 +115,7 @@ const hsvColor_t hsv[] = {
|
|||
// macro to save typing on default colors
|
||||
#define HSV(color) (hsv[COLOR_ ## color])
|
||||
|
||||
PG_REGISTER_WITH_RESET_FN(ledStripConfig_t, ledStripConfig, PG_LED_STRIP_CONFIG, 1);
|
||||
PG_REGISTER_WITH_RESET_FN(ledStripConfig_t, ledStripConfig, PG_LED_STRIP_CONFIG, 2);
|
||||
|
||||
void pgResetFn_ledStripConfig(ledStripConfig_t *ledStripConfig)
|
||||
{
|
||||
|
@ -131,6 +131,7 @@ void pgResetFn_ledStripConfig(ledStripConfig_t *ledStripConfig)
|
|||
ledStripConfig->ledstrip_beacon_percent = 50; // 50% duty cycle
|
||||
ledStripConfig->ledstrip_beacon_armed_only = false; // blink always
|
||||
ledStripConfig->ledstrip_visual_beeper_color = VISUAL_BEEPER_COLOR;
|
||||
ledStripConfig->ledstrip_brightness = 100;
|
||||
#ifndef UNIT_TEST
|
||||
ledStripConfig->ioTag = timerioTagGetByUsage(TIM_USE_LED, 0);
|
||||
#endif
|
||||
|
@ -1077,7 +1078,7 @@ static void applyStatusProfile(timeUs_t now) {
|
|||
bool updateNow = timActive & (1 << timId);
|
||||
(*layerTable[timId])(updateNow, timer);
|
||||
}
|
||||
ws2811UpdateStrip((ledStripFormatRGB_e) ledStripConfig()->ledstrip_grb_rgb);
|
||||
ws2811UpdateStrip((ledStripFormatRGB_e) ledStripConfig()->ledstrip_grb_rgb, ledStripConfig()->ledstrip_brightness);
|
||||
}
|
||||
|
||||
bool parseColor(int index, const char *colorConfig)
|
||||
|
@ -1166,7 +1167,7 @@ void ledStripDisable(void)
|
|||
previousProfileColorIndex = COLOR_UNDEFINED;
|
||||
|
||||
setStripColor(&HSV(BLACK));
|
||||
ws2811UpdateStrip((ledStripFormatRGB_e)ledStripConfig()->ledstrip_grb_rgb);
|
||||
ws2811UpdateStrip((ledStripFormatRGB_e)ledStripConfig()->ledstrip_grb_rgb, ledStripConfig()->ledstrip_brightness);
|
||||
}
|
||||
|
||||
void ledStripInit(void)
|
||||
|
@ -1240,7 +1241,7 @@ static void applySimpleProfile(timeUs_t currentTimeUs)
|
|||
|
||||
if ((colorIndex != previousProfileColorIndex) || (currentTimeUs >= colorUpdateTimeUs)) {
|
||||
setStripColor(&hsv[colorIndex]);
|
||||
ws2811UpdateStrip((ledStripFormatRGB_e)ledStripConfig()->ledstrip_grb_rgb);
|
||||
ws2811UpdateStrip((ledStripFormatRGB_e)ledStripConfig()->ledstrip_grb_rgb, ledStripConfig()->ledstrip_brightness);
|
||||
previousProfileColorIndex = colorIndex;
|
||||
colorUpdateTimeUs = currentTimeUs + PROFILE_COLOR_UPDATE_INTERVAL_US;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue