Legion2 / CorsairLightingProtocol

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

external remote data #336

Closed saeedbs closed 1 year ago

saeedbs commented 1 year ago

I'm trying to control CLP device with data received from other than usb+icue/openrgb for example serial data received from IR remote or phone Bluetooth android app to control or even buttons and override usb data with hardware predefined modes or defined hardware mods but cant't figure out how to do it.

it will be nice to have .ino example showing how to do such thing : -choosing predefined mods/effects based with recieved data

it seems FastLEDController.h/.cpp contains 3mods/11effects I'm looking for but don't know how to call them on a lighting node pro for example.

Legion2 commented 1 year ago

You can only control hardware modes, when the controller is not receiving data over USB, else it will override previous commands. To do this, do not call cHID.update(); in the main loop. Then create your own ILEDController class by inheriting from FastLEDController, in your own led controller class you have access to the base LEDController interface https://github.com/Legion2/CorsairLightingProtocol/blob/c0f4fd1e29a8011a55153514e37cd5633465df35/src/LEDController.h#L192-L288

This allows you to configure the Channels and Groups in the channels. You have to set the channel mode to ChannelMode::HardwarePlayback and then the groups which are configured will be shown on the led strip. If you want to switch back to USB you need to change the channel model and start calling cHID.update(); in the loop again.

saeedbs commented 1 year ago

thanks, not sure if I can do this or not but I will give it try I believe your solution will work but will be nice if you provide a complete example of this for non-dev users like me who are interested in this project but not good enough in coding something like: change hardware effect with buttons