summaryrefslogtreecommitdiffhomepage
path: root/tracker-trackhat
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2021-09-28 19:33:10 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-03-29 00:04:47 +0200
commitfca06d89770f439ec1d9f23690940df8479b3ec4 (patch)
treeacc75be4c49c2f82ce0c16d3d8b79634a5f87263 /tracker-trackhat
parent4eb8ec34fa87d60a1cf4d2b6c2f984fc0703e07f (diff)
tracker/trackhat: try harder on failure
Diffstat (limited to 'tracker-trackhat')
-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;
}