@@ -76,11 +76,19 @@ void PolychromeUSBController::SetDeviceInfo()
7676 {
7777 if (configtable[zonecnt] == 0x1E )
7878 {
79- break ;
79+ /* -----------------------------------------------------------------------*\
80+ | If we don't have this device type (0x1E) we will skip it and continue. |
81+ \*-----------------------------------------------------------------------*/
82+ continue ;
8083 }
8184
8285 newdev_info.num_leds = configtable[zonecnt];
8386
87+ /* --------------------------------------------------------------------------------------------------*\
88+ | We will need to know what zone type this is, so that we can look up the name and make calls later. |
89+ \*--------------------------------------------------------------------------------------------------*/
90+ newdev_info.zone_type = zonecnt;
91+
8492 switch (zonecnt)
8593 {
8694 /* -----------------------------------------*\
@@ -124,6 +132,12 @@ void PolychromeUSBController::WriteZone
124132 bool allzone = false
125133 )
126134{
135+
136+ /* ----------------------------------------------------*\
137+ | Get the device info so we can look up the zone type. |
138+ \*----------------------------------------------------*/
139+ PolychromeDeviceInfo device_info = GetPolychromeDevices ()[zone];
140+
127141 unsigned char usb_buf[65 ];
128142
129143 /* -----------------------------------------------------*\
@@ -135,7 +149,7 @@ void PolychromeUSBController::WriteZone
135149 | Set up message packet with leading 00 |
136150 \*-----------------------------------------------------*/
137151 usb_buf[0x01 ] = POLYCHROME_USB_SET_ZONE;
138- usb_buf[0x03 ] = zone;
152+ usb_buf[0x03 ] = device_info. zone_type ;
139153 usb_buf[0x04 ] = mode;
140154 usb_buf[0x05 ] = RGBGetRValue (rgb);
141155 usb_buf[0x06 ] = RGBGetGValue (rgb);
@@ -211,9 +225,13 @@ void PolychromeUSBController::WriteHeader
211225
212226PolychromeZoneInfo PolychromeUSBController::GetZoneConfig (unsigned char zone)
213227{
228+ /* -----------------------------------------------------*\
229+ | Get the device info so we can look up the zone type |
230+ \*-----------------------------------------------------*/
231+ PolychromeDeviceInfo device_info = GetPolychromeDevices ()[zone];
232+
214233 unsigned char usb_buf[65 ];
215234 PolychromeZoneInfo zoneinfo;
216- // unsigned char all;
217235 unsigned char r;
218236 unsigned char g;
219237 unsigned char b;
@@ -227,7 +245,7 @@ PolychromeZoneInfo PolychromeUSBController::GetZoneConfig(unsigned char zone)
227245 | Set up config table request packet |
228246 \*-----------------------------------------------------*/
229247 usb_buf[0x01 ] = POLYCHROME_USB_READ_ZONE_CONFIG;
230- usb_buf[0x03 ] = zone ;
248+ usb_buf[0x03 ] = device_info. zone_type ;
231249
232250 /* -----------------------------------------------------*\
233251 | Send packet |
@@ -248,7 +266,6 @@ PolychromeZoneInfo PolychromeUSBController::GetZoneConfig(unsigned char zone)
248266 zoneinfo.color = ToRGBColor (r,g,b);
249267 zoneinfo.speed = usb_buf[0x08 ];
250268 zoneinfo.zone = usb_buf[0x03 ];
251- // all = usb_buf[0x10];
252269
253270 return (zoneinfo);
254271}
0 commit comments