summaryrefslogtreecommitdiffhomepage
path: root/tracker-hatire/ftnoir_tracker_hat_settings.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-04-29 11:30:37 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-04-29 11:30:37 +0200
commit38dd6e55d20adfd830d834c394fc6ce7373a4805 (patch)
tree0a94bf051ff0bc153abebaa74e474748c2d4d8a6 /tracker-hatire/ftnoir_tracker_hat_settings.cpp
parent4db6f6334d13ed5e8696dfa0208b42b3e9a2352a (diff)
tracker/hatire: move io to a separate thread
We can't have async io on the main thread because QSerialPort's readyRead() signal can fire constantly, thus consuming all CPU time. We can't sleep in the main thread either as that blocks too many things. We can't ignore readyRead() invocations over a threshold as that'll make us lose some of data notifications. Refactor hatire to put IO on a thread. Since this is a separate Qt event loop, we may sleep in there. Further, add a debug mode reading data from a file, as if it came from a serial-attached device. Issue: #327
Diffstat (limited to 'tracker-hatire/ftnoir_tracker_hat_settings.cpp')
-rw-r--r--tracker-hatire/ftnoir_tracker_hat_settings.cpp22
1 files changed, 5 insertions, 17 deletions
diff --git a/tracker-hatire/ftnoir_tracker_hat_settings.cpp b/tracker-hatire/ftnoir_tracker_hat_settings.cpp
index df0480a1..02c99e75 100644
--- a/tracker-hatire/ftnoir_tracker_hat_settings.cpp
+++ b/tracker-hatire/ftnoir_tracker_hat_settings.cpp
@@ -13,18 +13,13 @@
#include <QVariant>
#include "ftnoir_tracker_hat_settings.h"
-#ifdef OPENTRACK_API
#include "opentrack-compat/options.hpp"
-#endif
+
+// XXX TODO move to opentrack settings api -sh 20160410
void TrackerSettings::load_ini()
{
-#ifndef OPENTRACK_API
- QSettings settings(OPENTRACK_ORG); // Registry settings (in HK_USER)
- QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
-#else
QString currentFile = options::group::ini_pathname();
-#endif
QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
iniFile.beginGroup( "HAT" );
@@ -66,9 +61,8 @@ void TrackerSettings::load_ini()
DelayStart=iniFile.value("DelayStart",0).toInt();
DelaySeq=iniFile.value("DelaySeq",0).toInt();
-#ifdef OPENTRACK_API
FPSArduino=iniFile.value("FPSArduino",30).toInt();
-#endif
+
BigEndian=iniFile.value("BigEndian",0).toBool();
@@ -84,12 +78,8 @@ void TrackerSettings::load_ini()
void TrackerSettings::save_ini() const
{
-#ifndef OPENTRACK_API
- QSettings settings(OPENTRACK_ORG); // Registry settings (in HK_USER)
- QString currentFile = settings.value( "SettingsFile", QCoreApplication::applicationDirPath() + "/Settings/default.ini" ).toString();
-#else
QString currentFile = options::group::ini_pathname();
-#endif
+
QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
iniFile.beginGroup ( "HAT" );
@@ -129,9 +119,8 @@ void TrackerSettings::save_ini() const
iniFile.setValue ( "DelayStart",DelayStart);
iniFile.setValue ( "DelaySeq",DelaySeq);
-#ifdef OPENTRACK_API
iniFile.setValue ( "FPSArduino", FPSArduino );
-#endif
+
iniFile.setValue("BigEndian",BigEndian);
iniFile.setValue("BaudRate",pBaudRate);
@@ -143,4 +132,3 @@ void TrackerSettings::save_ini() const
iniFile.endGroup();
}
-