summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tracker-trackhat/camera.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tracker-trackhat/camera.cpp b/tracker-trackhat/camera.cpp
index a1265e80..9609132e 100644
--- a/tracker-trackhat/camera.cpp
+++ b/tracker-trackhat/camera.cpp
@@ -1,4 +1,5 @@
#include "trackhat.hpp"
+#include "compat/sleep.hpp"
#include <QDebug>
pt_camera::result trackhat_camera::get_info() const
@@ -80,6 +81,12 @@ error:
bool trackhat_camera::start(const pt_settings&)
{
+ int attempts = 0;
+
+ if (status >= th_running)
+ return true;
+
+start:
stop();
trackHat_EnableDebugMode();
@@ -99,6 +106,11 @@ bool trackhat_camera::start(const pt_settings&)
return true;
error:
stop();
+ if (++attempts < 5)
+ {
+ portable::sleep(100);
+ goto start;
+ }
return false;
}