Skip to content

Commit

Permalink
dgr brightness fix for RGB mode
Browse files Browse the repository at this point in the history
  • Loading branch information
openshwprojects committed Jan 14, 2023
1 parent 53ae644 commit 54701a4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/cmnds/cmd_newLEDDriver.c
Expand Up @@ -336,6 +336,7 @@ void apply_smart_light() {
int firstChannelIndex;
int channelToUse;
byte finalRGBCW[5];
byte baseRGBCW[5];
int maxPossibleIndexToSet;
int emulatedCool = -1;
int value_brightness = 0;
Expand Down Expand Up @@ -374,12 +375,14 @@ void apply_smart_light() {
if(isCWMode() && CFG_HasFlag(OBK_FLAG_LED_ALTERNATE_CW_MODE)) {
for(i = 0; i < 5; i++) {
finalColors[i] = 0;
baseRGBCW[i] = 0;
finalRGBCW[i] = 0;
}
if(g_lightEnableAll) {
for(i = 3; i < 5; i++) {
finalColors[i] = baseColors[i] * g_brightness;
finalRGBCW[i] = baseColors[i] * g_brightness;
baseRGBCW[i] = baseColors[i];
}
}
if(CFG_HasFlag(OBK_FLAG_LED_SMOOTH_TRANSITIONS) == false) {
Expand Down Expand Up @@ -411,7 +414,8 @@ void apply_smart_light() {
}
finalColors[i] = final;
finalRGBCW[i] = final;

baseRGBCW[i] = baseColors[i];

float chVal = final * g_cfg_colorScaleToChannel;
if (chVal > 100.0f)
chVal = 100.0f;
Expand Down Expand Up @@ -464,7 +468,7 @@ void apply_smart_light() {
HAL_FlashVars_SaveLED(g_lightMode,g_brightness / g_cfg_brightnessMult, led_temperature_current,baseColors[0],baseColors[1],baseColors[2],g_lightEnableAll);
}
#ifndef OBK_DISABLE_ALL_DRIVERS
DRV_DGR_OnLedFinalColorsChange(finalRGBCW);
DRV_DGR_OnLedFinalColorsChange(baseRGBCW);
#endif

// I am not sure if it's the best place to do it
Expand Down

0 comments on commit 54701a4

Please sign in to comment.