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 fa20f4319a
commit dfd8656d9f
655 changed files with 9459 additions and 9022 deletions

View File

@@ -389,11 +389,7 @@ void RGBController_CougarKeyboard::SetupZones()
KB_zone.leds_count = 113;
KB_zone.leds_min = KB_zone.leds_count;
KB_zone.leds_max = KB_zone.leds_count;
KB_zone.matrix_map = new matrix_map_type;
KB_zone.matrix_map->height = 6;
KB_zone.matrix_map->width = COUGARKEYBOARDCONTROLLER_MATRIX_WIDTH;
KB_zone.matrix_map->map = (unsigned int *)&matrix_map;
KB_zone.matrix_map.Set(6, COUGARKEYBOARDCONTROLLER_MATRIX_WIDTH, (unsigned int *)&matrix_map);
zones.push_back(KB_zone);
/*-------------------------------------------------*\
@@ -419,19 +415,12 @@ void RGBController_CougarKeyboard::SetupZones()
SetupColors();
}
void RGBController_CougarKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_CougarKeyboard::DeviceUpdateLEDs()
{
controller->SetLedsDirect(colors);
}
void RGBController_CougarKeyboard::UpdateZoneLEDs(int zone)
void RGBController_CougarKeyboard::DeviceUpdateZoneLEDs(int zone)
{
std::vector<RGBColor> colour;
for(size_t i = 0; i < zones[zone].leds_count; i++)
@@ -442,7 +431,7 @@ void RGBController_CougarKeyboard::UpdateZoneLEDs(int zone)
controller->SetLedsDirect(colour);
}
void RGBController_CougarKeyboard::UpdateSingleLED(int led)
void RGBController_CougarKeyboard::DeviceUpdateSingleLED(int led)
{
std::vector<RGBColor> colour;
colour.push_back(colors[led]);

View File

@@ -23,11 +23,10 @@ public:
~RGBController_CougarKeyboard();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateZoneLEDs(int zone);
void DeviceUpdateSingleLED(int led);
void DeviceUpdateMode();
void DeviceSaveMode();

View File

@@ -119,7 +119,6 @@ void RGBController_CougarRevengerST::SetupZones()
new_zone.leds_min = 1;
new_zone.leds_max = 1;
new_zone.leds_count = 1;
new_zone.matrix_map = nullptr;
zones.push_back(new_zone);
new_zone.name = "Mouse wheel";
@@ -138,29 +137,22 @@ void RGBController_CougarRevengerST::SetupZones()
SetupColors();
}
void RGBController_CougarRevengerST::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_CougarRevengerST::DeviceUpdateLEDs()
{
for(unsigned int i = 0; i < colors.size(); i++)
{
UpdateZoneLEDs(i);
DeviceUpdateZoneLEDs(i);
}
}
void RGBController_CougarRevengerST::UpdateZoneLEDs(int zone)
void RGBController_CougarRevengerST::DeviceUpdateZoneLEDs(int zone)
{
controller->SetDirect(zone, colors[zone], modes[active_mode].brightness);
}
void RGBController_CougarRevengerST::UpdateSingleLED(int led)
void RGBController_CougarRevengerST::DeviceUpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
DeviceUpdateZoneLEDs(led);
}
void RGBController_CougarRevengerST::DeviceUpdateMode()

View File

@@ -21,11 +21,10 @@ public:
~RGBController_CougarRevengerST();
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateZoneLEDs(int zone);
void DeviceUpdateSingleLED(int led);
void DeviceUpdateMode();