Skip to content

Commit 2609822

Browse files
Fix flickering on JGINYUE USB controller direct mode
1 parent cd3ad18 commit 2609822

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

Controllers/JGINYUEInternalUSBController/JGINYUEInternalUSBController.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -191,21 +191,22 @@ void JGINYUEInternalUSBController::DirectLEDControl
191191
break;
192192
}
193193

194-
device_config[Active_zone].Mode_active =JGINYUE_USB_MODE_DIRECT;
195-
device_config[Active_zone].Direct_Mode_control =0x01;
196-
197-
memset(usb_buf, 0x00, sizeof(usb_buf));
194+
if(device_config[Active_zone].Mode_active != JGINYUE_USB_MODE_DIRECT)
195+
{
196+
device_config[Active_zone].Mode_active =JGINYUE_USB_MODE_DIRECT;
197+
device_config[Active_zone].Direct_Mode_control =0x01;
198198

199-
usb_buf[0x00] = JGINYUE_USB_LED_STRIPE_SET_COMMAND_HEADER;
200-
usb_buf[0x01] = zone;
201-
usb_buf[0x02] = device_config[Active_zone].LED_numbers;
202-
usb_buf[0x03] = device_config[Active_zone].RG_Swap;
203-
usb_buf[0x04] = device_config[Active_zone].Direction;
204-
usb_buf[0x05] = device_config[Active_zone].Direct_Mode_control;
199+
memset(usb_buf, 0x00, sizeof(usb_buf));
205200

206-
hid_write(dev, usb_buf, 16);
201+
usb_buf[0x00] = JGINYUE_USB_LED_STRIPE_SET_COMMAND_HEADER;
202+
usb_buf[0x01] = zone;
203+
usb_buf[0x02] = device_config[Active_zone].LED_numbers;
204+
usb_buf[0x03] = device_config[Active_zone].RG_Swap;
205+
usb_buf[0x04] = device_config[Active_zone].Direction;
206+
usb_buf[0x05] = device_config[Active_zone].Direct_Mode_control;
207207

208-
std::this_thread::sleep_for(20ms);
208+
hid_write(dev, usb_buf, 16);
209+
}
209210

210211
memset(usb_buf, 0x00, sizeof(usb_buf));
211212

0 commit comments

Comments
 (0)