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