diff options
Diffstat (limited to 'tracker-hatire')
-rw-r--r-- | tracker-hatire/CMakeLists.txt | 3 | ||||
-rw-r--r-- | tracker-hatire/ftnoir_hatcontrols.ui | 84 | ||||
-rw-r--r-- | tracker-hatire/ftnoir_tracker_hat.cpp | 2 | ||||
-rw-r--r-- | tracker-hatire/ftnoir_tracker_hat.h | 3 | ||||
-rw-r--r-- | tracker-hatire/ftnoir_tracker_hat_dialog.cpp | 5 | ||||
-rw-r--r-- | tracker-hatire/ftnoir_tracker_hat_settings.h | 3 | ||||
-rw-r--r-- | tracker-hatire/lang/de_DE.ts | 353 | ||||
-rw-r--r-- | tracker-hatire/lang/nl_NL.ts | 4 | ||||
-rw-r--r-- | tracker-hatire/lang/ru_RU.ts | 4 | ||||
-rw-r--r-- | tracker-hatire/lang/stub.ts | 4 | ||||
-rw-r--r-- | tracker-hatire/lang/zh_CN.ts | 6 | ||||
-rw-r--r-- | tracker-hatire/thread.cpp | 17 | ||||
-rw-r--r-- | tracker-hatire/thread.hpp | 1 |
13 files changed, 445 insertions, 44 deletions
diff --git a/tracker-hatire/CMakeLists.txt b/tracker-hatire/CMakeLists.txt index 5e18eb2d..e8b34a29 100644 --- a/tracker-hatire/CMakeLists.txt +++ b/tracker-hatire/CMakeLists.txt @@ -2,4 +2,7 @@ if(Qt6SerialPort_FOUND) otr_module(tracker-hatire) target_link_libraries(${self} ${Qt6SerialPort_LIBRARIES}) target_include_directories(${self} SYSTEM PUBLIC ${Qt6SerialPort_INCLUDE_DIRS}) + if (WIN32 OR APPLE) + otr_install_lib(Qt6::SerialPort .) + endif() endif() diff --git a/tracker-hatire/ftnoir_hatcontrols.ui b/tracker-hatire/ftnoir_hatcontrols.ui index ca4cefbc..758d8e51 100644 --- a/tracker-hatire/ftnoir_hatcontrols.ui +++ b/tracker-hatire/ftnoir_hatcontrols.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>389</width> - <height>488</height> + <height>497</height> </rect> </property> <property name="minimumSize"> @@ -1136,16 +1136,6 @@ p, li { white-space: pre-wrap; } <string>Serial Parameters</string> </property> <layout class="QGridLayout" name="gridLayout_8"> - <item row="0" column="1"> - <widget class="QComboBox" name="QCB_Serial_baudRate"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> - </item> <item row="3" column="1"> <widget class="QComboBox" name="QCB_Serial_stopBits"> <property name="sizePolicy"> @@ -1163,6 +1153,13 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> + <item row="0" column="0"> + <widget class="QLabel" name="baudRateLabel"> + <property name="text"> + <string>BaudRate:</string> + </property> + </widget> + </item> <item row="2" column="1"> <widget class="QComboBox" name="QCB_Serial_parity"> <property name="sizePolicy"> @@ -1173,13 +1170,10 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="4" column="1"> - <widget class="QComboBox" name="QCB_Serial_flowControl"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item row="1" column="0"> + <widget class="QLabel" name="dataBitsLabel"> + <property name="text"> + <string>Data bits</string> </property> </widget> </item> @@ -1190,6 +1184,16 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> + <item row="0" column="1"> + <widget class="QComboBox" name="QCB_Serial_baudRate"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </item> <item row="2" column="0"> <widget class="QLabel" name="parityLabel"> <property name="text"> @@ -1197,15 +1201,18 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="0" column="0"> - <widget class="QLabel" name="baudRateLabel"> - <property name="text"> - <string>BaudRate:</string> + <item row="1" column="1"> + <widget class="QComboBox" name="QCB_Serial_dataBits"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QComboBox" name="QCB_Serial_dataBits"> + <item row="4" column="1"> + <widget class="QComboBox" name="QCB_Serial_flowControl"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -1214,10 +1221,23 @@ p, li { white-space: pre-wrap; } </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="dataBitsLabel"> + <item row="5" column="0"> + <widget class="QLabel" name="label_6"> <property name="text"> - <string>Data bits</string> + <string>DTR</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QCheckBox" name="QCB_Serial_dtr"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> </property> </widget> </item> @@ -1371,6 +1391,7 @@ p, li { white-space: pre-wrap; } </layout> </widget> <tabstops> + <tabstop>tabWidget</tabstop> <tabstop>cbSerialPort</tabstop> <tabstop>btnZero</tabstop> <tabstop>btnReset</tabstop> @@ -1393,24 +1414,27 @@ p, li { white-space: pre-wrap; } <tabstop>cb_z</tabstop> <tabstop>chkInvertZ</tabstop> <tabstop>le_cmd_init</tabstop> + <tabstop>spb_BeforeInit</tabstop> <tabstop>le_cmd_start</tabstop> + <tabstop>spb_BeforeStart</tabstop> <tabstop>spb_AfterStart</tabstop> <tabstop>le_cmd_stop</tabstop> <tabstop>le_cmd_center</tabstop> <tabstop>le_cmd_zero</tabstop> - <tabstop>le_cmd_reset</tabstop> <tabstop>spb_Fps</tabstop> + <tabstop>le_cmd_reset</tabstop> <tabstop>cb_Endian</tabstop> <tabstop>QCB_Serial_baudRate</tabstop> <tabstop>QCB_Serial_dataBits</tabstop> <tabstop>QCB_Serial_parity</tabstop> <tabstop>QCB_Serial_stopBits</tabstop> <tabstop>QCB_Serial_flowControl</tabstop> + <tabstop>QCB_Serial_dtr</tabstop> + <tabstop>btn_icone</tabstop> + <tabstop>chkEnableLogging</tabstop> <tabstop>lineSend</tabstop> <tabstop>btnSend</tabstop> <tabstop>pteINFO</tabstop> - <tabstop>tabWidget</tabstop> - <tabstop>btn_icone</tabstop> </tabstops> <resources> <include location="ftnoir_hat.qrc"/> diff --git a/tracker-hatire/ftnoir_tracker_hat.cpp b/tracker-hatire/ftnoir_tracker_hat.cpp index b53a9213..9948c30e 100644 --- a/tracker-hatire/ftnoir_tracker_hat.cpp +++ b/tracker-hatire/ftnoir_tracker_hat.cpp @@ -122,7 +122,7 @@ void hatire::data(double *data) } for (unsigned k = 0; k < 3; k++) - HAT.Rot[k] = clamp(HAT.Rot[k], -180, 180); + HAT.Rot[k] = std::clamp(HAT.Rot[k], -180.f, 180.f); const struct { diff --git a/tracker-hatire/ftnoir_tracker_hat.h b/tracker-hatire/ftnoir_tracker_hat.h index b2300556..16e39c7d 100644 --- a/tracker-hatire/ftnoir_tracker_hat.h +++ b/tracker-hatire/ftnoir_tracker_hat.h @@ -32,6 +32,7 @@ public: void send_serial_command(const QByteArray& x); hatire_thread t; + private: TArduinoData ArduinoData {}, HAT {}; QByteArray Begin; @@ -42,8 +43,6 @@ private: int frame_cnt = 0; std::atomic<int> CptError { 0 }; - - static inline QByteArray to_latin1(const QString& str) { return str.toLatin1(); } }; class hatire_metadata : public Metadata diff --git a/tracker-hatire/ftnoir_tracker_hat_dialog.cpp b/tracker-hatire/ftnoir_tracker_hat_dialog.cpp index 7cb25d18..7cede5ca 100644 --- a/tracker-hatire/ftnoir_tracker_hat_dialog.cpp +++ b/tracker-hatire/ftnoir_tracker_hat_dialog.cpp @@ -32,6 +32,10 @@ dialog_hatire::dialog_hatire() : theTracker(nullptr), timer(this) ui.QCB_Serial_baudRate->addItem(QLatin1String("38400"),QSerialPort::Baud38400); ui.QCB_Serial_baudRate->addItem(QLatin1String("57600"),QSerialPort:: Baud57600); ui.QCB_Serial_baudRate->addItem(QLatin1String("115200"),QSerialPort::Baud115200); + ui.QCB_Serial_baudRate->addItem(QLatin1String("230400"),(QSerialPort::BaudRate)230400); + ui.QCB_Serial_baudRate->addItem(QLatin1String("250000"),(QSerialPort::BaudRate)250000); + ui.QCB_Serial_baudRate->addItem(QLatin1String("500000"),(QSerialPort::BaudRate)500000); + ui.QCB_Serial_baudRate->addItem(QLatin1String("1000000"),(QSerialPort::BaudRate)1000000); ui.QCB_Serial_dataBits->clear(); ui.QCB_Serial_dataBits->addItem(QLatin1String("5"), QSerialPort::Data5); @@ -91,6 +95,7 @@ dialog_hatire::dialog_hatire() : theTracker(nullptr), timer(this) tie_setting(s.DelaySeq, ui.spb_AfterStart); tie_setting(s.BigEndian, ui.cb_Endian); + tie_setting(s.pDTR, ui.QCB_Serial_dtr); tie_setting(s.pBaudRate, ui.QCB_Serial_baudRate); tie_setting(s.pDataBits, ui.QCB_Serial_dataBits); diff --git a/tracker-hatire/ftnoir_tracker_hat_settings.h b/tracker-hatire/ftnoir_tracker_hat_settings.h index a41f906d..b17042c7 100644 --- a/tracker-hatire/ftnoir_tracker_hat_settings.h +++ b/tracker-hatire/ftnoir_tracker_hat_settings.h @@ -22,7 +22,7 @@ struct TrackerSettings : opts value<int> DelayInit, DelayStart, DelaySeq; - value<bool> BigEndian, EnableLogging; + value<bool> BigEndian, EnableLogging, pDTR; value<QString> QSerialPortName; @@ -63,6 +63,7 @@ struct TrackerSettings : opts DelaySeq(b, "after-start-delay", 0), BigEndian(b, "is-big-endian", false), EnableLogging(b, "enable-logging", false), + pDTR(b, "data-terminal-ready", false), QSerialPortName(b, "serial-port-name", ""), pBaudRate(b, "baud-rate", QSerialPort::Baud115200), pDataBits(b, "data-bits", QSerialPort::Data8), diff --git a/tracker-hatire/lang/de_DE.ts b/tracker-hatire/lang/de_DE.ts new file mode 100644 index 00000000..0670cfa7 --- /dev/null +++ b/tracker-hatire/lang/de_DE.ts @@ -0,0 +1,353 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.1" language="de_DE"> +<context> + <name>UIHATControls</name> + <message> + <source>Head Arduino Tracker settings FaceTrackNoIR</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>General</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Serial port</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Zero</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Reset</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Axis Configuration</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Associate Axis</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>RotX</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>RotY</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>RotZ</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Enable Axis</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Pitch:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Enable</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Yaw:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Invert</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Y:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Invert Axis</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>X:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>X</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Y</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Z</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Roll:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Z:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Axis</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Status</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Trame per seconde</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>tps</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Info:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>HAT STOPPED</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Command</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Arduino Commands</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Init</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Start</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Command for Start send sequence</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Command for Initialising Arduino</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Command for Stop send sequence</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Center</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Stop</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Command for read Center Gyro arduino</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Command for Reset Arduino</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Command for reset Center Gyro arduino</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Little or Big Endian for <span style=" font-family:'Arial,Geneva,Helvetica,sans-serif'; font-size:medium; color:#000000;">the serialization of byte order</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Arial,Geneva,Helvetica,sans-serif'; font-size:medium; color:#000000;">Arduino is LittleEndian ( unchecked)</span></p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Endian</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><html><head/><body><p>Indicate at opentrack speed sketch FPS to adjust CPU </p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Delay before Init command in ms</span></p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Delay after Init command in ms</span></p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Delay</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Delay after Start Command in ms</span></p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Delay after startup</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Serial Parameters</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Flow control</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>BaudRate:</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Data bits</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Stop bits</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Parity</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>DTR</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>About</source> + <translation type="unfinished"></translation> + </message> + <message> + <source><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt; font-weight:600;">FTNoIR HAT Plugin<br />by FuraX49</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://hatire.sourceforge.net/"><span style=" font-size:8pt; font-weight:600; text-decoration: underline; color:#0000ff;">Manual (external)</span></a></p></body></html></source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Version 1.0.0</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Send</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Disable when not in use, will have a performance impact</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Enable logging to diagnostic file</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>dialog_hatire</name> + <message> + <source>Version %1</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>HAT START</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>HAT STOPPED</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>hatire</name> + <message> + <source>Unable to open ComPort: %1</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Unknown error</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>hatire_metadata</name> + <message> + <source>Hatire Arduino</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>hatire_thread</name> + <message> + <source>Timeout during writing command</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>COM port not open</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Setting serial port name</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Opening serial port</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Port Open</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Port Parameters set</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Raising DTR</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Raising RTS</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Waiting on init</source> + <translation type="unfinished"></translation> + </message> + <message> + <source>Port setup, waiting for HAT frames to process</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> diff --git a/tracker-hatire/lang/nl_NL.ts b/tracker-hatire/lang/nl_NL.ts index a1e613b0..af8cbd2c 100644 --- a/tracker-hatire/lang/nl_NL.ts +++ b/tracker-hatire/lang/nl_NL.ts @@ -269,6 +269,10 @@ p, li { white-space: pre-wrap; } <source>Enable logging to diagnostic file</source> <translation type="unfinished"></translation> </message> + <message> + <source>DTR</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>dialog_hatire</name> diff --git a/tracker-hatire/lang/ru_RU.ts b/tracker-hatire/lang/ru_RU.ts index f7f3024d..16052702 100644 --- a/tracker-hatire/lang/ru_RU.ts +++ b/tracker-hatire/lang/ru_RU.ts @@ -269,6 +269,10 @@ p, li { white-space: pre-wrap; } <source>Enable logging to diagnostic file</source> <translation type="unfinished"></translation> </message> + <message> + <source>DTR</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>dialog_hatire</name> diff --git a/tracker-hatire/lang/stub.ts b/tracker-hatire/lang/stub.ts index 0d22bf81..90c8e616 100644 --- a/tracker-hatire/lang/stub.ts +++ b/tracker-hatire/lang/stub.ts @@ -269,6 +269,10 @@ p, li { white-space: pre-wrap; } <source>Enable logging to diagnostic file</source> <translation type="unfinished"></translation> </message> + <message> + <source>DTR</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>dialog_hatire</name> diff --git a/tracker-hatire/lang/zh_CN.ts b/tracker-hatire/lang/zh_CN.ts index 0d22bf81..d80cfa28 100644 --- a/tracker-hatire/lang/zh_CN.ts +++ b/tracker-hatire/lang/zh_CN.ts @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE TS> -<TS version="2.1"> +<TS version="2.1" language="zh_CN"> <context> <name>UIHATControls</name> <message> @@ -269,6 +269,10 @@ p, li { white-space: pre-wrap; } <source>Enable logging to diagnostic file</source> <translation type="unfinished"></translation> </message> + <message> + <source>DTR</source> + <translation type="unfinished"></translation> + </message> </context> <context> <name>dialog_hatire</name> diff --git a/tracker-hatire/thread.cpp b/tracker-hatire/thread.cpp index 4938e77f..7d61a90a 100644 --- a/tracker-hatire/thread.cpp +++ b/tracker-hatire/thread.cpp @@ -71,7 +71,7 @@ void hatire_thread::Log(const QString& message) { QTextStream out(&flDiagnostics); QString milliSeconds; - milliSeconds = QString("%1").arg(QTime::currentTime().msec(), 3, 10, QChar('0')); + milliSeconds = QStringLiteral("%1").arg(QTime::currentTime().msec(), 3, 10, QChar('0')); // We have a file out << QTime::currentTime().toString() << "." << milliSeconds << ": " << message << "\r\n"; flDiagnostics.close(); @@ -111,7 +111,7 @@ void hatire_thread::teardown_serial() { QByteArray msg; Log("Tracker shut down"); - com_port.write(to_latin1(s.CmdStop)); + com_port.write(s.CmdStop->toUtf8()); if (!com_port.waitForBytesWritten(1000)) { emit serial_debug_info("TimeOut in writing CMD"); @@ -120,7 +120,7 @@ void hatire_thread::teardown_serial() { msg.append("\r\n"); msg.append("SEND '"); - msg.append(s.CmdStop); + msg.append(s.CmdStop->toUtf8()); msg.append("'\r\n"); } emit serial_debug_info(msg); @@ -168,6 +168,7 @@ serial_result hatire_thread::init_serial_port_impl() && com_port.setParity((QSerialPort::Parity)s.pParity) && com_port.setStopBits((QSerialPort::StopBits)s.pStopBits) && com_port.setFlowControl((QSerialPort::FlowControl)s.pFlowControl) + && com_port.setDataTerminalReady(s.pDTR) && com_port.clear(QSerialPort::AllDirections) ) { @@ -200,7 +201,7 @@ serial_result hatire_thread::init_serial_port_impl() } Log(tr("Waiting on init")); qDebug() << QTime::currentTime() << " HAT send INIT "; - sendcmd_str(s.CmdInit); + emit sendcmd_str(s.CmdInit); // Wait init MPU sequence for (int i = 1; i <= s.DelayStart; i+=50) { @@ -208,7 +209,7 @@ serial_result hatire_thread::init_serial_port_impl() } // Send START cmd to IMU qDebug() << QTime::currentTime() << " HAT send START "; - sendcmd_str(s.CmdStart); + emit sendcmd_str(s.CmdStart); // Wait start MPU sequence for (int i = 1; i <=s.DelaySeq; i+=50) @@ -241,13 +242,13 @@ void hatire_thread::serial_info_impl() if (com_port.isOpen()) { msg.append("\r\n"); - msg.append(com_port.portName()); + msg.append(com_port.portName().toUtf8()); msg.append("\r\n"); msg.append("BAUDRATE :"); - msg.append(QString::number(com_port.baudRate())); + msg.append(QString::number(com_port.baudRate()).toLatin1()); msg.append("\r\n"); msg.append("DataBits :"); - msg.append(QString::number(com_port.dataBits())); + msg.append(QString::number(com_port.dataBits()).toLatin1()); msg.append("\r\n"); msg.append("Parity :"); diff --git a/tracker-hatire/thread.hpp b/tracker-hatire/thread.hpp index 5cecbdce..f6bd8d49 100644 --- a/tracker-hatire/thread.hpp +++ b/tracker-hatire/thread.hpp @@ -50,7 +50,6 @@ class hatire_thread : public QThread char buf[1024]; void run() override; - static inline QByteArray to_latin1(const QString& str) { return str.toLatin1(); } void serial_debug_info_str(const QString& str); |