diff options
Diffstat (limited to 'ftnoir_tracker_hatire')
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_arduino_type.h | 21 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_hatcontrols.ui | 1675 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp | 251 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat.h | 59 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp | 121 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h | 37 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp | 57 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp | 48 | ||||
-rw-r--r-- | ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h | 16 |
9 files changed, 887 insertions, 1398 deletions
diff --git a/ftnoir_tracker_hatire/ftnoir_arduino_type.h b/ftnoir_tracker_hatire/ftnoir_arduino_type.h index 4d19043b..7f550579 100644 --- a/ftnoir_tracker_hatire/ftnoir_arduino_type.h +++ b/ftnoir_tracker_hatire/ftnoir_arduino_type.h @@ -1,31 +1,30 @@ #ifndef FTNOIR_TARDUINO_TYPE_H #define FTNOIR_TARDUINO_TYPE_H -// Arduino trame structure +#include <QtGlobal> + +// Arduino frame structure #pragma pack(push,2) struct TArduinoData { quint16 Begin; // Header trame 0xAAAA; - quint16 Code; // 0->999 Num Trame >=2000 Info >=3000 Init >=5000 Start Command >=9000 Error + quint16 Code; // 0->999 Num Frame >=2000 Info >=3000 Init >=5000 Start Command >=9000 Error float Gyro[3]; float Acc[3]; - quint16 End; // End trame 0x5555; + quint16 End; // End frame 0x5555; } ; #pragma pack(pop) - inline QDataStream & operator >> ( QDataStream& in, TArduinoData& out ) { in.setByteOrder(QDataStream::LittleEndian ); in.setFloatingPointPrecision(QDataStream::SinglePrecision ); - in >> (quint16)out.Begin >> (quint16)out.Code - >> (float)out.Gyro[0] >> (float)out.Gyro[1] >> (float)out.Gyro[2] - >> (float)out.Acc[0] >> (float)out.Acc[1] >> (float)out.Acc[2] - >> (quint16)out.End; + in >> out.Begin >> out.Code + >> out.Gyro[0] >> out.Gyro[1] >> out.Gyro[2] + >> out.Acc[0] >> out.Acc[1] >> out.Acc[2] + >> out.End; return in; } - - -#endif
\ No newline at end of file +#endif diff --git a/ftnoir_tracker_hatire/ftnoir_hatcontrols.ui b/ftnoir_tracker_hatire/ftnoir_hatcontrols.ui index 86f9e48a..8882fffb 100644 --- a/ftnoir_tracker_hatire/ftnoir_hatcontrols.ui +++ b/ftnoir_tracker_hatire/ftnoir_hatcontrols.ui @@ -41,1015 +41,784 @@ <property name="autoFillBackground"> <bool>false</bool> </property> - <widget class="QWidget" name="layoutWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>480</y> - <width>361</width> - <height>27</height> - </rect> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_frm_dialog"> - <item> - <widget class="QPushButton" name="btnOK"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>80</width> - <height>25</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>25</height> - </size> - </property> - <property name="text"> - <string>OK</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnSave"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>25</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>25</height> - </size> - </property> - <property name="text"> - <string>Save</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btnCancel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>80</width> - <height>25</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>80</width> - <height>25</height> - </size> - </property> - <property name="text"> - <string>Cancel</string> - </property> - </widget> - </item> - </layout> - </widget> - <widget class="QTabWidget" name="tabWidget"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>360</width> - <height>470</height> - </rect> - </property> - <property name="minimumSize"> - <size> - <width>360</width> - <height>470</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>360</width> - <height>470</height> - </size> - </property> - <property name="currentIndex"> - <number>0</number> - </property> - <property name="usesScrollButtons"> - <bool>true</bool> - </property> - <widget class="QWidget" name="tab_config"> - <attribute name="icon"> - <iconset resource="ftnoir_hat.qrc"> - <normaloff>:/images/hat.ico</normaloff>:/images/hat.ico</iconset> - </attribute> - <attribute name="title"> - <string>General</string> - </attribute> - <widget class="QGroupBox" name="groupBox_status"> - <property name="geometry"> - <rect> - <x>10</x> - <y>350</y> - <width>331</width> - <height>91</height> - </rect> - </property> - <property name="title"> - <string>Information</string> - </property> - <widget class="QWidget" name="formLayoutWidget"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>311</width> - <height>51</height> - </rect> - </property> - <layout class="QFormLayout" name="formLayout_status"> - <property name="fieldGrowthPolicy"> - <enum>QFormLayout::AllNonFixedFieldsGrow</enum> - </property> - <property name="horizontalSpacing"> - <number>10</number> - </property> - <property name="verticalSpacing"> - <number>10</number> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="bottomMargin"> - <number>0</number> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="lab_tps"> - <property name="minimumSize"> - <size> - <width>31</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>60</width> - <height>13</height> - </size> - </property> - <property name="toolTip"> - <string>Trame per seconde</string> - </property> - <property name="text"> - <string>tps :</string> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="lab_status"> - <property name="maximumSize"> - <size> - <width>60</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Status :</string> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="lab_vstatus"> - <property name="minimumSize"> - <size> - <width>170</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>60</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QLabel" name="lab_vtps"> - <property name="minimumSize"> - <size> - <width>31</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>60</width> - <height>13</height> - </size> - </property> - <property name="text"> - <string>00</string> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - <widget class="QGroupBox" name="groupBox_3"> - <property name="geometry"> - <rect> - <x>10</x> - <y>130</y> - <width>331</width> - <height>211</height> - </rect> - </property> + <layout class="QGridLayout" name="gridLayout_5"> + <item row="0" column="0" colspan="3"> + <widget class="QTabWidget" name="tabWidget"> <property name="minimumSize"> <size> - <width>0</width> - <height>106</height> + <width>360</width> + <height>470</height> </size> </property> - <property name="title"> - <string>Axis Configuration</string> + <property name="maximumSize"> + <size> + <width>360</width> + <height>470</height> + </size> </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + <property name="currentIndex"> + <number>1</number> </property> - <widget class="QWidget" name="layoutWidget_Configuration"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>311</width> - <height>181</height> - </rect> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <property name="sizeConstraint"> - <enum>QLayout::SetMinAndMaxSize</enum> - </property> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>0</number> - </property> - <property name="spacing"> - <number>6</number> - </property> - <item row="3" column="2"> - <widget class="QCheckBox" name="chkEnableYaw"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Enable Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QCheckBox" name="chkEnableRoll"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Enable Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="3" column="3"> - <widget class="QComboBox" name="cb_yaw"> - <property name="toolTip"> - <string>Associate Axis</string> - </property> - <item> - <property name="text"> - <string>RotX</string> - </property> - </item> - <item> - <property name="text"> - <string>RotY</string> - </property> - </item> - <item> - <property name="text"> - <string>RotZ</string> - </property> - </item> - </widget> - </item> - <item row="3" column="1"> - <widget class="QLabel" name="label_yaw"> - <property name="text"> - <string>Yaw:</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QComboBox" name="cb_roll"> - <property name="toolTip"> - <string>Associate Axis</string> - </property> - <item> - <property name="text"> - <string>RotX</string> - </property> - </item> - <item> - <property name="text"> - <string>RotY</string> - </property> - </item> - <item> - <property name="text"> - <string>RotZ</string> - </property> - </item> - </widget> - </item> - <item row="2" column="3"> - <widget class="QComboBox" name="cb_pitch"> - <property name="toolTip"> - <string>Associate Axis</string> - </property> - <item> - <property name="text"> - <string>RotX</string> - </property> - </item> - <item> - <property name="text"> - <string>RotY</string> - </property> - </item> - <item> - <property name="text"> - <string>RotZ</string> - </property> - </item> - </widget> - </item> - <item row="2" column="2"> - <widget class="QCheckBox" name="chkEnablePitch"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Enable Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QLabel" name="label_pitch"> - <property name="text"> - <string>Pitch:</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QLabel" name="label_roll"> - <property name="text"> - <string>Roll:</string> - </property> - </widget> - </item> - <item row="1" column="4"> - <widget class="QCheckBox" name="chkInvertRoll"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Invert Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="2" column="4"> - <widget class="QCheckBox" name="chkInvertPitch"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Invert Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="3" column="4"> - <widget class="QCheckBox" name="chkInvertYaw"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Invert Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> + <property name="usesScrollButtons"> + <bool>true</bool> + </property> + <widget class="QWidget" name="tab_config"> + <attribute name="icon"> + <iconset resource="ftnoir_hat.qrc"> + <normaloff>:/images/hat.ico</normaloff>:/images/hat.ico</iconset> + </attribute> + <attribute name="title"> + <string>General</string> + </attribute> + <layout class="QGridLayout" name="gridLayout_4"> + <item row="0" column="0"> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> <string/> </property> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="2" column="0"> + <widget class="QPushButton" name="btnCenter"> + <property name="minimumSize"> + <size> + <width>80</width> + <height>20</height> + </size> + </property> + <property name="text"> + <string>Center</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="btnReset"> + <property name="minimumSize"> + <size> + <width>80</width> + <height>20</height> + </size> + </property> + <property name="text"> + <string>Reset</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="cbSerialPort"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>100</width> + <height>16777215</height> + </size> + </property> + <property name="editable"> + <bool>false</bool> + </property> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToMinimumContentsLength</enum> + </property> + <property name="modelColumn"> + <number>0</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_info"> + <property name="text"> + <string>Arduino serial port</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> </widget> </item> - <item row="0" column="2"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Enable</string> - </property> - </widget> - </item> - <item row="0" column="3"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Axis</string> - </property> - </widget> - </item> - <item row="0" column="4"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Invert</string> - </property> - </widget> - </item> - <item row="4" column="1"> - <widget class="QLabel" name="label_x"> - <property name="text"> - <string>X:</string> - </property> - </widget> - </item> - <item row="4" column="2"> - <widget class="QCheckBox" name="chkEnableX"> - <property name="maximumSize"> + <item row="1" column="0"> + <widget class="QGroupBox" name="groupBox_3"> + <property name="minimumSize"> <size> - <width>20</width> - <height>16777215</height> + <width>0</width> + <height>106</height> </size> </property> - <property name="toolTip"> - <string>Enable Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> - </property> + <property name="title"> + <string>Axis selection</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="6" column="2"> + <widget class="QCheckBox" name="chkEnableZ"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Enable Axis</string> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="4" column="4"> + <widget class="QCheckBox" name="chkInvertX"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Invert Axis</string> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="4" column="3"> + <widget class="QComboBox" name="cb_x"> + <property name="toolTip"> + <string>Associate Axis</string> + </property> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + </widget> + </item> + <item row="4" column="2"> + <widget class="QCheckBox" name="chkEnableX"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Enable Axis</string> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_x"> + <property name="text"> + <string>X</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_pitch"> + <property name="text"> + <string>Pitch</string> + </property> + </widget> + </item> + <item row="6" column="0"> + <widget class="QLabel" name="label_z"> + <property name="text"> + <string>Z</string> + </property> + </widget> + </item> + <item row="6" column="4"> + <widget class="QCheckBox" name="chkInvertZ"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Invert Axis</string> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="3" column="3"> + <widget class="QComboBox" name="cb_yaw"> + <property name="toolTip"> + <string>Associate Axis</string> + </property> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + <item row="2" column="2"> + <widget class="QCheckBox" name="chkEnablePitch"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Enable Axis</string> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="6" column="3"> + <widget class="QComboBox" name="cb_z"> + <property name="toolTip"> + <string>Associate Axis</string> + </property> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + </widget> + </item> + <item row="3" column="4"> + <widget class="QCheckBox" name="chkInvertYaw"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Invert Axis</string> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="5" column="2"> + <widget class="QCheckBox" name="chkEnableY"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Enable Axis</string> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="2" column="4"> + <widget class="QCheckBox" name="chkInvertPitch"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Invert Axis</string> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QComboBox" name="cb_roll"> + <property name="toolTip"> + <string>Associate Axis</string> + </property> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + <item row="3" column="2"> + <widget class="QCheckBox" name="chkEnableYaw"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Enable Axis</string> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="0" column="3"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Input</string> + </property> + </widget> + </item> + <item row="0" column="4"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Invert</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="label_yaw"> + <property name="text"> + <string>Yaw</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <widget class="QCheckBox" name="chkEnableRoll"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Enable Axis</string> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="5" column="3"> + <widget class="QComboBox" name="cb_y"> + <property name="toolTip"> + <string>Associate Axis</string> + </property> + <item> + <property name="text"> + <string>X</string> + </property> + </item> + <item> + <property name="text"> + <string>Y</string> + </property> + </item> + <item> + <property name="text"> + <string>Z</string> + </property> + </item> + </widget> + </item> + <item row="2" column="3"> + <widget class="QComboBox" name="cb_pitch"> + <property name="toolTip"> + <string>Associate Axis</string> + </property> + <item> + <property name="text"> + <string>Yaw</string> + </property> + </item> + <item> + <property name="text"> + <string>Pitch</string> + </property> + </item> + <item> + <property name="text"> + <string>Roll</string> + </property> + </item> + </widget> + </item> + <item row="1" column="4"> + <widget class="QCheckBox" name="chkInvertRoll"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Invert Axis</string> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLabel" name="label_y"> + <property name="text"> + <string>Y</string> + </property> + </widget> + </item> + <item row="5" column="4"> + <widget class="QCheckBox" name="chkInvertY"> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="toolTip"> + <string>Invert Axis</string> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_roll"> + <property name="text"> + <string>Roll</string> + </property> + </widget> + </item> + <item row="0" column="2"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Enable</string> + </property> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Output</string> + </property> + </widget> + </item> + </layout> </widget> </item> - <item row="4" column="3"> - <widget class="QComboBox" name="cb_x"> - <property name="toolTip"> - <string>Associate Axis</string> - </property> - <item> - <property name="text"> - <string>X</string> - </property> - </item> - <item> - <property name="text"> - <string>Y</string> - </property> - </item> - <item> - <property name="text"> - <string>Z</string> - </property> - </item> + <item row="2" column="0"> + <widget class="QGroupBox" name="groupBox_status"> + <property name="title"> + <string>Information</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="lab_tps"> + <property name="minimumSize"> + <size> + <width>31</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>13</height> + </size> + </property> + <property name="toolTip"> + <string>Trame per seconde</string> + </property> + <property name="text"> + <string>tps :</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="lab_vstatus"> + <property name="minimumSize"> + <size> + <width>170</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="lab_vtps"> + <property name="minimumSize"> + <size> + <width>31</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>60</width> + <height>13</height> + </size> + </property> + <property name="text"> + <string>00</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="lab_status"> + <property name="maximumSize"> + <size> + <width>60</width> + <height>16777215</height> + </size> + </property> + <property name="text"> + <string>Status :</string> + </property> + </widget> + </item> + </layout> </widget> </item> - <item row="4" column="4"> - <widget class="QCheckBox" name="chkInvertX"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Invert Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> + </layout> + </widget> + <widget class="QWidget" name="tab_about"> + <attribute name="title"> + <string>About</string> + </attribute> + <layout class="QFormLayout" name="formLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label_10"> <property name="text"> - <string/> + <string><!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-weight:600;">FTNoIR HAT Plugin<br />Version 1.0</span></p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">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-weight:600; text-decoration: underline; color:#0000ff;">Manual (external)</span></a></p></body></html></string> </property> - </widget> - </item> - <item row="5" column="1"> - <widget class="QLabel" name="label_y"> - <property name="text"> - <string>Y:</string> + <property name="openExternalLinks"> + <bool>true</bool> </property> </widget> </item> - <item row="5" column="2"> - <widget class="QCheckBox" name="chkEnableY"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Enable Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> + <item row="0" column="1"> + <widget class="QLabel" name="label_35"> <property name="text"> <string/> </property> - </widget> - </item> - <item row="5" column="3"> - <widget class="QComboBox" name="cb_y"> - <property name="toolTip"> - <string>Associate Axis</string> + <property name="pixmap"> + <pixmap resource="ftnoir_hat.qrc">:/images/hat_logo.png</pixmap> </property> - <item> - <property name="text"> - <string>X</string> - </property> - </item> - <item> - <property name="text"> - <string>Y</string> - </property> - </item> - <item> - <property name="text"> - <string>Z</string> - </property> - </item> </widget> </item> - <item row="5" column="4"> - <widget class="QCheckBox" name="chkInvertY"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Invert Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string/> - </property> - </widget> + <item row="2" column="0" colspan="2"> + <widget class="QLineEdit" name="lineSend"/> </item> - <item row="6" column="1"> - <widget class="QLabel" name="label_z"> - <property name="text"> - <string>Z:</string> + <item row="4" column="0" colspan="2"> + <widget class="QPlainTextEdit" name="pteINFO"> + <property name="readOnly"> + <bool>true</bool> </property> - </widget> - </item> - <item row="6" column="2"> - <widget class="QCheckBox" name="chkEnableZ"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Enable Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="text"> - <string/> + <property name="maximumBlockCount"> + <number>800</number> </property> </widget> </item> - <item row="6" column="3"> - <widget class="QComboBox" name="cb_z"> - <property name="toolTip"> - <string>Associate Axis</string> - </property> - <item> - <property name="text"> - <string>X</string> - </property> - </item> - <item> - <property name="text"> - <string>Y</string> - </property> - </item> - <item> - <property name="text"> - <string>Z</string> - </property> - </item> - </widget> - </item> - <item row="6" column="4"> - <widget class="QCheckBox" name="chkInvertZ"> - <property name="maximumSize"> - <size> - <width>20</width> - <height>16777215</height> - </size> - </property> - <property name="toolTip"> - <string>Invert Axis</string> - </property> - <property name="layoutDirection"> - <enum>Qt::LeftToRight</enum> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> + <item row="3" column="1"> + <widget class="QPushButton" name="btnSend"> <property name="text"> - <string/> + <string>Send</string> </property> </widget> </item> - <item row="0" column="5"> - <spacer name="horizontalSpacer_12"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>16</height> - </size> - </property> - </spacer> - </item> - <item row="0" column="0"> - <spacer name="horizontalSpacer_11"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>16</height> - </size> - </property> - </spacer> - </item> </layout> </widget> </widget> - <widget class="QWidget" name="layoutWidget6"> - <property name="geometry"> - <rect> - <x>10</x> - <y>90</y> - <width>331</width> - <height>31</height> - </rect> + </item> + <item row="1" column="0"> + <widget class="QPushButton" name="btnOK"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <layout class="QHBoxLayout" name="horizontalLayout__arduino"> - <item> - <spacer name="horizontalSpacer_10"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>13</width> - <height>16</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="btnCenter"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>Center</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_8"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>13</width> - <height>16</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QPushButton" name="btnReset"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>20</height> - </size> - </property> - <property name="text"> - <string>Reset</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_9"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>13</width> - <height>16</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="layoutWidget1"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>331</width> - <height>31</height> - </rect> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QLabel" name="label_5"> - <property name="maximumSize"> - <size> - <width>60</width> - <height>16777215</height> - </size> - </property> - <property name="text"> - <string>Serial Port :</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="cbSerialPort"> - <property name="maximumSize"> - <size> - <width>100</width> - <height>16777215</height> - </size> - </property> - <property name="editable"> - <bool>false</bool> - </property> - <property name="sizeAdjustPolicy"> - <enum>QComboBox::AdjustToMinimumContentsLength</enum> - </property> - <property name="modelColumn"> - <number>0</number> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_5"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Minimum</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - <widget class="QWidget" name="horizontalLayoutWidget"> - <property name="geometry"> - <rect> - <x>10</x> - <y>50</y> - <width>331</width> - <height>31</height> - </rect> + <property name="minimumSize"> + <size> + <width>80</width> + <height>25</height> + </size> </property> - <layout class="QHBoxLayout" name="horizontalLayout_serial"> - <property name="leftMargin"> - <number>7</number> - </property> - <item> - <widget class="QLabel" name="label_info"> - <property name="text"> - <string>Choose the Serial Com port where is connected ARDUINO.</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </widget> - <widget class="QWidget" name="tab_about"> - <attribute name="title"> - <string>About</string> - </attribute> - <widget class="QLabel" name="label_10"> - <property name="geometry"> - <rect> - <x>10</x> - <y>20</y> - <width>111</width> - <height>111</height> - </rect> + <property name="maximumSize"> + <size> + <width>80</width> + <height>25</height> + </size> </property> <property name="text"> - <string><!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-weight:600;">FTNoIR HAT Plugin<br />Version 1.0</span></p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">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-weight:600; text-decoration: underline; color:#0000ff;">Manual (external)</span></a></p></body></html></string> - </property> - <property name="openExternalLinks"> - <bool>true</bool> + <string>OK</string> </property> </widget> - <widget class="QLabel" name="label_35"> - <property name="geometry"> - <rect> - <x>200</x> - <y>20</y> - <width>128</width> - <height>128</height> - </rect> + </item> + <item row="1" column="1"> + <widget class="QPushButton" name="btnSave"> + <property name="minimumSize"> + <size> + <width>80</width> + <height>25</height> + </size> </property> - <property name="text"> - <string/> + <property name="maximumSize"> + <size> + <width>80</width> + <height>25</height> + </size> </property> - <property name="pixmap"> - <pixmap resource="ftnoir_hat.qrc">:/images/hat_logo.png</pixmap> + <property name="text"> + <string>Save</string> </property> </widget> - <widget class="QPlainTextEdit" name="pteINFO"> - <property name="geometry"> - <rect> - <x>10</x> - <y>190</y> - <width>331</width> - <height>251</height> - </rect> - </property> - <property name="readOnly"> - <bool>true</bool> + </item> + <item row="1" column="2"> + <widget class="QPushButton" name="btnCancel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="maximumBlockCount"> - <number>800</number> - </property> - </widget> - <widget class="QLineEdit" name="lineSend"> - <property name="geometry"> - <rect> - <x>10</x> - <y>160</y> - <width>241</width> - <height>20</height> - </rect> + <property name="minimumSize"> + <size> + <width>80</width> + <height>25</height> + </size> </property> - </widget> - <widget class="QPushButton" name="btnSend"> - <property name="geometry"> - <rect> - <x>260</x> - <y>160</y> - <width>75</width> - <height>23</height> - </rect> + <property name="maximumSize"> + <size> + <width>80</width> + <height>25</height> + </size> </property> <property name="text"> - <string>Send</string> + <string>Cancel</string> </property> </widget> - </widget> - </widget> + </item> + </layout> </widget> <tabstops> <tabstop>btnCancel</tabstop> diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp index e961a10f..99baf75b 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.cpp @@ -1,67 +1,45 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ - +/* code by Furax49, awaiting copyright information */ #include "ftnoir_tracker_hat.h" +#include "facetracknoir/global-settings.h" #include <QMessageBox> #include <QDebug> -#include <QCoreApplication> -FTNoIR_Tracker::FTNoIR_Tracker() +FTNoIR_Tracker::FTNoIR_Tracker() : + SerialPort(nullptr), + stop(false) { - SerialPort = NULL; - waitTimeout = 1000; TrackerSettings settings; settings.load_ini(); applysettings(settings); + //ListErrInf = new QList<QString>(); - // Create events - m_StopThread = CreateEvent(0, TRUE, FALSE, 0); - m_WaitThread = CreateEvent(0, TRUE, FALSE, 0); - - ListErrInf = new QList<QString>(); - - // prepare & reserve QByteArray datagram.reserve(30); + qDebug() << "FTNoIR_Tracker::Initialize() Open SerialPort"; + SerialPort = new QSerialPort(sSerialPortName); + if (SerialPort->open(QIODevice::ReadWrite | QIODevice::Unbuffered ) == true) { + SerialPort->flush(); + SerialPort->setBaudRate(115200); + SerialPort->setParity(QSerialPort::NoParity); + SerialPort->setDataBits(QSerialPort::Data8); + SerialPort->setStopBits(QSerialPort::OneStop); + SerialPort->setFlowControl(QSerialPort::NoFlowControl); + //SerialPort->setTimeout(waitTimeout); + //SerialPort->setQueryMode(QextSerialPort::EventDriven); //Polling + SerialPort->putChar('S'); + } + else { + QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to open SerialPort",QMessageBox::Ok,QMessageBox::NoButton); + delete SerialPort; + SerialPort = NULL; + } } FTNoIR_Tracker::~FTNoIR_Tracker() { - // Trigger thread to stop - ::SetEvent(m_StopThread); - - // Wait until thread finished - if (isRunning()) { - ::WaitForSingleObject(m_WaitThread, INFINITE); - } - - // Close handles - ::CloseHandle(m_StopThread); - ::CloseHandle(m_WaitThread); - + stop = true; + wait(); if (SerialPort!=NULL) { if (SerialPort->isOpen() ) { SerialPort->putChar('s'); //Send STOP to Arduino @@ -104,163 +82,92 @@ void FTNoIR_Tracker::reset() { //send command to Arduino void FTNoIR_Tracker::sendcmd(QString* cmd) { - QReadLocker locker(&rwlock); + QMutexLocker locker(&lock); QByteArray bytes; if (SerialPort!=NULL) { if (SerialPort->isOpen() ) { - bytes.append(cmd->toAscii()); - SerialPort->write(bytes); + bytes.append(cmd->toLatin1()); + SerialPort->write(bytes); } } } // return FPS and last status -void FTNoIR_Tracker::get_info(QString* info, int* tps ){ - QReadLocker locker(&rwlock); +void FTNoIR_Tracker::get_info(QString*, int* tps ){ + QMutexLocker locker(&lock); *tps=HAT.Code; +#if 0 if (ListErrInf->size()>0) { *info=ListErrInf->takeFirst(); } else { *info= QString(); } +#endif } /** QThread run @override **/ void FTNoIR_Tracker::run() { - // - // Read the data that was received. - // - forever { - - // Check event for stop thread - if(::WaitForSingleObject(m_StopThread, 0) == WAIT_OBJECT_0) - { - // Set event - ::SetEvent(m_WaitThread); - qDebug() << "FTNoIR_Tracker::run() terminated run()"; - return; - } - if (SerialPort->bytesAvailable()>=30) { - QWriteLocker locker(&rwlock); + if (!SerialPort) + return; + while (!stop) + { + if (SerialPort->bytesAvailable()>=30) + { + QMutexLocker locker(&lock); datagram.clear(); datagram=SerialPort->read(30); - QDataStream datastream(datagram); - datastream>>ArduinoData; - - if (ArduinoData.Begin==0xAAAA && ArduinoData.End==0x5555 ) { - if (ArduinoData.Code <= 1000) { + QDataStream datastream(datagram); + datastream >> ArduinoData; + if (ArduinoData.Begin==0xAAAA && ArduinoData.End==0x5555 ) + { + if (ArduinoData.Code <= 1000) + { HAT=ArduinoData; - } else { - ListErrInf->push_back(QString::fromAscii(datagram.mid(4,24),24)) ; - } + } } else { SerialPort->read(1); } } - //for lower cpu load usleep(10000); } } -void FTNoIR_Tracker::Initialize( QFrame *videoframe ) -{ - qDebug() << "FTNoIR_Tracker::Initialize says: Starting "; - - // - // Create SerialPort if they don't exist already. - // They must be created here, because they must be in the new thread (FTNoIR_Tracker::run()) - // - - if (SerialPort == NULL) { - qDebug() << "FTNoIR_Tracker::Initialize() Open SerialPort"; - SerialPort = new QextSerialPort(sSerialPortName); - if (SerialPort->open(QIODevice::ReadWrite | QIODevice::Unbuffered ) == true) { - SerialPort->flush(); - SerialPort->setBaudRate(BAUD115200); - SerialPort->setParity(PAR_NONE); - SerialPort->setDataBits(DATA_8); - SerialPort->setStopBits(STOP_1); - SerialPort->setFlowControl(FLOW_OFF); - SerialPort->setTimeout(waitTimeout); - SerialPort->setQueryMode(QextSerialPort::EventDriven); //Polling - // Send START to arduino - SerialPort->putChar('S'); - } - else { - QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to open SerialPort",QMessageBox::Ok,QMessageBox::NoButton); - delete SerialPort; - SerialPort = NULL; - } - } - return; -} - -void FTNoIR_Tracker::StartTracker( HWND parent_window ) +void FTNoIR_Tracker::StartTracker( QFrame* ) { start( QThread::TimeCriticalPriority ); return; } -void FTNoIR_Tracker::StopTracker( bool exit ) +bool FTNoIR_Tracker::GiveHeadPoseData(double* data) { - // - // OK, the thread is not stopped, doing this. That might be dangerous anyway... - // - if (exit || !exit) return; - return; -} + QMutexLocker locker(&lock); -// -// Return 6DOF info -// -bool FTNoIR_Tracker::GiveHeadPoseData(THeadPoseData *data) -{ - QReadLocker locker(&rwlock); - data->frame_number = HAT.Code; + const bool inversions[] = { + bInvertX, bInvertY, bInvertZ, bInvertYaw, bInvertPitch, bInvertRoll + }; - if (bEnableYaw) { - if (bInvertYaw ) data->yaw = HAT.Gyro[iYawAxe] * -1.0f; - else data->yaw = HAT.Gyro[iYawAxe]; - } - - if (bEnablePitch) { - if (bInvertPitch)data->pitch = HAT.Gyro[iPitchAxe] * -1.0f; - else data->pitch = HAT.Gyro[iPitchAxe]; - } - - if (bEnableRoll) { - if (bInvertRoll) data->roll = HAT.Gyro[iRollAxe] * -1.0f; - else data->roll = HAT.Gyro[iRollAxe]; - } - - if (bEnableX) { - if (bInvertX) data->x = HAT.Acc[iXAxe]* -1.0f; - else data->x = HAT.Acc[iXAxe]; - } + const bool enablement[] = { + bEnableX, bEnableY, bEnableZ, bEnableYaw, bEnablePitch, bEnableRoll + }; - if (bEnableY) { - if (bInvertY) data->y = HAT.Acc[iYAxe]* -1.0f; - else data->y = HAT.Acc[iYAxe]; - } + const int axes[] = { + iXAxis, iYAxis, iZAxis, iYawAxis, iPitchAxis, iRollAxis + }; - if (bEnableZ) { - if (bInvertZ) data->z = HAT.Acc[iZAxe]* -1.0f; - else data->z = HAT.Acc[iZAxe]; - } + for (int i = 0; i < 6; i++) + { + if (enablement[i]) + data[i] = HAT.Gyro[axes[i]] * (inversions[i] ? -1 : 1); + } - return true; + return true; } - - -// -// Apply modification Settings -// void FTNoIR_Tracker::applysettings(const TrackerSettings& settings){ qDebug()<<"Tracker:: Applying settings"; - QReadLocker locker(&rwlock); + QMutexLocker locker(&lock); sSerialPortName= settings.SerialPortName; bEnableRoll = settings.EnableRoll; @@ -278,27 +185,15 @@ void FTNoIR_Tracker::applysettings(const TrackerSettings& settings){ bInvertZ = settings.InvertZ; - iRollAxe= settings.RollAxe; - iPitchAxe= settings.PitchAxe; - iYawAxe= settings.YawAxe; - iXAxe= settings.XAxe; - iYAxe= settings.YAxe; - iZAxe= settings.ZAxe; + iRollAxis= settings.RollAxis; + iPitchAxis= settings.PitchAxis; + iYawAxis= settings.YawAxis; + iXAxis= settings.XAxis; + iYAxis= settings.YAxis; + iZAxis= settings.ZAxis; } - - - -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Tracker object. - -// Export both decorated and undecorated names. -// GetTracker - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetTracker@0 - Common name decoration for __stdcall functions in C language. -#pragma comment(linker, "/export:GetTracker=_GetTracker@0") - -FTNOIR_TRACKER_BASE_EXPORT ITrackerPtr __stdcall GetTracker() +extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor() { return new FTNoIR_Tracker; } diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h index 54e67f48..af583d11 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat.h +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat.h @@ -1,33 +1,28 @@ #ifndef FTNOIR_TRACKER_HAT_H #define FTNOIR_TRACKER_HAT_H -#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h" +#include "facetracknoir/global-settings.h" +#include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ftnoir_tracker_hat_settings.h" #include "ftnoir_arduino_type.h" -#include <QExtSerialPort\qextserialport.h> -#include <QExtSerialPort\qextserialenumerator.h> +#include <QtSerialPort/QSerialPort> #include <QThread> -#include <QReadWriteLock> #include <QTimer> #include <QSettings> -#include "Windows.h" -#include "math.h" - -class QextSerialPort; -class QExtSerialEnumerator; +#include <QMutex> +#include <QMutexLocker> +#include <cmath> class FTNoIR_Tracker : public ITracker, QThread { public: FTNoIR_Tracker(); - ~FTNoIR_Tracker(); + virtual ~FTNoIR_Tracker() virt_override; - void Initialize( QFrame *videoframe ); - void StartTracker( HWND parent_window ); - void StopTracker( bool exit ); - bool GiveHeadPoseData(THeadPoseData *data); + virtual void StartTracker( QFrame* frame ) virt_override; + virtual bool GiveHeadPoseData(double *data) virt_override; void applysettings(const TrackerSettings& settings); void notifyCenter(); @@ -39,18 +34,12 @@ public: protected: void run(); // qthread override run method - private: - // Handles to neatly terminate thread... - HANDLE m_StopThread; - HANDLE m_WaitThread; - TArduinoData ArduinoData, HAT ; // Trame from Arduino QByteArray datagram; - QextSerialPort *SerialPort; - QReadWriteLock rwlock; - QList<QString>* ListErrInf ; - int waitTimeout; + QSerialPort* SerialPort; + volatile bool stop; + QMutex lock; QString sSerialPortName; // Port serial name bool bEnableRoll; bool bEnablePitch; @@ -67,28 +56,22 @@ private: bool bInvertZ; - int iRollAxe; - int iPitchAxe; - int iYawAxe; - int iXAxe; - int iYAxe; - int iZAxe; + int iRollAxis; + int iPitchAxis; + int iYawAxis; + int iXAxis; + int iYAxis; + int iZAxis; }; - -//******************************************************************************************************* -// FaceTrackNoIR Tracker DLL. Functions used to get general info on the Tracker -//******************************************************************************************************* -class FTNoIR_TrackerDll : public ITrackerDll +class FTNoIR_TrackerDll : public Metadata { public: FTNoIR_TrackerDll(); ~FTNoIR_TrackerDll(); - void Initialize(); - - void getFullName(QString *strToBeFilled); + void getFullName(QString *strToBeFilled); void getShortName(QString *strToBeFilled); void getDescription(QString *strToBeFilled); void getIcon(QIcon *icon); @@ -99,4 +82,4 @@ private: QString trackerDescription; }; -#endif // FTNOIR_TRACKER_HAT_H
\ No newline at end of file +#endif // FTNOIR_TRACKER_HAT_H diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp index b889341f..1fa482c7 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.cpp @@ -1,32 +1,9 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ #include "ftnoir_tracker_hat.h" #include "ftnoir_tracker_hat_dialog.h" #include <QMessageBox> #include <QDebug> +#include <QtSerialPort/QSerialPortInfo> //******************************************************************************************************* // FaceTrackNoIR Client Settings-dialog. @@ -35,21 +12,16 @@ // // Constructor for server-settings-dialog // -TrackerControls::TrackerControls() : settingsDirty(false), theTracker(NULL), timer(this), -QWidget() +TrackerControls::TrackerControls() : pre_frame(0), theTracker(NULL), settingsDirty(false), timer(this) { - settingsDirty= false; - theTracker = NULL; ui.setupUi( this ); - pre_trame = 0; settings.load_ini(); - // make SerialPort list - foreach (QextPortInfo PortInfo , QextSerialEnumerator::getPorts() ) { - ui.cbSerialPort->addItem(PortInfo.portName); + foreach (QSerialPortInfo PortInfo , QSerialPortInfo::availablePorts() ) { + ui.cbSerialPort->addItem(PortInfo.portName()); } - // Stop if no SerialPort dispo + if (ui.cbSerialPort->count()<1) { QMessageBox::critical(this,"FaceTrackNoIR Error", "No SerialPort avaible"); } else { @@ -77,21 +49,18 @@ QWidget() ui.chkInvertY->setChecked(settings.InvertY); ui.chkInvertZ->setChecked(settings.InvertZ); - - ui.cb_roll->setCurrentIndex(settings.RollAxe); - ui.cb_pitch->setCurrentIndex(settings.PitchAxe); - ui.cb_yaw->setCurrentIndex(settings.YawAxe); - ui.cb_x->setCurrentIndex(settings.XAxe); - ui.cb_y->setCurrentIndex(settings.YAxe); - ui.cb_z->setCurrentIndex(settings.ZAxe); - + ui.cb_roll->setCurrentIndex(settings.RollAxis); + ui.cb_pitch->setCurrentIndex(settings.PitchAxis); + ui.cb_yaw->setCurrentIndex(settings.YawAxis); + ui.cb_x->setCurrentIndex(settings.XAxis); + ui.cb_y->setCurrentIndex(settings.YAxis); + ui.cb_z->setCurrentIndex(settings.ZAxis); // Connect Qt signals to member-functions connect(ui.btnOK, SIGNAL(clicked()), this, SLOT(doOK())); connect(ui.btnCancel, SIGNAL(clicked()), this, SLOT(doCancel())); connect(ui.btnSave, SIGNAL(clicked()), this, SLOT(doSave())); - connect(ui.cbSerialPort, SIGNAL(currentIndexChanged(QString)), this,SLOT(set_mod_port(QString)) ); connect( ui.chkEnableRoll,SIGNAL(toggled(bool)), this,SLOT(set_ena_roll(bool)) ); @@ -108,7 +77,6 @@ QWidget() connect( ui.chkInvertY,SIGNAL(toggled(bool)), this,SLOT(set_inv_y(bool)) ); connect( ui.chkInvertZ,SIGNAL(toggled(bool)), this,SLOT(set_inv_z(bool)) ); - connect(ui.cb_roll, SIGNAL(currentIndexChanged(int)), this,SLOT(set_rot_roll(int))); connect(ui.cb_pitch, SIGNAL(currentIndexChanged(int)),this,SLOT(set_rot_pitch(int))); connect(ui.cb_yaw, SIGNAL(currentIndexChanged(int)), this,SLOT(set_rot_yaw(int))); @@ -127,13 +95,8 @@ QWidget() // Destructor for server-dialog // TrackerControls::~TrackerControls() { - delete this; } - -// -// Initialize tracker-client-dialog -// void TrackerControls::Initialize(QWidget *parent) { QPoint offsetpos(100, 100); if (parent) { @@ -142,35 +105,20 @@ void TrackerControls::Initialize(QWidget *parent) { show(); } - -// -// Apply online settings to tracker -// void TrackerControls::settings_changed() { settingsDirty = true; if (theTracker) theTracker->applysettings(settings); } - -// -// Center asked to ARDUINO -// void TrackerControls::doCenter() { if (theTracker) theTracker->center(); } -// -// Reset asked to ARDUINO -// void TrackerControls::doReset() { if (theTracker) theTracker->reset(); } - -// -// Send command to ARDUINO -// void TrackerControls::doSend() { if (theTracker) { if (!ui.lineSend->text().isEmpty()) { @@ -182,10 +130,6 @@ void TrackerControls::doSend() { } } - -// -// Display FPS and Status of Arduino. -// void TrackerControls::poll_tracker_info() { if (theTracker) @@ -202,13 +146,13 @@ void TrackerControls::poll_tracker_info() } - if (pre_trame<num_trame) - { nb_trame=num_trame-pre_trame;} + if (pre_frame<num_trame) + { nb_trame=num_trame-pre_frame;} else - {nb_trame=(1000-pre_trame)+num_trame;} + {nb_trame=(1000-pre_frame)+num_trame;} ui.lab_vtps->setText(QString::number(nb_trame*(1000/timer.interval()))); - pre_trame=num_trame; + pre_frame=num_trame; } } @@ -219,28 +163,15 @@ void TrackerControls::doSave() { settings.save_ini(); } - -// -// OK clicked on server-dialog -// void TrackerControls::doOK() { settingsDirty=false; settings.save_ini(); this->close(); } -// -// Cancel clicked on server-dialog -// void TrackerControls::doCancel() { - // - // Ask if changed Settings should be saved - // - if (settingsDirty) { + if (settingsDirty) { int ret = QMessageBox::question ( this, "Settings have changed", "Do you want to save the settings?", QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard ); - - // qDebug() << "doCancel says: answer =" << ret; - switch (ret) { case QMessageBox::Save: settings.save_ini(); @@ -250,10 +181,8 @@ void TrackerControls::doCancel() { close(); break; case QMessageBox::Cancel: - // Cancel was clicked break; default: - // should never be reached break; } } @@ -264,15 +193,13 @@ void TrackerControls::doCancel() { void TrackerControls::registerTracker(ITracker *tracker) { -// theTracker = (FTNoIR_Tracker *) tracker; - theTracker = static_cast<FTNoIR_Tracker*>(tracker); + theTracker = dynamic_cast<FTNoIR_Tracker*>(tracker); if (isVisible() && settingsDirty) theTracker->applysettings(settings); ui.cbSerialPort->setEnabled(false); timer.start(250); ui.lab_vstatus->setText("HAT START"); } - void TrackerControls::unRegisterTracker() { theTracker = NULL; ui.cbSerialPort->setEnabled(true); @@ -281,19 +208,7 @@ void TrackerControls::unRegisterTracker() { ui.lab_vtps->setText(""); } - - - -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Tracker-settings dialog object. - -// Export both decorated and undecorated names. -// GetTrackerDialog - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetTrackerDialog@0 - Common name decoration for __stdcall functions in C language. -#pragma comment(linker, "/export:GetTrackerDialog=_GetTrackerDialog@0") - -FTNOIR_TRACKER_BASE_EXPORT ITrackerDialogPtr __stdcall GetTrackerDialog( ) +extern "C" FTNOIR_TRACKER_BASE_EXPORT ITrackerDialog* CALLING_CONVENTION GetDialog() { return new TrackerControls; } diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h index c463f361..25bd839c 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dialog.h @@ -1,7 +1,7 @@ #ifndef FTNOIR_TRACKER_HAT_DIALOG_H #define FTNOIR_TRACKER_HAT_DIALOG_H -#include "..\ftnoir_tracker_base\ftnoir_tracker_base.h" +#include "ftnoir_tracker_base/ftnoir_tracker_base.h" #include "ftnoir_tracker_hat_settings.h" #include "ftnoir_tracker_hat.h" #include "ui_ftnoir_hatcontrols.h" @@ -9,32 +9,25 @@ #include <QTimer> #include <QMessageBox> -// Widget that has controls for FTNoIR protocol client-settings. -class TrackerControls: public QWidget, Ui::UIHATControls, public ITrackerDialog +class TrackerControls: public QWidget, public ITrackerDialog { Q_OBJECT public: explicit TrackerControls(); - virtual ~TrackerControls(); + virtual ~TrackerControls() virt_override; - void Initialize(QWidget *parent); - void registerTracker(ITracker *tracker); - void unRegisterTracker() ; + void Initialize(QWidget *parent) virt_override; + void registerTracker(ITracker *tracker) virt_override; + void unRegisterTracker() virt_override; private: Ui::UIHATControls ui; - int pre_trame; + int pre_frame; FTNoIR_Tracker *theTracker; protected slots: - - /* - void set_mod_port(int val) { settings.SerialPortName = ui.cbSerialPort->itemText(val); - QMessageBox::warning(this,"FaceTrackNoIR Error", settings.SerialPortName); - settings_changed(); } -*/ - void set_mod_port(const QString & val) { settings.SerialPortName =val; + void set_mod_port(const QString & val) { settings.SerialPortName =val; QMessageBox::warning(this,"FaceTrackNoIR Error", settings.SerialPortName); settings_changed(); } void set_ena_roll(bool val) { settings.EnableRoll = val; settings_changed(); } @@ -52,12 +45,12 @@ protected slots: void set_inv_z(bool val) { settings.InvertZ = val; settings_changed(); } - void set_rot_roll(int val) { settings.RollAxe = val; settings_changed(); } - void set_rot_pitch(int val) { settings.PitchAxe = val; settings_changed(); } - void set_rot_yaw(int val) { settings.YawAxe = val; settings_changed(); } - void set_acc_x(int val) { settings.XAxe = val; settings_changed(); } - void set_acc_y(int val) { settings.YAxe = val; settings_changed(); } - void set_acc_z(int val) { settings.ZAxe = val; settings_changed(); } + void set_rot_roll(int val) { settings.RollAxis = val; settings_changed(); } + void set_rot_pitch(int val) { settings.PitchAxis = val; settings_changed(); } + void set_rot_yaw(int val) { settings.YawAxis = val; settings_changed(); } + void set_acc_x(int val) { settings.XAxis = val; settings_changed(); } + void set_acc_y(int val) { settings.YAxis = val; settings_changed(); } + void set_acc_z(int val) { settings.ZAxis = val; settings_changed(); } void doOK(); void doCancel(); @@ -75,4 +68,4 @@ protected: }; -#endif //FTNOIR_TRACKER_HAT_DIALOG_H
\ No newline at end of file +#endif //FTNOIR_TRACKER_HAT_DIALOG_H diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp index 246eb397..c19f68d3 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_dll.cpp @@ -1,79 +1,38 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ - #include "ftnoir_tracker_hat.h" -#include <QICon> +#include <QIcon> #include <QDebug> FTNoIR_TrackerDll::FTNoIR_TrackerDll() { - //populate the description strings - trackerFullName = "Head Arduino Tracker"; + trackerFullName = "Hatire Arduino"; trackerShortName = "HAT"; - trackerDescription = "FaceTrackNoIR HAT"; + trackerDescription = "Hatire Arduino"; } FTNoIR_TrackerDll::~FTNoIR_TrackerDll() { - -} - -void FTNoIR_TrackerDll::Initialize() -{ - return; } void FTNoIR_TrackerDll::getFullName(QString *strToBeFilled) { *strToBeFilled = trackerFullName; -}; +} void FTNoIR_TrackerDll::getShortName(QString *strToBeFilled) { *strToBeFilled = trackerShortName; -}; +} void FTNoIR_TrackerDll::getDescription(QString *strToBeFilled) { *strToBeFilled = trackerDescription; -}; +} void FTNoIR_TrackerDll::getIcon(QIcon *icon) { *icon = QIcon(":/images/hat.ico"); -}; - -//////////////////////////////////////////////////////////////////////////////// -// Factory function that creates instances if the Tracker object. - -// Export both decorated and undecorated names. -// GetTrackerDll - Undecorated name, which can be easily used with GetProcAddress -// Win32 API function. -// _GetTrackerDll@0 - Common name decoration for __stdcall functions in C language. -#pragma comment(linker, "/export:GetTrackerDll=_GetTrackerDll@0") +} -FTNOIR_TRACKER_BASE_EXPORT ITrackerDllPtr __stdcall GetTrackerDll() +extern "C" FTNOIR_TRACKER_BASE_EXPORT Metadata* CALLING_CONVENTION GetMetadata() { return new FTNoIR_TrackerDll; } diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp index f8b342cc..1d2643ee 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.cpp @@ -1,27 +1,3 @@ -/******************************************************************************** -* FaceTrackNoIR This program is a private project of some enthusiastic * -* gamers from Holland, who don't like to pay much for * -* head-tracking. * -* * -* Copyright (C) 2012 Wim Vriend (Developing) * -* Ron Hendriks (Researching and Testing) * -* * -* Homepage: http://facetracknoir.sourceforge.net/home/default.htm * -* * -* This program is free software; you can redistribute it and/or modify it * -* under the terms of the GNU General Public License as published by the * -* Free Software Foundation; either version 3 of the License, or (at your * -* option) any later version. * -* * -* This program is distributed in the hope that it will be useful, but * -* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * -* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * -* more details. * -* * -* You should have received a copy of the GNU General Public License along * -* with this program; if not, see <http://www.gnu.org/licenses/>. * -* * -********************************************************************************/ #include <QCoreApplication> #include <QSettings> @@ -54,12 +30,12 @@ void TrackerSettings::load_ini() InvertZ = iniFile.value( "InvertZ", 0 ).toBool(); - RollAxe=iniFile.value("RollAxe",1).toInt(); - PitchAxe=iniFile.value("PitchAxe",2).toInt(); - YawAxe=iniFile.value("YawAxe",0).toInt(); - XAxe=iniFile.value("XAxe",1).toInt(); - YAxe=iniFile.value("YAxe",2).toInt(); - ZAxe=iniFile.value("ZAxe",0).toInt(); + RollAxis=iniFile.value("RollAxis",1).toInt(); + PitchAxis=iniFile.value("PitchAxis",2).toInt(); + YawAxis=iniFile.value("YawAxis",0).toInt(); + XAxis=iniFile.value("XAxis",1).toInt(); + YAxis=iniFile.value("YAxis",2).toInt(); + ZAxis=iniFile.value("ZAxis",0).toInt(); iniFile.endGroup(); } @@ -91,12 +67,12 @@ void TrackerSettings::save_ini() const iniFile.setValue( "InvertY", InvertY ); iniFile.setValue( "InvertZ", InvertZ ); - iniFile.setValue ( "RollAxe", RollAxe ); - iniFile.setValue ( "PitchAxe", PitchAxe ); - iniFile.setValue ( "YawAxe",YawAxe ); - iniFile.setValue ( "XAxe", XAxe ); - iniFile.setValue ( "YAxe", YAxe ); - iniFile.setValue ( "ZAxe", ZAxe ); + iniFile.setValue ( "RollAxis", RollAxis ); + iniFile.setValue ( "PitchAxis", PitchAxis ); + iniFile.setValue ( "YawAxis",YawAxis ); + iniFile.setValue ( "XAxis", XAxis ); + iniFile.setValue ( "YAxis", YAxis ); + iniFile.setValue ( "ZAxis", ZAxis ); iniFile.endGroup(); } diff --git a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h index a29fed6b..d6cf4fd9 100644 --- a/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h +++ b/ftnoir_tracker_hatire/ftnoir_tracker_hat_settings.h @@ -8,6 +8,7 @@ #ifndef FTNOIR_TRACKER_HAT_SETTINGS_H #define FTNOIR_TRACKER_HAT_SETTINGS_H +#include <QString> //----------------------------------------------------------------------------- struct TrackerSettings @@ -29,16 +30,15 @@ struct TrackerSettings bool InvertZ; - int RollAxe; - int PitchAxe; - int YawAxe; - int XAxe; - int YAxe; - int ZAxe; + int RollAxis; + int PitchAxis; + int YawAxis; + int XAxis; + int YAxis; + int ZAxis; void load_ini(); void save_ini() const; }; - -#endif //FTNOIR_TRACKER_HAT_SETTINGS_H
\ No newline at end of file +#endif //FTNOIR_TRACKER_HAT_SETTINGS_H |