diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-09 16:21:32 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-05-09 16:21:32 +0200 |
commit | fd0ad89c7c6f61aa14d6e908e9217121f4afa5c6 (patch) | |
tree | 5274ef7761b249c5ee48a823a48b2c744c4df593 /tracker-hatire/ftnoir_tracker_hat.cpp | |
parent | e6fb571266c22f120c0111731da1f2e6bf4d812d (diff) |
tracker/hatire: move to opentrack settings API
Diffstat (limited to 'tracker-hatire/ftnoir_tracker_hat.cpp')
-rwxr-xr-x | tracker-hatire/ftnoir_tracker_hat.cpp | 71 |
1 files changed, 9 insertions, 62 deletions
diff --git a/tracker-hatire/ftnoir_tracker_hat.cpp b/tracker-hatire/ftnoir_tracker_hat.cpp index 2dc35b3b..b3b9c433 100755 --- a/tracker-hatire/ftnoir_tracker_hat.cpp +++ b/tracker-hatire/ftnoir_tracker_hat.cpp @@ -25,8 +25,6 @@ hatire::hatire() Begin.append((char) 0xAA); End.append((char) 0x55); End.append((char) 0x55); - - settings.load_ini(); } hatire::~hatire() @@ -36,7 +34,7 @@ hatire::~hatire() //send RESET to Arduino void hatire::reset() { - t.sendcmd(ts.sCmdReset); + t.sendcmd_str(s.CmdReset); } // return FPS @@ -49,8 +47,6 @@ void hatire::start_tracker(QFrame*) { CptError=0; frame_cnt=0; - settings.load_ini(); - applysettings(settings); t.Log("Starting Tracker"); serial_result ret = t.init_serial_port(); @@ -67,7 +63,7 @@ void hatire::start_tracker(QFrame*) break; } - t.start(ts); + t.start(); } void hatire::serial_info() @@ -99,7 +95,7 @@ void hatire::data(double *data) { QDataStream stream(&data_read, QIODevice::ReadOnly); - if (ts.bBigEndian) + if (s.BigEndian) stream.setByteOrder(QDataStream::BigEndian); else stream.setByteOrder(QDataStream::LittleEndian); @@ -159,12 +155,12 @@ void hatire::data(double *data) double& place; } spec[] = { - { bEnableX, bInvertX, HAT.Trans[iXAxis], data[TX] }, - { bEnableY, bInvertY, HAT.Trans[iYAxis], data[TY] }, - { bEnableZ, bInvertZ, HAT.Trans[iZAxis], data[TZ] }, - { bEnableYaw, bInvertYaw, HAT.Rot[iYawAxis], data[Yaw] }, - { bEnablePitch, bInvertPitch, HAT.Rot[iPitchAxis], data[Pitch] }, - { bEnableRoll, bInvertRoll, HAT.Rot[iRollAxis], data[Roll] }, + { s.EnableX, s.InvertX, HAT.Trans[s.XAxis], data[TX] }, + { s.EnableY, s.InvertY, HAT.Trans[s.YAxis], data[TY] }, + { s.EnableZ, s.InvertZ, HAT.Trans[s.ZAxis], data[TZ] }, + { s.EnableYaw, s.InvertYaw, HAT.Rot[s.YawAxis], data[Yaw] }, + { s.EnablePitch, s.InvertPitch, HAT.Rot[s.PitchAxis], data[Pitch] }, + { s.EnableRoll, s.InvertRoll, HAT.Rot[s.RollAxis], data[Roll] }, }; for (unsigned i = 0; i < sizeof(spec) / sizeof(*spec); i++) @@ -178,55 +174,6 @@ void hatire::data(double *data) //data->y=CptError; } -// -// Apply modification Settings -// -void hatire::applysettings(const TrackerSettings& settings) -{ - ts.sSerialPortName = settings.SerialPortName; - - bEnableRoll = settings.EnableRoll; - bEnablePitch = settings.EnablePitch; - bEnableYaw = settings.EnableYaw; - bEnableX = settings.EnableX; - bEnableY = settings.EnableY; - bEnableZ = settings.EnableZ; - - bInvertRoll = settings.InvertRoll; - bInvertPitch = settings.InvertPitch; - bInvertYaw = settings.InvertYaw; - bInvertX = settings.InvertX; - bInvertY = settings.InvertY; - bInvertZ = settings.InvertZ; - ts.bEnableLogging = settings.EnableLogging; - - iRollAxis= settings.RollAxis; - iPitchAxis= settings.PitchAxis; - iYawAxis= settings.YawAxis; - iXAxis= settings.XAxis; - iYAxis= settings.YAxis; - iZAxis= settings.ZAxis; - - ts.iBaudRate=settings.pBaudRate; - ts.iDataBits=settings.pDataBits; - ts.iParity=settings.pParity; - ts.iStopBits=settings.pStopBits; - ts.iFlowControl=settings.pFlowControl; - - ts.sCmdStart= settings.CmdStart.toLatin1(); - ts.sCmdStop= settings.CmdStop.toLatin1(); - ts.sCmdInit= settings.CmdInit.toLatin1(); - ts.sCmdReset= settings.CmdReset.toLatin1(); - ts.sCmdCenter= settings.CmdCenter.toLatin1(); - ts.sCmdZero= settings.CmdZero.toLatin1(); - ts.iDelayInit=settings.DelayInit; - ts.iDelayStart=settings.DelayStart; - ts.iDelaySeq=settings.DelaySeq; - ts.bBigEndian=settings.BigEndian; - - t.update_serial_settings(ts); -} - #include "ftnoir_tracker_hat_dialog.h" OPENTRACK_DECLARE_TRACKER(hatire, TrackerControls, TrackerDll) |