@@ -68,62 +68,66 @@ void RGBController_DRGB::SetupZones()
68
68
switch (controller->GetDevicePID ())
69
69
{
70
70
case DRGB_LED_V4_PID:
71
- NUM_CHANNELS = 8 ;
72
- NUM_Channel_led = 256 ;
71
+ NUM_CHANNELS = 8 ;
72
+ NUM_Channel_led = 256 ;
73
+ Version = 4 ;
73
74
break ;
74
75
case DRGB_ULTRA_V4F_PID:
75
- NUM_CHANNELS = 16 ;
76
- NUM_Channel_led = 256 ;
76
+ NUM_CHANNELS = 16 ;
77
+ NUM_Channel_led = 256 ;
78
+ Version = 4 ;
77
79
break ;
78
80
case DRGB_CORE_V4F_PID:
79
- NUM_CHANNELS = 32 ;
80
- NUM_Channel_led = 256 ;
81
+ NUM_CHANNELS = 32 ;
82
+ NUM_Channel_led = 256 ;
83
+ Version = 4 ;
81
84
break ;
82
85
case DRGB_SIG_V4F_PID:
83
- NUM_CHANNELS = 36 ;
84
- NUM_Channel_led = 256 ;
86
+ NUM_CHANNELS = 36 ;
87
+ NUM_Channel_led = 256 ;
88
+ Version = 4 ;
85
89
break ;
86
90
87
91
case DRGB_LED_V3_PID:
88
- NUM_CHANNELS = 8 ;
89
- NUM_Channel_led = 256 ;
90
- Version = 3 ;
92
+ NUM_CHANNELS = 8 ;
93
+ NUM_Channel_led = 256 ;
94
+ Version = 3 ;
91
95
break ;
92
96
case DRGB_Ultra_V3_PID:
93
- NUM_CHANNELS = 16 ;
94
- NUM_Channel_led = 256 ;
95
- Version = 3 ;
97
+ NUM_CHANNELS = 16 ;
98
+ NUM_Channel_led = 256 ;
99
+ Version = 3 ;
96
100
break ;
97
101
case DRGB_CORE_V3_PID:
98
- NUM_CHANNELS = 30 ;
99
- NUM_Channel_led = 256 ;
100
- Version = 3 ;
102
+ NUM_CHANNELS = 30 ;
103
+ NUM_Channel_led = 256 ;
104
+ Version = 3 ;
101
105
break ;
102
106
103
107
case DRGB_LED_PID:
104
- NUM_CHANNELS = 8 ;
105
- NUM_Channel_led = 256 ;
106
- Version = 2 ;
108
+ NUM_CHANNELS = 8 ;
109
+ NUM_Channel_led = 256 ;
110
+ Version = 2 ;
107
111
break ;
108
112
case DRGB_ULTRA_PID:
109
- NUM_CHANNELS = 16 ;
110
- NUM_Channel_led = 256 ;
111
- Version = 2 ;
113
+ NUM_CHANNELS = 16 ;
114
+ NUM_Channel_led = 256 ;
115
+ Version = 2 ;
112
116
break ;
113
117
case DRGB_SIG_AB_PID:
114
- NUM_CHANNELS = 16 ;
115
- NUM_Channel_led = 256 ;
116
- Version = 2 ;
118
+ NUM_CHANNELS = 16 ;
119
+ NUM_Channel_led = 256 ;
120
+ Version = 2 ;
117
121
break ;
118
122
case DRGB_SIG_CD_PID:
119
- NUM_CHANNELS = 6 ;
120
- NUM_Channel_led = 256 ;
121
- Version = 2 ;
123
+ NUM_CHANNELS = 6 ;
124
+ NUM_Channel_led = 256 ;
125
+ Version = 2 ;
122
126
break ;
123
127
case DRGB_Strimer_PID:
124
- NUM_CHANNELS = 6 ;
125
- NUM_Channel_led = 256 ;
126
- Version = 2 ;
128
+ NUM_CHANNELS = 6 ;
129
+ NUM_Channel_led = 256 ;
130
+ Version = 2 ;
127
131
break ;
128
132
}
129
133
@@ -271,15 +275,16 @@ void RGBController_DRGB::DeviceUpdateLEDs()
271
275
switch (Version)
272
276
{
273
277
case 4 :
274
- unsigned int led_index = 0 ;
275
- unsigned char RGBData [8192 *3 + 72 ] = {0 };
278
+ {
279
+ unsigned int led_index = 0 ;
280
+ unsigned char RGBData[8192 *3 + 72 ] = {0 };
276
281
for (std::size_t zone_idx = 0 ; zone_idx < zones.size (); zone_idx++)
277
282
{
278
283
unsigned char LEDnum = zones[zone_idx].leds_count ;
279
- unsigned int QLedCount = (LEDnum & 0xFFFF )>>8 ;
280
- unsigned int PLedCount = LEDnum & 0xFF ;
281
- RGBData[zone_idx * 2 ] = QLedCount ;
282
- RGBData[zone_idx * 2 + 1 ] = PLedCount ;
284
+ unsigned int HighCount = (LEDnum & 0xFFFF )>>8 ;
285
+ unsigned int LowCount = LEDnum & 0xFF ;
286
+ RGBData[zone_idx * 2 ] = HighCount ;
287
+ RGBData[zone_idx * 2 + 1 ] = LowCount ;
283
288
for (unsigned int i=0 ; i<LEDnum;i++)
284
289
{
285
290
unsigned int RGBcolors = zones[zone_idx].colors [i];
@@ -293,16 +298,18 @@ void RGBController_DRGB::DeviceUpdateLEDs()
293
298
break ;
294
299
}
295
300
}
296
- unsigned int col_packets = 1 ;
301
+ unsigned int col_packets = 1 ;
297
302
if (led_index > 316 )
298
303
{
299
304
col_packets = ((led_index - 316 ) / 340 ) + (((led_index - 316 ) % 340 ) > 0 );
300
305
}
301
306
controller->SendPacket (&RGBData[0 ], col_packets,led_index);
302
307
break ;
308
+ }
303
309
304
310
case 3 :
305
- unsigned int led_index = 0 ;
311
+ {
312
+ unsigned int led_index = 0 ;
306
313
unsigned char RGBData[1801 *3 ] = {0 };
307
314
unsigned char ArrayData[64 ] = {0 };
308
315
ArrayData[0 ] = 0x60 ;
@@ -331,11 +338,12 @@ void RGBController_DRGB::DeviceUpdateLEDs()
331
338
controller->SendPacketFS (&ArrayData[0 ], 1 ,0 );
332
339
controller->SendPacketFS (&RGBData[0 ], col_packets,1 );
333
340
break ;
341
+ }
334
342
335
343
case 2 :
336
344
for (std::size_t zone_idx = 0 ; zone_idx < zones.size (); zone_idx++)
337
345
{
338
- unsigned char RGBData [256 *3 ] = {0 };
346
+ unsigned char RGBData[256 *3 ] = {0 };
339
347
unsigned char ArrayData[64 ] = {0 };
340
348
unsigned char LEDnum = zones[zone_idx].leds_count ;
341
349
for (unsigned int i=0 ; i<LEDnum;i++)
@@ -345,7 +353,7 @@ void RGBController_DRGB::DeviceUpdateLEDs()
345
353
RGBData[i * 3 +1 ] = (RGBcolors >> 8 ) & 0xFF ;
346
354
RGBData[i * 3 +2 ] = (RGBcolors >> 16 ) & 0xFF ;
347
355
}
348
- unsigned char NumPackets = LEDnum / 20 + (LEDnum % 20 ) > 0 ;
356
+ unsigned char NumPackets = ( LEDnum / 20 ) + (( LEDnum % 20 ) > 0 ) ;
349
357
for (unsigned int CurrPacket = 1 ; CurrPacket <= NumPackets; CurrPacket++)
350
358
{
351
359
ArrayData[0 ] = CurrPacket;
0 commit comments