Fix flickering on JGINYUE USB controller direct mode

This commit is contained in:
Adam Honse
2025-09-13 17:01:22 -05:00
parent cd3ad1822b
commit 2609822f8a

View File

@@ -191,21 +191,22 @@ void JGINYUEInternalUSBController::DirectLEDControl
break;
}
device_config[Active_zone].Mode_active =JGINYUE_USB_MODE_DIRECT;
device_config[Active_zone].Direct_Mode_control =0x01;
if(device_config[Active_zone].Mode_active != JGINYUE_USB_MODE_DIRECT)
{
device_config[Active_zone].Mode_active =JGINYUE_USB_MODE_DIRECT;
device_config[Active_zone].Direct_Mode_control =0x01;
memset(usb_buf, 0x00, sizeof(usb_buf));
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = JGINYUE_USB_LED_STRIPE_SET_COMMAND_HEADER;
usb_buf[0x01] = zone;
usb_buf[0x02] = device_config[Active_zone].LED_numbers;
usb_buf[0x03] = device_config[Active_zone].RG_Swap;
usb_buf[0x04] = device_config[Active_zone].Direction;
usb_buf[0x05] = device_config[Active_zone].Direct_Mode_control;
usb_buf[0x00] = JGINYUE_USB_LED_STRIPE_SET_COMMAND_HEADER;
usb_buf[0x01] = zone;
usb_buf[0x02] = device_config[Active_zone].LED_numbers;
usb_buf[0x03] = device_config[Active_zone].RG_Swap;
usb_buf[0x04] = device_config[Active_zone].Direction;
usb_buf[0x05] = device_config[Active_zone].Direct_Mode_control;
hid_write(dev, usb_buf, 16);
std::this_thread::sleep_for(20ms);
hid_write(dev, usb_buf, 16);
}
memset(usb_buf, 0x00, sizeof(usb_buf));