Florian Mueller 7 years ago
parent
commit
8672deb8f8
2 changed files with 7 additions and 2 deletions
  1. BIN
      .vs/bbiwarg/v14/.suo
  2. 7 2
      bbiwarg/Input/InputProviding/InputProviderIntel.cs

BIN
.vs/bbiwarg/v14/.suo


+ 7 - 2
bbiwarg/Input/InputProviding/InputProviderIntel.cs

@@ -111,7 +111,9 @@ namespace BBIWARG.Input.InputProviding
                 {
                     Console.WriteLine("Trying to reinitialize the camera...");
                     Task<bool> initCameraTask = Task.Run(() => restartCamera());
-                    crashed = !initCameraTask.Wait(TimeSpan.FromSeconds(5)) || !initCameraTask.Result;
+                    initCameraTask.Wait(TimeSpan.FromSeconds(5));
+
+                    crashed = !initCameraTask.IsCompleted || !initCameraTask.Result;
 
                     if (crashed) {
                         Console.WriteLine("Something went wrong during init. Waiting a few seconds to cool down...");
@@ -131,7 +133,9 @@ namespace BBIWARG.Input.InputProviding
                 //try to acquire new frame...
                 Task<bool> acquireFrameTask = Task.Run(() => acquireNewFrame());
                 //wait a second...
-                if (acquireFrameTask.Wait(TimeSpan.FromSeconds(4)) && acquireFrameTask.Result)
+                acquireFrameTask.Wait(TimeSpan.FromSeconds(4));
+
+                if (acquireFrameTask.IsCompleted && acquireFrameTask.Result)
                 {
                     //that worked, we should have a new frame by now...
                     handleNewFrame();
@@ -155,6 +159,7 @@ namespace BBIWARG.Input.InputProviding
             {
                 crashed = false;
                 senseManager.Dispose();
+                Thread.Sleep(1000);
                 return initCameraDevice();
             }
             catch (Exception)