Add option for introducing a delay (in milliseconds) between direct mode LED packets for the QMK OpenRGB protocol

This commit is contained in:
Adam Honse committed 2021-09-11 20:10:37 -05:00
1 parent e4692cb562
commit d6e9ee3978
4 files changed
+36

No files matched your search

@@ -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;
}
}