RGBController API Overhaul

* Reorganize and clean up RGBController API functions
    * Add functions to get protected RGBController member values
    * Make NetworkClient, ProfileManager, and ResourceManager friend classes so they can access protected members
    * Protected previously-public RGBController members
        * Information strings (name, vendor, description, version, serial location)
        * Device type
        * Active mode
        * Flags
        * LEDs vector
        * LED alternate names vector
        * Modes vector
        * Colors vector
        * Zones vector
    * Add CONTROLLER_FLAG_HIDDEN to allow plugins to hide controllers from control GUI
    * Add update reason codes to RGBController update callback and signal updates on more RGBController events
    * Add loop zone types and segmented zone type
    * Add matrix map field to segments
    * Rework matrix_map_type from using pointers to vector to prevent memory leaks
    * Rework KeyboardLayoutManager to return new matrix_map_type
    * Add access mutex to RGBController API
    * Add per-zone modes ot RGBController API
    * Add JSON description functions to RGBController API
This commit is contained in:
Adam Honse
2025-09-23 20:38:37 -05:00
parent 6deaf2f4fd
commit fdaf2eee6c
657 changed files with 9060 additions and 8801 deletions

View File

@@ -33,17 +33,6 @@ static RGBColor DeflectColor(bool deflection, RGBColor color)
RGBController_LightSalt::~RGBController_LightSalt()
{
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
for(unsigned int zone_index = 0; zone_index < zones.size(); zone_index++)
{
if(zones[zone_index].matrix_map != nullptr)
{
delete zones[zone_index].matrix_map;
}
}
delete controller;
}
@@ -347,10 +336,7 @@ void RGBController_LightSalt::SetupZones()
zone.leds_min = table.led.count;
zone.leds_max = table.led.count;
zone.leds_count = table.led.count;
zone.matrix_map = new matrix_map_type;
zone.matrix_map->height = table.map.height;
zone.matrix_map->width = table.map.width;
zone.matrix_map->map = table.map.matrix;
zone.matrix_map.Set(table.map.height, table.map.width, table.map.matrix);
zones.push_back(zone);
}
@@ -368,7 +354,6 @@ void RGBController_LightSalt::SetupZones()
zone.leds_min = 1;
zone.leds_max = 1;
zone.leds_count = 1;
zone.matrix_map = NULL;
zones.push_back(zone);
}
@@ -383,13 +368,6 @@ void RGBController_LightSalt::SetupZones()
colors[colors.size() - 1] = ToRGBColor(0xFF, 0xFF, 0xFF);
}
void RGBController_LightSalt::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_LightSalt::DeviceUpdateColors(bool save)
{
int sets = table.led.sets;
@@ -427,12 +405,12 @@ void RGBController_LightSalt::DeviceUpdateLEDs()
DeviceUpdateColors(false);
}
void RGBController_LightSalt::UpdateZoneLEDs(int /*zone*/)
void RGBController_LightSalt::DeviceUpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_LightSalt::UpdateSingleLED(int /*led*/)
void RGBController_LightSalt::DeviceUpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}

View File

@@ -23,12 +23,11 @@ public:
void SetupModes();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateColors(bool save);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateZoneLEDs(int zone);
void DeviceUpdateSingleLED(int led);
void DeviceUpdateMode();
void DeviceSaveMode();