Legion2 / CorsairLightingProtocol

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

Cant add more than 135 leds per channel #311

Closed sudousercom closed 1 year ago

sudousercom commented 1 year ago

Hi! I try to adding more than 135leds in PINs definition, and in CRGB array, and than i use CLP::scale Controller just disconnect after few seconds in software like iCUE or SignalRGB It works perfect with one channel, i can add all my leds per one piece (391 leds with scale works fine) But with two channels it crashes any time when i adding more than 135led per channel (in PINs definitions, CRGB just ignored bigger values and not scales)

the code:

// Arduino IDE Custom Sketch for spoofed Node Pros
// generated at https://srgbmods.net
#include <CorsairLightingProtocol.h>
#include <FastLED.h>

#define DATA_PIN3 3

#define DATA_PIN5 5

#define LEDS_PIN3 170

#define LEDS_PIN5 220

#define OFFSET_PIN3 0

#define OFFSET_PIN5 0

CRGB ledsChannel1[170];
CRGB ledsChannel2[220];

const char mySerialNumber[] PROGMEM = "98014CDC9F167A68809B";

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

void setup()
{
    DeviceID deviceId = { 0x98, 0x01, 0x4C, 0xDC };
    firmware.setDeviceID(deviceId);
    CLP::disableBuildInLEDs();

    FastLED.addLeds<WS2812B, DATA_PIN3, GRB>(ledsChannel1, OFFSET_PIN3, LEDS_PIN3);

    FastLED.addLeds<WS2812B, DATA_PIN5, GRB>(ledsChannel2, OFFSET_PIN5, LEDS_PIN5);

    ledController.addLEDs(0, ledsChannel1, 60);
    ledController.addLEDs(1, ledsChannel2, 60);
        ledController.onUpdateHook(0, []() {
          CLP::scale(&ledController, 0, 170);
        });
        ledController.onUpdateHook(1, []() {
          CLP::scale(&ledController, 1, 220);
        });
}

void loop()
{
    cHID.update();
    if (ledController.updateLEDs())
    {
        FastLED.show();
    }
}
Legion2 commented 1 year ago

This looks like the Arduino is running out on memory. There is not much you can do.when you use a single channel from which size do you scale up?

sudousercom commented 1 year ago

This looks like the Arduino is running out on memory. There is not much you can do.when you use a single channel from which size do you scale up?

60 as i remember

sudousercom commented 1 year ago

so, reduse ledController.addLEDs to 10 on both channels, and set scale to 168 on 1, and to 223 on 2 helps, and now all works as expected, thank you!

sudousercom commented 1 year ago

so, reduse ledController.addLEDs to 10 on both channels, and set scale to 168 on 1, and to 223 on 2 helps, and now all works as expected, thank you!

but works weird, like small count of leds, and filled up more faster, than colors changed

sudousercom commented 1 year ago

max value, for leds per channel for ledController.addLEDs is 44, 45 lead to crashes. slow update cause is low framerate, about 15-17

github-actions[bot] commented 1 year 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.