summaryrefslogtreecommitdiffhomepage
path: root/tracker-hatire/thread.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-05-09 16:25:31 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-05-09 16:25:31 +0200
commitacec691b5d6d6373e8f8f41f288d5fb6e2f84215 (patch)
tree1f1b7f6b98ddea8e4f9b750fff452337864e254f /tracker-hatire/thread.cpp
parentfd0ad89c7c6f61aa14d6e908e9217121f4afa5c6 (diff)
tracker/hatire: add serial 100% cpu usage workaround
Issue: #327
Diffstat (limited to 'tracker-hatire/thread.cpp')
-rwxr-xr-xtracker-hatire/thread.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/tracker-hatire/thread.cpp b/tracker-hatire/thread.cpp
index 238c5fdd..d512e463 100755
--- a/tracker-hatire/thread.cpp
+++ b/tracker-hatire/thread.cpp
@@ -309,11 +309,14 @@ void hatire_thread::on_serial_read()
qDebug() << "stat:" << "avg" << stat.avg() << "stddev" << stat.stddev();
}
- // qt can fire QSerialPort::readyRead() needlessly, causing a busy loop.
- // see https://github.com/opentrack/opentrack/issues/327#issuecomment-207941003
- constexpr int hz = 90;
- constexpr int ms = 1000/hz;
- portable::sleep(ms);
+ if (s.serial_bug_workaround)
+ {
+ // qt can fire QSerialPort::readyRead() needlessly, causing a busy loop.
+ // see https://github.com/opentrack/opentrack/issues/327#issuecomment-207941003
+ constexpr int hz = 90;
+ constexpr int ms = 1000/hz;
+ portable::sleep(ms);
+ }
}
QByteArray& hatire_thread::send_data_read_nolock()