mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-04-04 06:11:07 -04:00
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:
@@ -89,27 +89,15 @@ void RGBController_HYTEKeyboard::SetupZones()
|
||||
|
||||
zone keyboard_zone;
|
||||
|
||||
keyboard_zone.name = "Keyboard";
|
||||
keyboard_zone.type = ZONE_TYPE_MATRIX;
|
||||
|
||||
matrix_map_type * keyboard_map = new matrix_map_type;
|
||||
keyboard_zone.matrix_map = keyboard_map;
|
||||
keyboard_zone.matrix_map->height = new_kb.GetRowCount();
|
||||
keyboard_zone.matrix_map->width = new_kb.GetColumnCount();
|
||||
|
||||
keyboard_zone.matrix_map->map = new unsigned int[keyboard_map->height * keyboard_map->width];
|
||||
keyboard_zone.leds_count = new_kb.GetKeyCount();
|
||||
keyboard_zone.leds_min = keyboard_zone.leds_count;
|
||||
keyboard_zone.leds_max = keyboard_zone.leds_count;
|
||||
keyboard_zone.name = "Keyboard";
|
||||
keyboard_zone.type = ZONE_TYPE_MATRIX;
|
||||
keyboard_zone.leds_count = new_kb.GetKeyCount();
|
||||
keyboard_zone.leds_min = keyboard_zone.leds_count;
|
||||
keyboard_zone.leds_max = keyboard_zone.leds_count;
|
||||
keyboard_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT);
|
||||
|
||||
zones.push_back(keyboard_zone);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Matrix map still uses declared zone rows and columns |
|
||||
| as the packet structure depends on the matrix map |
|
||||
\*---------------------------------------------------------*/
|
||||
new_kb.GetKeyMap(keyboard_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT, keyboard_map->height, keyboard_map->width);
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Create LEDs for the Matrix zone |
|
||||
| Place keys in the layout to populate the matrix |
|
||||
@@ -131,7 +119,6 @@ void RGBController_HYTEKeyboard::SetupZones()
|
||||
surround_zone.leds_min = 63;
|
||||
surround_zone.leds_max = 63;
|
||||
surround_zone.leds_count = 63;
|
||||
surround_zone.matrix_map = NULL;
|
||||
|
||||
zones.push_back(surround_zone);
|
||||
|
||||
@@ -148,22 +135,15 @@ void RGBController_HYTEKeyboard::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_HYTEKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_HYTEKeyboard::DeviceUpdateLEDs()
|
||||
{
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
UpdateZoneLEDs(zone_idx);
|
||||
DeviceUpdateZoneLEDs(zone_idx);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HYTEKeyboard::UpdateZoneLEDs(int zone)
|
||||
void RGBController_HYTEKeyboard::DeviceUpdateZoneLEDs(int zone)
|
||||
{
|
||||
if(zone == HYTE_KEYBOARD_ZONE_KEYBOARD)
|
||||
{
|
||||
@@ -182,15 +162,15 @@ void RGBController_HYTEKeyboard::UpdateZoneLEDs(int zone)
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HYTEKeyboard::UpdateSingleLED(int led)
|
||||
void RGBController_HYTEKeyboard::DeviceUpdateSingleLED(int led)
|
||||
{
|
||||
if(led < (int)zones[0].leds_count)
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
DeviceUpdateZoneLEDs(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateZoneLEDs(1);
|
||||
DeviceUpdateZoneLEDs(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,11 +21,10 @@ public:
|
||||
~RGBController_HYTEKeyboard();
|
||||
|
||||
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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user