diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-06 09:14:03 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-06 09:18:19 +0200 |
commit | aaa4ed77a2506144f470ce2b7fb269bedd17a2b3 (patch) | |
tree | 2536c83f06ae58743e48a39e498ad2712e597c4d /tracker-hatire/ftnoir_tracker_hat.cpp | |
parent | e19893b91326e53868136bbf0f2cf6835344cc7c (diff) |
tracker/hatire: simplify
We don't need to move back the datagram since we're processing the
original.
Diffstat (limited to 'tracker-hatire/ftnoir_tracker_hat.cpp')
-rwxr-xr-x | tracker-hatire/ftnoir_tracker_hat.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tracker-hatire/ftnoir_tracker_hat.cpp b/tracker-hatire/ftnoir_tracker_hat.cpp index 1ac0a1ad..25f0b903 100755 --- a/tracker-hatire/ftnoir_tracker_hat.cpp +++ b/tracker-hatire/ftnoir_tracker_hat.cpp @@ -10,6 +10,7 @@ */ #include <QDebug> #include "ftnoir_tracker_hat.h" +#include <algorithm> hatire::hatire() { @@ -93,7 +94,6 @@ void hatire::data(double *data) if (ok) { - while (data_read.length() >= 30) { //t.Log(data_read.toHex()); @@ -120,28 +120,28 @@ void hatire::data(double *data) } else { - bool ok = true; // resync frame int index = data_read.indexOf(Begin, 1); if (index == -1) { - ok = false; index = data_read.length(); } emit t.serial_debug_info(data_read.mid(0,index)); if (!ok) + { data_read.clear(); + } else + { data_read.remove(0, index); + } CptError++; - qDebug() << QTime::currentTime() << "hatire resync stream" << "index" << index << "ok" << ok; + qDebug() << QTime::currentTime() << "hatire resync stream" << "index" << index << "remaining" << data_read.size(); } } - - t.replace_data_nolock(std::move(data_read)); } } |