diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2021-09-28 19:33:10 +0200 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-03-29 00:04:47 +0200 |
| commit | fca06d89770f439ec1d9f23690940df8479b3ec4 (patch) | |
| tree | acc75be4c49c2f82ce0c16d3d8b79634a5f87263 /tracker-trackhat | |
| parent | 4eb8ec34fa87d60a1cf4d2b6c2f984fc0703e07f (diff) | |
tracker/trackhat: try harder on failure
Diffstat (limited to 'tracker-trackhat')
| -rw-r--r-- | tracker-trackhat/camera.cpp | 12 |
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; } |
