Add option for introducing a delay (in milliseconds) between direct mode LED packets for the QMK OpenRGB protocol
This commit is contained in:
parent
e4692cb562
commit
d6e9ee3978
4 changed files with 36 additions and 0 deletions
|
|
@ -11,6 +11,8 @@
|
|||
|
||||
#include "QMKOpenRGBRev9Controller.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
static std::map<uint8_t, std::string> QMKKeycodeToKeynameMap
|
||||
{
|
||||
{ 0, "" }, { 1, "Right Fn" }, { 2, "" }, { 3, "" },
|
||||
|
|
@ -85,6 +87,15 @@ QMKOpenRGBRev9Controller::QMKOpenRGBRev9Controller(hid_device *dev_handle, const
|
|||
leds_per_update = 20;
|
||||
}
|
||||
|
||||
if(qmk_settings.contains("delay"))
|
||||
{
|
||||
delay = (unsigned int)qmk_settings["delay"] * 1ms;
|
||||
}
|
||||
else
|
||||
{
|
||||
delay = 0ms;
|
||||
}
|
||||
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
|
||||
|
|
@ -451,6 +462,11 @@ void QMKOpenRGBRev9Controller::DirectModeSetLEDs(std::vector<RGBColor> colors, u
|
|||
|
||||
hid_write(dev, usb_buf, 65);
|
||||
|
||||
if(delay > 0ms)
|
||||
{
|
||||
std::this_thread::sleep_for(delay);
|
||||
}
|
||||
|
||||
leds_sent += tmp_leds_per_update;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ private:
|
|||
std::string device_name;
|
||||
std::string device_vendor;
|
||||
|
||||
std::chrono::milliseconds delay;
|
||||
|
||||
unsigned int total_number_of_leds;
|
||||
unsigned int total_number_of_leds_with_empty_space;
|
||||
unsigned int mode;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "QMKOpenRGBRevBController.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
static std::map<uint8_t, std::string> QMKKeycodeToKeynameMap
|
||||
{
|
||||
{ 0, "" }, { 1, "Right Fn" }, { 2, "" }, { 3, "" },
|
||||
|
|
@ -83,6 +85,15 @@ QMKOpenRGBRevBController::QMKOpenRGBRevBController(hid_device *dev_handle, const
|
|||
leds_per_update = 20;
|
||||
}
|
||||
|
||||
if(qmk_settings.contains("delay"))
|
||||
{
|
||||
delay = (unsigned int)qmk_settings["delay"] * 1ms;
|
||||
}
|
||||
else
|
||||
{
|
||||
delay = 0ms;
|
||||
}
|
||||
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
|
||||
|
|
@ -473,6 +484,11 @@ void QMKOpenRGBRevBController::DirectModeSetLEDs(std::vector<RGBColor> colors, u
|
|||
|
||||
hid_write(dev, usb_buf, 65);
|
||||
|
||||
if(delay > 0ms)
|
||||
{
|
||||
std::this_thread::sleep_for(delay);
|
||||
}
|
||||
|
||||
leds_sent += tmp_leds_per_update;
|
||||
}
|
||||
}
|
||||
|
|
@ -54,6 +54,8 @@ private:
|
|||
std::string device_name;
|
||||
std::string device_vendor;
|
||||
|
||||
std::chrono::milliseconds delay;
|
||||
|
||||
unsigned int total_number_of_leds;
|
||||
unsigned int total_number_of_leds_with_empty_space;
|
||||
unsigned int mode;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue