Fix crash related to JGINYUE controller and clean up zone initializations

This commit is contained in:
Adam Honse 2024-03-21 00:26:42 -05:00
parent 525fff5d0f
commit 6378f65ed1
2 changed files with 9 additions and 23 deletions

View file

@ -102,7 +102,7 @@ void JGINYUEInternalUSBController::Init_device(AreaConfiguration* ptr_device_cfg
ptr_device_cfg[index_config].Color_R = 0xFF;
ptr_device_cfg[index_config].RG_Swap = JGINYUE_RG_DEFAULT;
ptr_device_cfg[index_config].Speed = JGINYUE_USB_SPEED_DEFAULT;
ptr_device_cfg[index_config].LED_numbers = JGINYUE_ADDRESSABLE_MAX_LEDS;
ptr_device_cfg[index_config].LED_numbers = 0;
ptr_device_cfg[index_config].Mode_active = JGINYUE_USB_MODE_STATIC;
}
}

View file

@ -195,13 +195,13 @@ void RGBController_JGINYUEInternalUSB::SetupZones()
/*-------------------------------------------------*\
| Set zones and leds |
\*-------------------------------------------------*/
zones[0].name = "ARGB_Header_1";
zones[0].name = "ARGB Header 1";
zones[0].type = ZONE_TYPE_LINEAR;
zones[0].leds_min = 0;
zones[0].leds_max = 100;
zones[0].matrix_map = NULL;
zones[1].name = "ARGB_Header_2";
zones[1].name = "ARGB Header 2";
zones[1].type = ZONE_TYPE_LINEAR;
zones[1].leds_min = 0;
zones[1].leds_max = 100;
@ -213,29 +213,15 @@ void RGBController_JGINYUEInternalUSB::SetupZones()
zones[1].leds_count = 0;
}
for(unsigned int led_idx = 0 , j=1; led_idx < zones[0].leds_count + zones[1].leds_count ; led_idx++)
for(unsigned int zone_idx = 0; zone_idx < JGINYUE_MAX_ZONES; zone_idx++)
{
if(led_idx==zones[0].leds_count)
for(unsigned int led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
{
j = 1;
led new_led;
new_led.name = "ARGB Header " + std::to_string(zone_idx + 1) + " LED " + std::to_string(led_idx + 1);
new_led.value = 0;
leds.push_back(new_led);
}
if(led_idx<zones[0].leds_count)
{
led ARGB_1_HEADER;
ARGB_1_HEADER.name = "ARGB Header 1 LED " + std::to_string(j);
ARGB_1_HEADER.value = 0;
leds.push_back(ARGB_1_HEADER);
}
else
{
led ARGB_2_HEADER;
ARGB_2_HEADER.name = "ARGB Header 2 LED " + std::to_string(j);
ARGB_2_HEADER.value = 1;
leds.push_back(ARGB_2_HEADER);
}
j++;
}
SetupColors();