Legion2 / CorsairLightingProtocol

Control LEDs connected to an Arduino with iCUE, create an unofficial Corsair iCUE compatible Arduino LED controller.
Apache License 2.0
499 stars 64 forks source link

LS100 brightness and other Problems #374

Closed skatehouse closed 1 month ago

skatehouse commented 2 months ago

Hello! I use the Arduino Micro with LS100. Admittedly, I had original LS100s before, but they were too dark for me. I have the 2812b and cut it to 2x27 + 2x15. What doesn't explain to me is the following:

If I put 84 LEDs on the channel, since there are 84 LEDs, the LEDs remain dark and don't light up at all. With 135 LEDs it's fine. What I then notice, however, is that the colors are slightly offset when I play an Ambilight test video.

2nd problem is with the brightness. Since the brightness is limited to 50%, I tried to increase it to 100%. Here too, all LEDs remain dark.

This is the original one:

`

#include <CorsairLightingProtocol.h>
#include <FastLED.h>
// Hint: The channels of the LS100 are swapped in iCUE, so the first channel in iCUE is here channel 2
#define DATA_PIN_CHANNEL_1 2
#define DATA_PIN_CHANNEL_2 3
#define BUTTON_PIN 4
// Hint: The ATmega32U4 does not have enough memory for 135 leds on both channels
CRGB ledsChannel1[135];
CRGB ledsChannel2[54];
CorsairLightingFirmwareStorageEEPROM firmwareStorage;
CorsairLightingFirmware firmware(CORSAIR_SMART_LIGHTING_CONTROLLER, &firmwareStorage);
FastLEDControllerStorageEEPROM storage;
FastLEDController ledController(&storage);
CorsairLightingProtocolController cLP(&ledController, &firmware);
CorsairLightingProtocolHID cHID(&cLP);
void setup() {
    FastLED.addLeds<WS2812B, DATA_PIN_CHANNEL_1, GRB>(ledsChannel1, 135);
    FastLED.addLeds<WS2812B, DATA_PIN_CHANNEL_2, GRB>(ledsChannel2, 54);
    ledController.addLEDs(0, ledsChannel1, 135);
    ledController.addLEDs(1, ledsChannel2, 54);
    pinMode(BUTTON_PIN, INPUT_PULLUP);
}
void loop() {
    static bool lightingEnabled = true;
    cHID.update();
    if (buttonClicked()) {
        lightingEnabled = !lightingEnabled;
        fill_solid(ledsChannel1, 135, CRGB::Black);
        fill_solid(ledsChannel2, 54, CRGB::Black);
        FastLED.show();
    }
    if (lightingEnabled && ledController.updateLEDs()) {
        FastLED.show();
    }
}
/**
 * Handle button of the LS100. The button is optional.
 *
 * @return true if the button was pressed and then released.
 */
bool buttonClicked() {
    static bool previousState = 1;
    bool state = digitalRead(BUTTON_PIN);
    if (previousState == 0 && state == 1) {
        previousState = state;
        return true;
    }
    previousState = state;
    return false;
}

Here the adpted one:


/*
   Copyright 2019 Leon Kiefer

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/
#include <CorsairLightingProtocol.h>
#include <FastLED.h>

// Hint: The channels of the LS100 are swapped in iCUE, so the first channel in iCUE is here channel 2
#define DATA_PIN_CHANNEL_1 2
#define DATA_PIN_CHANNEL_2 3

#define BUTTON_PIN 4

// Hint: The ATmega32U4 does not have enough memory for 135 leds on both channels
CRGB ledsChannel1[84];
CRGB ledsChannel2[54];

CorsairLightingFirmwareStorageEEPROM firmwareStorage;
CorsairLightingFirmware firmware(CORSAIR_SMART_LIGHTING_CONTROLLER, &firmwareStorage);
FastLEDControllerStorageEEPROM storage;
FastLEDController ledController(&storage);
CorsairLightingProtocolController cLP(&ledController, &firmware);
CorsairLightingProtocolHID cHID(&cLP);

void setup() {
    FastLED.addLeds<WS2812B, DATA_PIN_CHANNEL_1, GRB>(ledsChannel1, 84);
    FastLED.addLeds<WS2812B, DATA_PIN_CHANNEL_2, GRB>(ledsChannel2, 54);
    ledController.addLEDs(0, ledsChannel1, 84);
    ledController.addLEDs(1, ledsChannel2, 54);

    // modify the RGB values before they are shown on the LED strip
    ledController.onUpdateHook(0, []() {
        // increase the brightness of channel 1 when using iCUE, because iCUE only set brightness to max 50%
        CLP::fixIcueBrightness(&ledController, 0);
    pinMode(BUTTON_PIN, INPUT_PULLUP);

    });
}

void loop() {
    static bool lightingEnabled = true;
    cHID.update();

    if (buttonClicked()) {
        lightingEnabled = !lightingEnabled;
        fill_solid(ledsChannel1, 84, CRGB::Black);
        fill_solid(ledsChannel2, 54, CRGB::Black);
        FastLED.show();
    }

    if (lightingEnabled && ledController.updateLEDs()) {
        FastLED.show();
    }
}

/**
 * Handle button of the LS100. The button is optional.
 *
 * @return true if the button was pressed and then released.
 */
bool buttonClicked() {
    static bool previousState = 1;
    bool state = digitalRead(BUTTON_PIN);
    if (previousState == 0 && state == 1) {
        previousState = state;
        return true;
    }
    previousState = state;
    return false;
}
Legion2 commented 1 month ago

Maybe you have issues with your power supply. If you try to light up too many LEDs they turn off because there is not enough power available

github-actions[bot] commented 1 month ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.