mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-01-26 07:58:16 -05:00
[WIP] UpdateLEDsInternal to prevent signaling RGBController update callback from internal updates/keepalive threads
This commit is contained in:
@@ -381,7 +381,7 @@ void RGBController_AlienwareAW410K::DeviceUpdateMode()
|
||||
{
|
||||
if(active_mode == 0xFFFF)
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -402,7 +402,7 @@ void RGBController_AlienwareAW510K::DeviceUpdateMode()
|
||||
{
|
||||
if(active_mode == 0xFFFF)
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ void RGBController_Arctic::KeepaliveThreadFunction()
|
||||
sleep_time = ARCTIC_KEEPALIVE_PERIOD - (std::chrono::steady_clock::now() - last_update_time);
|
||||
if(sleep_time <= ARCTIC_SLEEP_THRESHOLD)
|
||||
{
|
||||
UpdateLEDs(); // Already protected thru a device update thread
|
||||
UpdateLEDsInternal(); // Already protected thru a device update thread
|
||||
std::this_thread::sleep_for(ARCTIC_KEEPALIVE_PERIOD);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -218,7 +218,7 @@ void RGBController_DMX::KeepaliveThreadFunction()
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > ( keepalive_delay * 0.95f ) )
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
std::this_thread::sleep_for(keepalive_delay / 2);
|
||||
}
|
||||
|
||||
@@ -456,7 +456,7 @@ void RGBController_E131::KeepaliveThreadFunction()
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > ( keepalive_delay * 0.95f ) )
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
std::this_thread::sleep_for(keepalive_delay / 2);
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ void RGBController_HyperXAlloyElite2::KeepaliveThreadFunction()
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(1000))
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(50ms);
|
||||
|
||||
@@ -356,7 +356,7 @@ void RGBController_HyperXAlloyElite::KeepaliveThreadFunction()
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(10ms);;
|
||||
|
||||
@@ -285,7 +285,7 @@ void RGBController_HyperXAlloyFPS::KeepaliveThreadFunction()
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(10ms);;
|
||||
|
||||
@@ -347,7 +347,7 @@ void RGBController_HyperXAlloyOrigins60and65::KeepaliveThread()
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(10ms);;
|
||||
|
||||
@@ -301,7 +301,7 @@ void RGBController_HyperXAlloyOrigins::KeepaliveThread()
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(10ms);;
|
||||
|
||||
@@ -144,7 +144,7 @@ void RGBController_HyperXMicrophone::KeepaliveThread()
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
std::this_thread::sleep_for(15ms);
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ void RGBController_HyperXMicrophoneV2::KeepaliveThread()
|
||||
{
|
||||
if(!controller->ShouldPauseUpdates() && (std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(1000))
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
std::this_thread::sleep_for(250ms);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ void RGBController_HyperXPulsefireFPSPro::KeepaliveThread()
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(10ms);
|
||||
|
||||
@@ -132,7 +132,7 @@ void RGBController_HyperXPulsefireHaste::KeepaliveThread()
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(10ms);
|
||||
|
||||
@@ -121,7 +121,7 @@ void RGBController_HyperXPulsefireRaid::KeepaliveThread()
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > 1s)
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ void RGBController_HyperXPulsefireSurge::KeepaliveThread()
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(10ms);
|
||||
|
||||
@@ -143,7 +143,7 @@ void RGBController_HyperXMousemat::KeepaliveThread()
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(50))
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(10ms);
|
||||
|
||||
@@ -148,7 +148,7 @@ void RGBController_LGMonitor::KeepaliveThread()
|
||||
{
|
||||
if((modes[active_mode].value == LG_MONITOR_DIRECT_MODE_VALUE) && (std::chrono::steady_clock::now() - last_update_time) > std::chrono::milliseconds(500))
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(15ms);
|
||||
|
||||
@@ -162,7 +162,7 @@ void RGBController_LogitechG213::DeviceUpdateMode()
|
||||
\*---------------------------------------------------------*/
|
||||
if(active_mode == 0xFFFF)
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -376,7 +376,7 @@ void RGBController_LogitechG810::DeviceUpdateMode()
|
||||
\*---------------------------------------------------------*/
|
||||
if(active_mode == 0xFFFF)
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -377,7 +377,7 @@ void RGBController_LogitechG910::DeviceUpdateMode()
|
||||
\*---------------------------------------------------------*/
|
||||
if(active_mode == 0xFFFF)
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -353,7 +353,7 @@ void RGBController_LogitechGProKeyboard::DeviceUpdateMode()
|
||||
\*---------------------------------------------------------*/
|
||||
if(active_mode == 0xFFFF)
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ void RGBController_PhilipsHueEntertainment::KeepaliveThreadFunction()
|
||||
{
|
||||
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::seconds(5))
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
}
|
||||
std::this_thread::sleep_for(1s);
|
||||
|
||||
@@ -164,7 +164,7 @@ void RGBController_SinowealthKeyboard10c::KeepaliveThreadFunction()
|
||||
{
|
||||
if(active_mode == MODE_DIRECT && (std::chrono::steady_clock::now() - last_update_time) > 1s)
|
||||
{
|
||||
UpdateLEDs();
|
||||
UpdateLEDsInternal();
|
||||
}
|
||||
std::this_thread::sleep_for(500ms);
|
||||
}
|
||||
|
||||
@@ -178,11 +178,20 @@ unsigned int NetworkServer::GetClientProtocolVersion(unsigned int client_num)
|
||||
\*---------------------------------------------------------*/
|
||||
void NetworkServer::DeviceListChanged()
|
||||
{
|
||||
/*-----------------------------------------------------*\
|
||||
| Register the server's RGBController update handler |
|
||||
| for each RGBController in the controllers list |
|
||||
\*-----------------------------------------------------*/
|
||||
//for(std::size_t controller_idx = 0; controller_idx < controllers.size(); controller_idx++)
|
||||
//{
|
||||
// controllers[controller_idx]->RegisterUpdateCallback();
|
||||
//}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Indicate to the clients that the controller list has |
|
||||
| changed |
|
||||
\*-----------------------------------------------------*/
|
||||
for(unsigned int client_idx = 0; client_idx < ServerClients.size(); client_idx++)
|
||||
for(std::size_t client_idx = 0; client_idx < ServerClients.size(); client_idx++)
|
||||
{
|
||||
SendRequest_DeviceListChanged(ServerClients[client_idx]->client_sock);
|
||||
}
|
||||
|
||||
@@ -3752,6 +3752,11 @@ void RGBController::SetupColors()
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController::UpdateLEDsInternal()
|
||||
{
|
||||
CallFlag_UpdateLEDs = true;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Functions to be implemented in device implementation |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
@@ -727,6 +727,7 @@ protected:
|
||||
\*-----------------------------------------------------*/
|
||||
unsigned int LEDsInZone(unsigned int zone);
|
||||
void SetupColors();
|
||||
void UpdateLEDsInternal();
|
||||
|
||||
private:
|
||||
/*-----------------------------------------------------*\
|
||||
|
||||
Reference in New Issue
Block a user