Skip to content

Commit

Permalink
Multi-init bandaid for zombiemode
Browse files Browse the repository at this point in the history
  • Loading branch information
KimihikoAkayasaki committed Dec 29, 2023
1 parent bee6128 commit b1ea560
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions plugin_KinectOne/KinectOne.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,32 @@ private bool InitKinect()
try
{
// Try to open the kinect sensor
KinectSensor.Open();

// Necessary to allow kinect to become available behind the scenes
Thread.Sleep(2000);
KinectSensor.Open(); // Open 1st
for (var i = 0; i < 20; i++)
{
// Refresh refresh refresh refresh
Thread.Sleep(200);
if (KinectSensor.IsAvailable) break;
}

// Get connected get connected
Thread.Sleep(1000);

try
{
// Try to open the kinect sensor
KinectSensor.Open(); // Open 2nd
for (var i = 0; i < 20; i++)
{
// Wait for the device to initialize
Thread.Sleep(200);
if (KinectSensor.IsAvailable) break;
}
}
catch
{
// ignored
}

// Register a watchdog (remove, add)
KinectSensor.IsAvailableChanged -= StatusChangedHandler;
Expand Down

0 comments on commit b1ea560

Please sign in to comment.