summaryrefslogtreecommitdiffhomepage
path: root/tracker-hatire/ftnoir_tracker_hat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tracker-hatire/ftnoir_tracker_hat.cpp')
-rw-r--r--tracker-hatire/ftnoir_tracker_hat.cpp37
1 files changed, 8 insertions, 29 deletions
diff --git a/tracker-hatire/ftnoir_tracker_hat.cpp b/tracker-hatire/ftnoir_tracker_hat.cpp
index e8da968f..30f40e60 100644
--- a/tracker-hatire/ftnoir_tracker_hat.cpp
+++ b/tracker-hatire/ftnoir_tracker_hat.cpp
@@ -106,44 +106,27 @@ void hatire::data(double *data)
if (ArduinoData.Code <= 1000)
HAT = ArduinoData;
- else
- emit t.serial_debug_info(data_read.mid(4,24)) ;
+
data_read.remove(0, 30);
}
else
{
+ CptError++;
// resync frame
- int index = data_read.indexOf(Begin, 1);
+ const int index = data_read.indexOf(Begin, 1);
if (index == -1)
- {
- index = data_read.length();
- }
-
- if (data_read.length() != 0)
- {
- emit t.serial_debug_info(data_read.mid(0,index));
-
+ data_read.clear();
+ else
data_read.remove(0, index);
-
- CptError++;
-
- qDebug() << QTime::currentTime() << "hatire resync stream" << "index" << index << "remaining" << data_read.size();
- }
}
}
}
if (CptError > 50)
{
- emit t.serial_debug_info("Can't find HAT frame");
- CptError=0;
- }
-
- // Need to handle this differently in opentrack as opposed to tracknoir
- //if (new_frame) {
- // in open track always populate the data, it seems opentrack always gives us a zeroed data structure to populate with pose data.
- // if we have no new data, we don't populate it and so 0 pose gets handed back which is wrong. By always running the code below, if we
- // have no new data, we will just give it the previous pose data which is the best thing we can do really.
+ qDebug() << "Can't find HAT frame";
+ CptError=0;
+ }
const struct
{
@@ -166,10 +149,6 @@ void hatire::data(double *data)
auto& k = spec[i];
k.place = (k.sign ? -1.f : 1.f) * (k.enable ? k.input : 0.f);
}
-
- // For debug
- //data->x=dataRead.length();
- //data->y=CptError;
}
#include "ftnoir_tracker_hat_dialog.h"