summaryrefslogtreecommitdiffhomepage
path: root/tracker-hatire/ftnoir_arduino_type.h
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_arduino_type.h
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_arduino_type.h')
-rw-r--r--tracker-hatire/ftnoir_arduino_type.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/tracker-hatire/ftnoir_arduino_type.h b/tracker-hatire/ftnoir_arduino_type.h
index 57afed63..481e137b 100644
--- a/tracker-hatire/ftnoir_arduino_type.h
+++ b/tracker-hatire/ftnoir_arduino_type.h
@@ -1,5 +1,4 @@
-#ifndef FTNOIR_TARDUINO_TYPE_H
-#define FTNOIR_TARDUINO_TYPE_H
+#pragma once
#include <QDataStream>
@@ -15,7 +14,6 @@ struct TArduinoData
} ;
#pragma pack(pop)
-
inline QDataStream & operator >> ( QDataStream& in, TArduinoData& out )
{
in.setFloatingPointPrecision(QDataStream::SinglePrecision );
@@ -27,6 +25,4 @@ inline QDataStream & operator >> ( QDataStream& in, TArduinoData& out )
return in;
}
-
-
-#endif
+static_assert(sizeof(TArduinoData) == 30, "sizeof packet != 30");