Fixes CEvent in InitializeSystem() to properly wait for initialization until all devices are registered, if the system is a DMPS. This fixes an issue where HDBaseT type endpoints were not working on a DMPS3 non-4K unit.

This commit is contained in:
Alex Johnson
2023-02-08 16:19:17 -05:00
parent 5de4382cd0
commit 8cc6cfafe9

View File

@@ -46,28 +46,29 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public override void InitializeSystem() public override void InitializeSystem()
{ {
_startTimer = new CTimer(StartSystem,StartupTime);
// If the control system is a DMPS type, we need to wait to exit this method until all devices have had time to activate // If the control system is a DMPS type, we need to wait to exit this method until all devices have had time to activate
// to allow any HD-BaseT DM endpoints to register first. // to allow any HD-BaseT DM endpoints to register first.
if (Global.ControlSystemIsDmpsType) bool preventInitializationComplete = Global.ControlSystemIsDmpsType;
if (preventInitializationComplete)
{ {
Debug.Console(1, "******************* InitializeSystem() Entering **********************"); Debug.Console(1, "******************* InitializeSystem() Entering **********************");
_startTimer = new CTimer(StartSystem, preventInitializationComplete, StartupTime);
_initializeEvent = new CEvent(); _initializeEvent = new CEvent(true, false);
DeviceManager.AllDevicesRegistered += (o, a) => DeviceManager.AllDevicesRegistered += (o, a) =>
{ {
_initializeEvent.Set(); _initializeEvent.Set();
Debug.Console(1, "******************* InitializeSystem() Exiting **********************");
}; };
_initializeEvent.Wait(30000); _initializeEvent.Wait(30000);
Debug.Console(1, "******************* InitializeSystem() Exiting **********************");
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
}
else
{
_startTimer = new CTimer(StartSystem, preventInitializationComplete, StartupTime);
} }
} }
private void StartSystem(object obj) private void StartSystem(object preventInitialization)
{ {
DeterminePlatform(); DeterminePlatform();
@@ -124,8 +125,11 @@ namespace PepperDash.Essentials
return; return;
} }
if (!(bool)preventInitialization)
{
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true; SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
} }
}
/// <summary> /// <summary>
/// Determines if the program is running on a processor (appliance) or server (VC-4). /// Determines if the program is running on a processor (appliance) or server (VC-4).