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

Is it possible to combine multifan with scale/repeat on a strip? #372

Closed Artasdmc closed 2 months ago

Artasdmc commented 2 months ago

I've used this code, and the strip doesn't light up the all way. I have enough current, ran them all with fastled.

include

include

define NUMBER_OF_LEDS_PER_FAN 8

define DATA_PIN_FAN_1 6

define DATA_PIN_FAN_2 7

define DATA_PIN_FAN_3 8

define DATA_PIN_FAN_4 9

define DATA_PIN_FAN_5 10

define DATA_PIN_FAN_6 5

define DATA_PIN_CHANNEL_2 3

CRGB ledsChannel1[48]; CRGB ledsChannel2[89];

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

void setup() { // 6 fans on channel 1 // FAN_PIN CRGB array offset number of leds per fan FastLED.addLeds<WS2812B, DATA_PIN_FAN_1, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN 0, NUMBER_OF_LEDS_PER_FAN); FastLED.addLeds<WS2812B, DATA_PIN_FAN_2, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN 1, NUMBER_OF_LEDS_PER_FAN); FastLED.addLeds<WS2812B, DATA_PIN_FAN_3, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN 2, NUMBER_OF_LEDS_PER_FAN); FastLED.addLeds<WS2812B, DATA_PIN_FAN_4, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN 3, NUMBER_OF_LEDS_PER_FAN); FastLED.addLeds<WS2812B, DATA_PIN_FAN_5, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN 4, NUMBER_OF_LEDS_PER_FAN); FastLED.addLeds<WS2812B, DATA_PIN_FAN_6, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN 5, NUMBER_OF_LEDS_PER_FAN);

// normal strip on channel 2 FastLED.addLeds<WS2812B, DATA_PIN_CHANNEL_2, GRB>(ledsChannel2, 96); ledController.addLEDs(0, ledsChannel1, 48); ledController.addLEDs(1, ledsChannel2, 89); ledController.onUpdateHook(2, []() { CLP::scale(&ledController, 2, 178); }); }

void loop() { cHID.update();

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

Legion2 commented 2 months ago

The ledsChannel2 array must be 178 in size, also FastLED.addLeds must use the size of the led strip

Artasdmc commented 2 months ago

The ledsChannel2 array must be 178 in size, also FastLED.addLeds must use the size of the led strip

Still the same result, gets halfway to the strip by using 'external rgb light strips', even shorter if I select 6 'rgb led strips'. Updated code:

include

include

define NUMBER_OF_LEDS_PER_FAN 8

define DATA_PIN_FAN_1 6

define DATA_PIN_FAN_2 7

define DATA_PIN_FAN_3 8

define DATA_PIN_FAN_4 9

define DATA_PIN_FAN_5 10

define DATA_PIN_FAN_6 5

define DATA_PIN_CHANNEL_2 3

CRGB ledsChannel1[48]; CRGB ledsChannel2[178];

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

void setup() { // 6 fans on channel 1 // FAN_PIN CRGB array offset number of leds per fan FastLED.addLeds<WS2812B, DATA_PIN_FAN_1, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN 0, NUMBER_OF_LEDS_PER_FAN); FastLED.addLeds<WS2812B, DATA_PIN_FAN_2, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN 1, NUMBER_OF_LEDS_PER_FAN); FastLED.addLeds<WS2812B, DATA_PIN_FAN_3, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN 2, NUMBER_OF_LEDS_PER_FAN); FastLED.addLeds<WS2812B, DATA_PIN_FAN_4, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN 3, NUMBER_OF_LEDS_PER_FAN); FastLED.addLeds<WS2812B, DATA_PIN_FAN_5, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN 4, NUMBER_OF_LEDS_PER_FAN); FastLED.addLeds<WS2812B, DATA_PIN_FAN_6, GRB>(ledsChannel1, NUMBER_OF_LEDS_PER_FAN 5, NUMBER_OF_LEDS_PER_FAN);

// normal strip on channel 2 FastLED.addLeds<WS2812B, DATA_PIN_CHANNEL_2, GRB>(ledsChannel2, 178); ledController.addLEDs(0, ledsChannel1, 48); ledController.addLEDs(1, ledsChannel2, 89); ledController.onUpdateHook(2, []() { CLP::scale(&ledController, 2, 178); });

}

void loop() { cHID.update();

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

Artasdmc commented 2 months ago

By changing ledController.addLEDs(1, ledsChannel2, 89); to 178 it does not control anymore. Device doesn't get recognized anymore and I have to clear it with jumper.

Just using the repeat and scale example it works correctly.

Legion2 commented 2 months ago

indexes in programming are 0 based, so this is wrong

ledController.onUpdateHook(2, {
CLP::scale(&ledController, 2, 178);
});

there is not channel at index 2, it should be 1