[WIP] UpdateLEDsInternal to prevent signaling RGBController update callback from internal updates/keepalive threads

This commit is contained in:
Adam Honse
2026-01-07 12:01:36 -06:00
parent 0e674dcbf8
commit c7ebc68642
27 changed files with 40 additions and 25 deletions

View File

@@ -381,7 +381,7 @@ void RGBController_AlienwareAW410K::DeviceUpdateMode()
{
if(active_mode == 0xFFFF)
{
UpdateLEDs();
UpdateLEDsInternal();
return;
}

View File

@@ -402,7 +402,7 @@ void RGBController_AlienwareAW510K::DeviceUpdateMode()
{
if(active_mode == 0xFFFF)
{
UpdateLEDs();
UpdateLEDsInternal();
return;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -121,7 +121,7 @@ void RGBController_HyperXPulsefireRaid::KeepaliveThread()
{
if((std::chrono::steady_clock::now() - last_update_time) > 1s)
{
UpdateLEDs();
UpdateLEDsInternal();
}
}

View File

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

View File

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

View File

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

View File

@@ -162,7 +162,7 @@ void RGBController_LogitechG213::DeviceUpdateMode()
\*---------------------------------------------------------*/
if(active_mode == 0xFFFF)
{
UpdateLEDs();
UpdateLEDsInternal();
return;
}

View File

@@ -376,7 +376,7 @@ void RGBController_LogitechG810::DeviceUpdateMode()
\*---------------------------------------------------------*/
if(active_mode == 0xFFFF)
{
UpdateLEDs();
UpdateLEDsInternal();
return;
}

View File

@@ -377,7 +377,7 @@ void RGBController_LogitechG910::DeviceUpdateMode()
\*---------------------------------------------------------*/
if(active_mode == 0xFFFF)
{
UpdateLEDs();
UpdateLEDsInternal();
return;
}

View File

@@ -353,7 +353,7 @@ void RGBController_LogitechGProKeyboard::DeviceUpdateMode()
\*---------------------------------------------------------*/
if(active_mode == 0xFFFF)
{
UpdateLEDs();
UpdateLEDsInternal();
return;
}

View File

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

View File

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

View File

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

View File

@@ -3752,6 +3752,11 @@ void RGBController::SetupColors()
}
}
void RGBController::UpdateLEDsInternal()
{
CallFlag_UpdateLEDs = true;
}
/*---------------------------------------------------------*\
| Functions to be implemented in device implementation |
\*---------------------------------------------------------*/

View File

@@ -727,6 +727,7 @@ protected:
\*-----------------------------------------------------*/
unsigned int LEDsInZone(unsigned int zone);
void SetupColors();
void UpdateLEDsInternal();
private:
/*-----------------------------------------------------*\