Skip to content

Commit 7556a28

Browse files
Rework LED handling for Polychrome V1
1 parent 7ccb3cd commit 7556a28

1 file changed

Lines changed: 37 additions & 8 deletions

File tree

RGBController/RGBController_Polychrome.cpp

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@
1212
#define ASROCK_MAX_ZONES 4
1313
#define ASROCK_MAX_LEDS 22
1414

15+
static const char* polychrome_v1_zone_names[] =
16+
{
17+
"RGB LED 0 Header",
18+
"RGB LED 1 Header",
19+
"PCH",
20+
"IO Cover",
21+
"Audio",
22+
"Addressable Header"
23+
};
24+
1525
static const char* polychrome_v2_zone_names[] =
1626
{
1727
"RGB LED 0 Header",
@@ -313,7 +323,14 @@ void RGBController_Polychrome::SetupZones()
313323
/*---------------------------------------------------------*\
314324
| Set zone name to channel name |
315325
\*---------------------------------------------------------*/
316-
new_zone->name = polychrome_v2_zone_names[zone_idx];
326+
if(polychrome->GetASRockType() == ASROCK_TYPE_POLYCHROME_V1)
327+
{
328+
new_zone->name = polychrome_v1_zone_names[zone_idx];
329+
}
330+
else
331+
{
332+
new_zone->name = polychrome_v2_zone_names[zone_idx];
333+
}
317334

318335
if(zone_idx == POLYCHROME_ZONE_ADDRESSABLE)
319336
{
@@ -361,13 +378,25 @@ void RGBController_Polychrome::SetupZones()
361378
\*---------------------------------------------------------*/
362379
led* new_led = new led();
363380

364-
new_led->name = polychrome_v2_zone_names[zone_idx];
381+
if(polychrome->GetASRockType() == ASROCK_TYPE_POLYCHROME_V1)
382+
{
383+
new_led->name = polychrome_v1_zone_names[zone_idx];
384+
}
385+
else
386+
{
387+
new_led->name = polychrome_v2_zone_names[zone_idx];
388+
}
389+
365390
new_led->name.append(" " + std::to_string(led_idx + 1));
366391
new_led->value = 0;
367392

368-
if(zone_idx == POLYCHROME_ZONE_ADDRESSABLE)
393+
if(polychrome->GetASRockType() == ASROCK_TYPE_POLYCHROME_V1)
394+
{
395+
new_led->value = zone_idx;
396+
}
397+
else if(zone_idx == POLYCHROME_ZONE_ADDRESSABLE)
369398
{
370-
new_led->value = 1;
399+
new_led->value = 0x19;
371400
}
372401

373402
/*---------------------------------------------------------*\
@@ -418,12 +447,12 @@ void RGBController_Polychrome::UpdateSingleLED(int led)
418447
unsigned char blu = RGBGetBValue(colors[led]);
419448

420449
/*---------------------------------------------------------*\
421-
| If the LED value is 1, it is the addressable LED and the |
422-
| address is 0x19 |
450+
| If the LED value is non-zero, this LED overrides the LED |
451+
| index |
423452
\*---------------------------------------------------------*/
424-
if(leds[led].value == 1)
453+
if(leds[led].value != 0)
425454
{
426-
led = 0x19;
455+
led = leds[led].value;
427456
}
428457

429458
polychrome->SetColorsAndSpeed(led, red, grn, blu);

0 commit comments

Comments
 (0)