diff options
Diffstat (limited to 'tracker-hatire')
| -rw-r--r-- | tracker-hatire/lang/nl_NL.ts | 8 | ||||
| -rw-r--r-- | tracker-hatire/lang/ru_RU.ts | 8 | ||||
| -rw-r--r-- | tracker-hatire/lang/stub.ts | 8 | ||||
| -rw-r--r-- | tracker-hatire/lang/zh_CN.ts | 8 | ||||
| -rw-r--r-- | tracker-hatire/thread.cpp | 24 | ||||
| -rw-r--r-- | tracker-hatire/thread.hpp | 8 | 
6 files changed, 11 insertions, 53 deletions
| diff --git a/tracker-hatire/lang/nl_NL.ts b/tracker-hatire/lang/nl_NL.ts index aee6d99c..a1e613b0 100644 --- a/tracker-hatire/lang/nl_NL.ts +++ b/tracker-hatire/lang/nl_NL.ts @@ -16,14 +16,6 @@          <translation type="unfinished"></translation>      </message>      <message> -        <source>Buggy serial port uses too much CPU</source> -        <translation type="unfinished"></translation> -    </message> -    <message> -        <source>Workaround</source> -        <translation type="unfinished"></translation> -    </message> -    <message>          <source>Zero</source>          <translation type="unfinished"></translation>      </message> diff --git a/tracker-hatire/lang/ru_RU.ts b/tracker-hatire/lang/ru_RU.ts index b25d092b..f7f3024d 100644 --- a/tracker-hatire/lang/ru_RU.ts +++ b/tracker-hatire/lang/ru_RU.ts @@ -16,14 +16,6 @@          <translation type="unfinished"></translation>      </message>      <message> -        <source>Buggy serial port uses too much CPU</source> -        <translation type="unfinished"></translation> -    </message> -    <message> -        <source>Workaround</source> -        <translation type="unfinished"></translation> -    </message> -    <message>          <source>Zero</source>          <translation type="unfinished"></translation>      </message> diff --git a/tracker-hatire/lang/stub.ts b/tracker-hatire/lang/stub.ts index b920a489..0d22bf81 100644 --- a/tracker-hatire/lang/stub.ts +++ b/tracker-hatire/lang/stub.ts @@ -16,14 +16,6 @@          <translation type="unfinished"></translation>      </message>      <message> -        <source>Buggy serial port uses too much CPU</source> -        <translation type="unfinished"></translation> -    </message> -    <message> -        <source>Workaround</source> -        <translation type="unfinished"></translation> -    </message> -    <message>          <source>Zero</source>          <translation type="unfinished"></translation>      </message> diff --git a/tracker-hatire/lang/zh_CN.ts b/tracker-hatire/lang/zh_CN.ts index b920a489..0d22bf81 100644 --- a/tracker-hatire/lang/zh_CN.ts +++ b/tracker-hatire/lang/zh_CN.ts @@ -16,14 +16,6 @@          <translation type="unfinished"></translation>      </message>      <message> -        <source>Buggy serial port uses too much CPU</source> -        <translation type="unfinished"></translation> -    </message> -    <message> -        <source>Workaround</source> -        <translation type="unfinished"></translation> -    </message> -    <message>          <source>Zero</source>          <translation type="unfinished"></translation>      </message> diff --git a/tracker-hatire/thread.cpp b/tracker-hatire/thread.cpp index 07e97d78..3eb2579f 100644 --- a/tracker-hatire/thread.cpp +++ b/tracker-hatire/thread.cpp @@ -1,13 +1,15 @@  #include "thread.hpp" -#include "compat/sleep.hpp"  #include "compat/base-path.hpp" +#include "compat/sleep.hpp" +  #include <utility> +#include <cstring>  #include <QTextStream>  #include <QTime> -#include <QDebug> +#include <QByteArray> -#include <cstring> +#include <QDebug>  void hatire_thread::sendcmd_impl(const QByteArray &cmd)  { @@ -123,7 +125,8 @@ void hatire_thread::teardown_serial()          }          emit serial_debug_info(msg); -        disconnect(&com_port, SIGNAL(readyRead()), nullptr, nullptr); +        // XXX does this make any sense? -sh 20180703 +        //disconnect(&com_port, SIGNAL(readyRead()), nullptr, nullptr);          com_port.close();      }  } @@ -305,9 +308,6 @@ void hatire_thread::on_serial_read()      if (sz > 0)      { -        stat.input(timer.elapsed_ms()); -        timer.start(); -          QMutexLocker lck(&data_mtx);          data_read.append(buf, sz);      } @@ -319,20 +319,16 @@ void hatire_thread::on_serial_read()      }  #endif -    if (s.serial_bug_workaround || sz <= 0) +    if (sz <= 0)      {          // qt can fire QSerialPort::readyRead() needlessly, causing a busy loop.          // see https://github.com/opentrack/opentrack/issues/327#issuecomment-207941003 + +        // this probably happens with flaky BT/usb-to-serial converters (?)          constexpr int hz = 90;          constexpr int ms = 1000/hz;          portable::sleep(ms);      } - -    if (throttle_timer.elapsed_ms() >= 3000) -    { -        throttle_timer.start(); -        qDebug() << "stat:" << "avg" << stat.avg() << "stddev" << stat.stddev(); -    }  }  QByteArray& hatire_thread::send_data_read_nolock() diff --git a/tracker-hatire/thread.hpp b/tracker-hatire/thread.hpp index 93c50c9e..5cecbdce 100644 --- a/tracker-hatire/thread.hpp +++ b/tracker-hatire/thread.hpp @@ -4,16 +4,12 @@  #include "ftnoir_tracker_hat_settings.h"  #include <QSerialPort> -#include <QByteArray>  #include <QThread>  #include <QMutex>  #include <QFile>  #include <QCoreApplication> -#include "compat/variance.hpp" -#include "compat/timer.hpp" -  enum results  {      result_ok, @@ -34,7 +30,7 @@ struct serial_result      serial_result(results code, const QString& error) : error(error), code(code) {}      QString error; -    results code; +    results code { result_error };  };  class hatire_thread : public QThread @@ -51,8 +47,6 @@ class hatire_thread : public QThread      QByteArray data_read;      serial_t com_port;      TrackerSettings s; -    variance stat; -    Timer timer, throttle_timer;      char buf[1024];      void run() override; | 
