Skip to content

Commit 03c0535

Browse files
authored
Merge pull request #143 from Legion2/fix-icue-brightness
added fixIcueBrightness util function
2 parents 65c552b + 5849107 commit 03c0535

File tree

4 files changed

+47
-1
lines changed

4 files changed

+47
-1
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,17 @@ Then the third argument of the `scale` function is `144`.
139139
For both functions it's **important**, that the CRGB arrays have at least the length of the physical LED strip.
140140
This means if your LED channel from iCUE has 50 LEDs and you use the `repeat` function to control 100 physical LEDs you MUST declare the CRGB array at least with a length of 100.
141141

142+
## Increase the Brightness of the LEDs
143+
By default iCUE only uses 50% of the LEDs brightness even if you set the brightness to max in the iCUE Device Settings.
144+
But there are good news, we can increase the brightness with the Arduino so we can use the full brightness of our LEDs.
145+
Add the `CLP::fixIcueBrightness` function to the `onUpdateHook` in the setup function as shown in the [example](examples/AdditionalFeatures/AdditionalFeatures.ino).
146+
If there are multiple functions called in `onUpdateHook`, `fixIcueBrightness` should be the first.
147+
```C++
148+
ledController.onUpdateHook(0, []() {
149+
CLP::fixIcueBrightness(&ledController, 0);
150+
});
151+
```
152+
142153
# License
143154
This project is licensed under the Apache 2.0 License.
144155

examples/AdditionalFeatures/AdditionalFeatures.ino

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,35 @@
2222
CRGB ledsChannel1[60];
2323
CRGB ledsChannel2[60];
2424

25+
// Define a custom SerialNumber for the device
2526
const char mySerialNumber[] PROGMEM = "202B6949A967";
2627

2728
CorsairLightingFirmware firmware = corsairLightingNodePROFirmware();
2829
FastLEDController ledController(true);
2930
CorsairLightingProtocolController cLP(&ledController, &firmware);
31+
// Set the SerialNumber here
3032
CorsairLightingProtocolHID cHID(&cLP, mySerialNumber);
3133

3234
void setup() {
35+
// Disable the build in RX and TX LEDs of the Arduino
3336
CLP::disableBuildInLEDs();
37+
// enable reset on DeviceId (FF FF FF FF)
3438
if (CLP::shouldReset(&firmware)) {
39+
// reset DeviceId and generate new one
3540
CLP::reset(&firmware);
41+
// reset the LEDController Settings
3642
ledController.reset();
3743
}
3844
FastLED.addLeds<WS2812B, DATA_PIN_CHANNEL_1, GRB>(ledsChannel1, 60);
3945
FastLED.addLeds<WS2812B, DATA_PIN_CHANNEL_2, GRB>(ledsChannel2, 60);
4046
ledController.addLEDs(0, ledsChannel1, 60);
4147
ledController.addLEDs(1, ledsChannel2, 60);
48+
49+
// modify the RGB values before they are shown on the LED strip
50+
ledController.onUpdateHook(0, []() {
51+
// increase the brightness of channel 1 when using iCUE, because iCUE only set brightness to max 50%
52+
CLP::fixIcueBrightness(&ledController, 0);
53+
});
4254
}
4355

4456
void loop() {

src/FastLEDControllerUtils.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ void CLP::transformLLFanToStrip(FastLEDController* controller, uint8_t channelIn
2222
auto& channel = controller->getChannel(channelIndex);
2323
if (channel.mode == ChannelMode::SoftwarePlayback) {
2424
auto leds = controller->getLEDs(channelIndex);
25-
for (uint8_t fanIndex = 0; fanIndex < controller->getLEDCount(channelIndex) / 16; fanIndex++) {
25+
auto count = controller->getLEDCount(channelIndex);
26+
for (uint8_t fanIndex = 0; fanIndex < count / 16; fanIndex++) {
2627
for (uint8_t ledIndex = 0; ledIndex < 8; ledIndex++) {
2728
CRGB temp = leds[fanIndex * 16 + ledIndex];
2829
leds[fanIndex * 16 + ledIndex] = leds[fanIndex * 16 + 15 - ledIndex];
@@ -106,3 +107,16 @@ void CLP::gammaCorrection(FastLEDController* controller, uint8_t channelIndex) {
106107
leds[ledIndex].b = dim8_video(leds[ledIndex].b);
107108
}
108109
}
110+
111+
void CLP::fixIcueBrightness(FastLEDController* controller, uint8_t channelIndex) {
112+
auto& channel = controller->getChannel(channelIndex);
113+
if (channel.mode == ChannelMode::SoftwarePlayback) {
114+
auto leds = controller->getLEDs(channelIndex);
115+
auto count = controller->getLEDCount(channelIndex);
116+
for (int ledIndex = 0; ledIndex < count; ledIndex++) {
117+
leds[ledIndex].r = leds[ledIndex].r * 2;
118+
leds[ledIndex].g = leds[ledIndex].g * 2;
119+
leds[ledIndex].b = leds[ledIndex].b * 2;
120+
}
121+
}
122+
}

src/FastLEDControllerUtils.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,13 @@ void reverse(FastLEDController* controller, uint8_t channelIndex);
8989
* @param channelIndex the index of the channel
9090
*/
9191
void gammaCorrection(FastLEDController* controller, uint8_t channelIndex);
92+
93+
/**
94+
* Increase the brightness of a LED channel when using iCUE Software lighting, because iCUE only send the RGB value in
95+
* the range (0 - 127) which is only 50% of max possible brightness. This function doubles the received RGB value.
96+
*
97+
* @param controller the FastLEDController controlling the LEDs
98+
* @param channelIndex the index of the channel
99+
*/
100+
void fixIcueBrightness(FastLEDController* controller, uint8_t channelIndex);
92101
} // namespace CLP

0 commit comments

Comments
 (0)