Add delay in between packets to stop flickering

This commit is contained in:
Adam Honse 2023-12-25 18:45:06 -06:00
parent 2d990ca037
commit db50b1f568

View file

@ -31,6 +31,7 @@
#define JGINYUE_RG_DEFAULT 0x01
#define JGINYUE_RG_SWAP 0x00
using namespace std::chrono_literals;
JGINYUEInternalUSBController::JGINYUEInternalUSBController(hid_device* dev_handle, const char* path)
{
@ -151,7 +152,9 @@ void JGINYUEInternalUSBController::WriteZoneMode
usb_buf[0x04] = device_config[Active_zone].Direction;
usb_buf[0x05] = device_config[Active_zone].Direct_Mode_control;
hid_write(dev, usb_buf ,16);
hid_write(dev, usb_buf, 16);
std::this_thread::sleep_for(5ms);
memset(usb_buf, 0x00, sizeof(usb_buf));
@ -204,6 +207,8 @@ void JGINYUEInternalUSBController::DirectLEDControl
hid_write(dev, usb_buf, 16);
std::this_thread::sleep_for(5ms);
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = JGINYUE_USB_PER_LED_SET_COMMAND_HEADER;