Optional Export Flags
DeviceMessage()
This export flag is used to show a message in SignalRGB on the associated device's page. You can use this to display any quirks, or description needed to the user.
The return value is a 1D array of 2 strings. The text to display in the popup, followed by the hover tooltip.
export function DeviceMessage() { return ["This device has a weird quirk!", "The quirk is this!"]; }
SupportsSubdevices()
This export flag is used for lighting controllers that only support Subdevices and have no onboard LED's to control. When returning true this export will prevent the parent device from appearing over the canvas in layouts, and disable editing its positional settings.
export function SupportsSubdevices(){ return true; }
on*Changed()
This export function isn't used by the backend, but instead is used as a callback inside the plugin to notify when a setting is changed. Below you'll see an example of it being used to set the DPI of a mouse every time a user changes the slider instead of polling the values in your render loop and handling the change there.
These callbacks are called after RGB data is grabbed from the canvas, but before the render function is called for the current render frame.
The function also must be exported for SignalRGB to call it.
// Setting Export
export function ControllableParameters(){
return [
{ property: "dpi1", label: "DPI", step: "50", type: "number", min: "200", max: "18000", default: "800" },
];
}
// DPI Functions
export function ondpi1Changed() {
setDpi(dpi1);
}
function setDpi(dpi) {
if (!SettingControl) {
return;
}
device.log(`Setting Dpi to ${dpi}`);
Corsair_Set(CORSAIR_DPI_X, dpi);
Corsair_Set(CORSAIR_DPI_Y, dpi);
device.log(`DPI x is now ${Corsair_Get(CORSAIR_DPI_X)}`);
device.log(`DPI y is now ${Corsair_Get(CORSAIR_DPI_Y)}`);
}