Do not automatically refresh HyperX direct mode unless it has been 50ms since last device update to prevent flickering

This commit is contained in:
Adam Honse 2020-06-15 11:04:59 -05:00
parent 3eba2c3dd3
commit 771e362a63
2 changed files with 11 additions and 2 deletions

View file

@ -324,6 +324,8 @@ void RGBController_HyperXKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
void RGBController_HyperXKeyboard::DeviceUpdateLEDs()
{
last_update_time = clock();
if(active_mode == 0)
{
hyperx->SetLEDsDirect(colors);
@ -368,8 +370,11 @@ void RGBController_HyperXKeyboard::KeepaliveThread()
{
if(active_mode == 0)
{
UpdateLEDs();
if((clock() - last_update_time) > 50)
{
UpdateLEDs();
}
}
Sleep(100);
Sleep(10);
}
}

View file

@ -8,6 +8,8 @@
\*-----------------------------------------*/
#pragma once
#include <time.h>
#include "RGBController.h"
#include "HyperXKeyboardController.h"
@ -32,4 +34,6 @@ public:
private:
HyperXKeyboardController* hyperx;
clock_t last_update_time;
};