From 21cb382c2a09405d9ca85e4193582bfd8ae00731 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 3 Jul 2018 08:23:05 +0200 Subject: cleanup --- compat/correlation-calibrator.cpp | 4 ---- compat/correlation-calibrator.hpp | 2 +- compat/tr.cpp | 1 - compat/tr.hpp | 1 - filter-kalman/kalman.cpp | 8 ++------ tracker-hatire/lang/nl_NL.ts | 8 -------- tracker-hatire/lang/ru_RU.ts | 8 -------- tracker-hatire/lang/stub.ts | 8 -------- tracker-hatire/lang/zh_CN.ts | 8 -------- tracker-hatire/thread.cpp | 24 ++++++++++-------------- tracker-hatire/thread.hpp | 8 +------- 11 files changed, 14 insertions(+), 66 deletions(-) diff --git a/compat/correlation-calibrator.cpp b/compat/correlation-calibrator.cpp index b2e83153..a58d31cd 100644 --- a/compat/correlation-calibrator.cpp +++ b/compat/correlation-calibrator.cpp @@ -18,10 +18,6 @@ using namespace correlation_calibrator_impl; -correlation_calibrator::correlation_calibrator() -{ -} - static constexpr unsigned nbuckets[6] = { x_nbuckets, diff --git a/compat/correlation-calibrator.hpp b/compat/correlation-calibrator.hpp index 9c866545..2c9e1937 100644 --- a/compat/correlation-calibrator.hpp +++ b/compat/correlation-calibrator.hpp @@ -63,7 +63,7 @@ class OTR_COMPAT_EXPORT correlation_calibrator final bool check_buckets(const vec6& data); public: - correlation_calibrator(); + correlation_calibrator() = default; void input(const vec6& data); mat66 get_coefficients() const; unsigned sample_count() const; diff --git a/compat/tr.cpp b/compat/tr.cpp index 72e02527..58f0a71a 100644 --- a/compat/tr.cpp +++ b/compat/tr.cpp @@ -10,4 +10,3 @@ TR& TR::operator=(const TR&) return *this; } -TR::~TR() {} diff --git a/compat/tr.hpp b/compat/tr.hpp index 7bb4fb71..6af45161 100644 --- a/compat/tr.hpp +++ b/compat/tr.hpp @@ -13,7 +13,6 @@ class OTR_COMPAT_EXPORT TR : public QObject public: TR(); TR(const TR&); - ~TR() override; TR& operator=(const TR& other); }; diff --git a/filter-kalman/kalman.cpp b/filter-kalman/kalman.cpp index c70093bb..83898853 100644 --- a/filter-kalman/kalman.cpp +++ b/filter-kalman/kalman.cpp @@ -5,8 +5,8 @@ * copyright notice and this permission notice appear in all copies. */ #include "kalman.h" -#include #include +#include void KalmanFilter::init() { @@ -270,12 +270,8 @@ dialog_kalman::dialog_kalman() void dialog_kalman::updateLabels(const slider_value&) { - // M$ hates unicode! (M$ autoconverts source code of one kind of utf-8 format, - // the one without BOM, to another kind that QT does not like) - // Previous attempt to use c++11 utf8 strings like u8" °" now failed for unknown - // reasons where it worked before. Hence fallback to QChar(0x00b0). this->ui.noiseRotLabel->setText( - QString::number(settings::map_slider_value(s.noise_rot_slider_value), 'f', 3) + " " + QChar(0x00b0)); + QString::number(settings::map_slider_value(s.noise_rot_slider_value), 'f', 3) + "°"); this->ui.noisePosLabel->setText( QString::number(settings::map_slider_value(s.noise_pos_slider_value), 'f', 3) + " cm"); 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 @@ -15,14 +15,6 @@ Serial port - - Buggy serial port uses too much CPU - - - - Workaround - - Zero 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 @@ -15,14 +15,6 @@ Serial port - - Buggy serial port uses too much CPU - - - - Workaround - - Zero 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 @@ -15,14 +15,6 @@ Serial port - - Buggy serial port uses too much CPU - - - - Workaround - - Zero 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 @@ -15,14 +15,6 @@ Serial port - - Buggy serial port uses too much CPU - - - - Workaround - - Zero 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 +#include #include #include -#include +#include -#include +#include 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 -#include #include #include #include #include -#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; -- cgit v1.2.3