Fix warnings and code cleanup in RGBController_JGINYUEInternalUSBV2.cpp

This commit is contained in:
Adam Honse 2024-11-25 18:42:08 -06:00
parent 01d9655781
commit 540f785e90

View file

@ -328,10 +328,7 @@ RGBController_JGINYUEInternalUSBV2::RGBController_JGINYUEInternalUSBV2(JGINYUEIn
Hourglass.colors.resize(8);
//modes.push_back(Hourglass);
InitZones();
}
void RGBController_JGINYUEInternalUSBV2::SetupZones()
@ -346,9 +343,9 @@ void RGBController_JGINYUEInternalUSBV2::SetupZones()
| Set zones and leds |
\*-------------------------------------------------*/
unsigned char normal_zone_count = controller->GetZoneCount();
if((controller->support_Global_zone == true)&&(normal_zone_count>1))
if((controller->support_Global_zone == true) && (normal_zone_count > 1))
{
normal_zone_count --;
normal_zone_count--;
//TODO support_Global_zone
}
@ -378,20 +375,21 @@ void RGBController_JGINYUEInternalUSBV2::ResizeZone(int zone, int new_size)
if(modes[active_mode].value == JGINYUE_USB_V2_MODE_DIRECT)
{
controller->DirectLEDControl(zones[zone].colors,new_size,area);
controller->DirectLEDControl(zones[zone].colors, new_size, area);
}
else
{
controller->WriteZoneMode(area,modes[active_mode].value,new_size,modes[active_mode].colors,modes[active_mode].speed,modes[active_mode].brightness,modes[active_mode].direction);
controller->WriteZoneMode(area,modes[active_mode].value, new_size,modes[active_mode].colors, modes[active_mode].speed, modes[active_mode].brightness, modes[active_mode].direction);
}
}
void RGBController_JGINYUEInternalUSBV2::DeviceUpdateLEDs()
{
unsigned char normal_zone_count = controller->GetZoneCount();
if((controller->support_Global_zone == true)&&(normal_zone_count>1))
if((controller->support_Global_zone == true) && (normal_zone_count > 1))
{
normal_zone_count --;
normal_zone_count--;
//TODO support_Global_zone
}
@ -405,20 +403,20 @@ void RGBController_JGINYUEInternalUSBV2::UpdateZoneLEDs(int zone)
{
unsigned char area;
area = controller->device_config[zone].Area_ID;
controller->DirectLEDControl(zones[zone].colors,zones[zone].leds_count,area);
controller->DirectLEDControl(zones[zone].colors, zones[zone].leds_count, area);
}
void RGBController_JGINYUEInternalUSBV2::UpdateSingleLED(int led)
{
int zone;
zone = leds[led].value;
UpdateZoneLEDs(zone);
}
void RGBController_JGINYUEInternalUSBV2::DeviceUpdateMode()
{
unsigned char area;
if(modes[active_mode].value == JGINYUE_USB_V2_MODE_DIRECT)
{
DeviceUpdateLEDs();
@ -428,7 +426,7 @@ void RGBController_JGINYUEInternalUSBV2::DeviceUpdateMode()
unsigned char Area_num = 0;
if(controller->support_Global_zone == true)
{
Area_num = controller->GetZoneCount()-1;
Area_num = controller->GetZoneCount() - 1;
}
else
{
@ -459,20 +457,23 @@ void RGBController_JGINYUEInternalUSBV2::InitZones()
zones.clear();
zones.resize(normal_zone_count);
if((controller->support_Global_zone == true)&&(normal_zone_count>1))
if((controller->support_Global_zone == true) && (normal_zone_count > 1))
{
normal_zone_count --;
normal_zone_count--;
//TODO support_Global_zone
}
for(size_t i = 0; i < normal_zone_count; i++)
{
zone * zone_to_init = &(zones[i]);
AreaConfigurationV2 * cfg = &(controller->device_config[i]);
zone_to_init->leds_min = 0;
zone_to_init->leds_max = cfg->Max_LED_numbers;
zone_to_init->leds_count = 0;
zone_to_init->type = ZONE_TYPE_LINEAR;
zone_to_init->matrix_map = NULL;
switch(cfg->Area_ID)
{
case JGINYUE_USB_V2_ARGB_STRIP_1: