From 2df65b694918159b8aa5b0ab9b13e086468cdc14 Mon Sep 17 00:00:00 2001 From: Thomas Pietrzak Date: Tue, 3 Apr 2012 19:30:36 +0000 Subject: [PATCH] Import Tacton debugger git-svn-id: svn+ssh://thomaspietrzak.com/var/svn/rep@74 47cf9a05-e0a8-4ed5-9e9b-101a649bc004 --- TactonDebug/TactonDebug.sln | 20 ++ TactonDebug/TactonDebug.suo | Bin 0 -> 10752 bytes TactonDebug/TactonDebug/TactonDebug.vcxproj | 144 ++++++++++ TactonDebug/TactonDebug/main.cpp | 10 + TactonDebug/TactonDebug/tactondebug.cpp | 90 ++++++ TactonDebug/TactonDebug/tactondebug.h | 35 +++ TactonDebug/TactonDebug/tactondebug.qrc | 4 + TactonDebug/TactonDebug/tactondebug.ui | 291 ++++++++++++++++++++ TactonLibrary.suo | Bin 26112 -> 26112 bytes TactonPlayer/Tacton.hpp | 4 +- TactonPlayer/TactonPlayer.cpp | 1 + 11 files changed, 597 insertions(+), 2 deletions(-) create mode 100644 TactonDebug/TactonDebug.sln create mode 100644 TactonDebug/TactonDebug.suo create mode 100644 TactonDebug/TactonDebug/TactonDebug.vcxproj create mode 100644 TactonDebug/TactonDebug/main.cpp create mode 100644 TactonDebug/TactonDebug/tactondebug.cpp create mode 100644 TactonDebug/TactonDebug/tactondebug.h create mode 100644 TactonDebug/TactonDebug/tactondebug.qrc create mode 100644 TactonDebug/TactonDebug/tactondebug.ui diff --git a/TactonDebug/TactonDebug.sln b/TactonDebug/TactonDebug.sln new file mode 100644 index 0000000..0ab897a --- /dev/null +++ b/TactonDebug/TactonDebug.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TactonDebug", "TactonDebug\TactonDebug.vcxproj", "{245FF8C0-7CC0-4A37-9F07-6B3C8E29D089}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {245FF8C0-7CC0-4A37-9F07-6B3C8E29D089}.Debug|Win32.ActiveCfg = Debug|Win32 + {245FF8C0-7CC0-4A37-9F07-6B3C8E29D089}.Debug|Win32.Build.0 = Debug|Win32 + {245FF8C0-7CC0-4A37-9F07-6B3C8E29D089}.Release|Win32.ActiveCfg = Release|Win32 + {245FF8C0-7CC0-4A37-9F07-6B3C8E29D089}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/TactonDebug/TactonDebug.suo b/TactonDebug/TactonDebug.suo new file mode 100644 index 0000000000000000000000000000000000000000..d47ffd0d457c61956a5b19f2d5ed811b9e69fdfe GIT binary patch literal 10752 zcmeHMU2GIp6uzY(zls$tiXbZ#w9rZ^N?VHj6bdb^i5tmuce-x7-Ko2?r41!9 zXyVTUG2z9;7{u@(h8GeOHO8bdBnrmR_@q22#uy)b&_o}6vGx1z%=wfAryTJHCJ-~!-6;3D8+;Jv^lKy16X54aTg0I&qO3`iXy-i13$0!M{` zpDBD|kBFm9h#~BzcPJI}CTyPmARoND&R9KK@^w)$28~dW0Ii^Ch#s*I)Vp!DM+{mI zJpPx$3ppk3@inQ(9NR85krch+popS1#WDQr;7Ro-T_!9ObL4txBjm$nxO_~XN&6zG z_3I)8>P?`X1Sb(lgIu_S5A+|#ut$Ji={xfM5Q~ zeT}J@nM&yOaXn=wv{<>XHPsc1h7RaM?MAO2ukQ*}b#Lpg>8`8{ZwqKu+I&e&QJkA< ziG~tJ(&#q*9noY;i?x}laMbWi79x6L;-cL!Vx7@=*f^2&H)*EU9_>&1Tch!~))mv` z&7MJ1k0+yD(OA?R^0$)HBzi*n=7aJ=Pw>4q(@5xC=i+oe#N6$weti$_}Hof5hEIc4+{gcBc z&?j95laI>mW&BZ$l17(E!Q)17l@OhX2PUY$fIBze&sphzS8zTX*yje!ujnfY+4LL0 zgAN{gAr%AiU`)=(#|F@+1=4Sm102|>YgA>s&iECoq;MUThAl}pPlyApHO!gmU&3;fTjP;zi4~?;EO!R!CO995B)2}fI{@2 zxsu9%vguRO)TcJkPC+_uJ_z*XT&z>P>Obq4Lv%ub-1LXA^VH{Xf08fyFf!ePb&v>;R zHC`2-*W!F(EBc$zUyJq>qH!4BHIwdP8U378xm%fI6mM4D&an#w>(-g%txh~O!!!ED zQP>(Y8J>FRVpzsmdNQTsmYsD&>m%r8{-d6Nl}Ui{hkB=Ak|DQrF<Fq}RrCts|K8@fzA~{_kPpZ=q%{glwM*JIa#3#h(;Nf;xPr0h9 z$@~3~Tu5r1@~~6$-tzm;qLIIjmyHb9>_0cZcjuXnqpuetXVN8h17}jZ>T_sUHg8j1 zx0X-mp(mS2)jnf zvEpRydC-on$V-h<>ChMPo5<%D}a7E z#*$w`w)J|AyVl$Mrct>3EATSEZ4l_6o!_6@5PO*e@C=e!nVSVpCI9e)uByNC$)7n% zmESlK}Ck?AK}aQTgW>qej7a`FN9eAp? zfLHpQ^Lu+jH~MZFFxRhS@0C7tp)s3&p(mEvXCKb|q7{By!?_hbcjh^-A6ngy-yi3D zmIq!u^5@!;-$urMsvYI2tCM@LE3lbIbHR>(s#cz@lk41Tbw2UKin;DJ&$aD6boG|0QG~@s5?0=?AEM4e(?NsU2H{Q`scKmSmz+0y;u_ANI z!<#OATlC+}z4yWrtnc`&qWOg+eYzEdcaMtW=udwQVa{WHi=w^kI=ifN!!H-!E?(NX ze(*~F%hZZn<@4b**YDUKQ&f$xiR-+grR=kZ^!q`v%WYPMg{Cfyx8sRaH3_ky-2 literal 0 HcmV?d00001 diff --git a/TactonDebug/TactonDebug/TactonDebug.vcxproj b/TactonDebug/TactonDebug/TactonDebug.vcxproj new file mode 100644 index 0000000..857dc95 --- /dev/null +++ b/TactonDebug/TactonDebug/TactonDebug.vcxproj @@ -0,0 +1,144 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {245FF8C0-7CC0-4A37-9F07-6B3C8E29D089} + Qt4VSv1.0 + + + + Application + + + Application + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + AllRules.ruleset + + + AllRules.ruleset + + + $(SolutionDir)$(ConfigurationName) + $(SolutionDir)$(ConfigurationName) + + + + UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_CORE_LIB;QT_GUI_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\qtmain;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;.\;..;%(AdditionalIncludeDirectories) + Disabled + ProgramDatabase + MultiThreadedDebugDLL + false + + + Windows + $(OutDir)\$(ProjectName).exe + $(QTDIR)\lib;%(AdditionalLibraryDirectories) + true + qtmaind.lib;QtCored4.lib;QtGuid4.lib;%(AdditionalDependencies);tactonplayer.lib + + + + + UNICODE;WIN32;QT_LARGEFILE_SUPPORT;QT_NO_DEBUG;NDEBUG;QT_CORE_LIB;QT_GUI_LIB;%(PreprocessorDefinitions) + .\GeneratedFiles;$(QTDIR)\include;.\GeneratedFiles\$(ConfigurationName);$(QTDIR)\include\qtmain;$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;.\;..;%(AdditionalIncludeDirectories) + + + MultiThreadedDLL + false + + + Windows + $(OutDir)\$(ProjectName).exe + $(QTDIR)\lib;%(AdditionalLibraryDirectories) + false + qtmain.lib;QtCore4.lib;QtGui4.lib;%(AdditionalDependencies);tactonplayer.lib + + + + + true + + + + + + + + + true + + + + + + + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I.\.." "-I." "-I." "-I." "tactondebug.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + $(QTDIR)\bin\moc.exe;%(FullPath) + Moc%27ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp + "$(QTDIR)\bin\moc.exe" -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DNDEBUG -DQT_CORE_LIB -DQT_GUI_LIB "-I." "-I.\GeneratedFiles" "-I$(QTDIR)\include" "-I.\GeneratedFiles\$(ConfigurationName)\." "-I$(QTDIR)\include\qtmain" "-I$(QTDIR)\include\QtCore" "-I$(QTDIR)\include\QtGui" "-I." "-I.\.." "-I." "-I." "-I." "tactondebug.h" -o ".\GeneratedFiles\$(ConfigurationName)\moc_%(Filename).cpp" + + + + + Document + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + $(QTDIR)\bin\uic.exe;%(AdditionalInputs) + Uic%27ing %(Identity)... + .\GeneratedFiles\ui_%(Filename).h;%(Outputs) + "$(QTDIR)\bin\uic.exe" -o ".\GeneratedFiles\ui_%(Filename).h" "%(FullPath)" + + + + + + + + Document + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + .\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp + %(FullPath);%(AdditionalInputs) + Rcc%27ing %(Identity)... + .\GeneratedFiles\qrc_%(Filename).cpp;%(Outputs) + "$(QTDIR)\bin\rcc.exe" -name "%(Filename)" -no-compress "%(FullPath)" -o .\GeneratedFiles\qrc_%(Filename).cpp + + + + + + + + + + + \ No newline at end of file diff --git a/TactonDebug/TactonDebug/main.cpp b/TactonDebug/TactonDebug/main.cpp new file mode 100644 index 0000000..3ebd253 --- /dev/null +++ b/TactonDebug/TactonDebug/main.cpp @@ -0,0 +1,10 @@ +#include "tactondebug.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + TactonDebug w; + w.show(); + return a.exec(); +} diff --git a/TactonDebug/TactonDebug/tactondebug.cpp b/TactonDebug/TactonDebug/tactondebug.cpp new file mode 100644 index 0000000..70442ad --- /dev/null +++ b/TactonDebug/TactonDebug/tactondebug.cpp @@ -0,0 +1,90 @@ +#include "tactondebug.h" + +int TactonDebug::MaxFrequency = 400; +int TactonDebug::MaxAmplitude = 255; +int TactonDebug::MaxDuration = 2000; + +TactonDebug::TactonDebug(QWidget *parent, Qt::WFlags flags) + : QMainWindow(parent, flags) +{ + try + { + _tactonPlayer = new TactonPlayer("COM5"); + } + catch(...) + { + _tactonPlayer = NULL; + } + + setupUi(this); + QObject::connect(frequencebox, SIGNAL(textChanged(const QString &)), this, SLOT(setFrequency(const QString &))); + QObject::connect(frequenceslider, SIGNAL(valueChanged(int)), this, SLOT(setFrequency(int))); + QObject::connect(amplitudebox, SIGNAL(textChanged(const QString &)), this, SLOT(setAmplitude(const QString &))); + QObject::connect(amplitudeslider, SIGNAL(valueChanged(int)), this, SLOT(setAmplitude(int))); + QObject::connect(durationbox, SIGNAL(textChanged(const QString &)), this, SLOT(setDuration(const QString &))); + QObject::connect(durationslider, SIGNAL(valueChanged(int)), this, SLOT(setDuration(int))); + + QObject::connect(playbutton, SIGNAL(clicked(bool)), this, SLOT(play(bool))); +} + +TactonDebug::~TactonDebug() +{ + +} + +void TactonDebug::setFrequency(int f) +{ + if (f > MaxFrequency) + f = MaxFrequency; + frequencebox->setText(QString::number(f)); +} + +void TactonDebug::setFrequency(const QString &text) +{ + int f = text.toInt(); + if (f > MaxFrequency) + f = MaxFrequency; + frequenceslider->setValue(f); +} + +void TactonDebug::setAmplitude(int a) +{ + if (a > MaxAmplitude) + a = MaxAmplitude; + amplitudebox->setText(QString::number(a)); +} + +void TactonDebug::setAmplitude(const QString &text) +{ + int a = text.toInt(); + if (a > MaxAmplitude) + a = MaxAmplitude; + amplitudeslider->setValue(a); +} + +void TactonDebug::setDuration(int d) +{ + if (d > MaxDuration) + d = MaxDuration; + durationbox->setText(QString::number(d)); +} + +void TactonDebug::setDuration(const QString &text) +{ + int d = text.toInt(); + if (d > MaxDuration) + d = MaxDuration; + durationslider->setValue(d); +} + +void TactonDebug::play(bool) +{ + if (!_tactonPlayer) + return; + unsigned char pattern = up->isChecked() * POS2_UP | + right->isChecked() * POS2_RIGHT | + left->isChecked() * POS2_LEFT | + down->isChecked() * POS2_DOWN; + + _tactonPlayer->play(Tacton(pattern, durationslider->value(), frequenceslider->value(), amplitudeslider->value())); +} diff --git a/TactonDebug/TactonDebug/tactondebug.h b/TactonDebug/TactonDebug/tactondebug.h new file mode 100644 index 0000000..ca468af --- /dev/null +++ b/TactonDebug/TactonDebug/tactondebug.h @@ -0,0 +1,35 @@ +#ifndef TACTONDEBUG_H +#define TACTONDEBUG_H + +#include +#include "ui_tactondebug.h" + +#include + +class TactonDebug : public QMainWindow, Ui::TactonDebugClass +{ + Q_OBJECT + + public: + TactonDebug(QWidget *parent = 0, Qt::WFlags flags = 0); + ~TactonDebug(); + + public slots: + void setFrequency(int f); + void setFrequency(const QString &text); + void setAmplitude(int a); + void setAmplitude(const QString &text); + void setDuration(int d); + void setDuration(const QString &text); + + void play(bool); + + private: + static int MaxFrequency; + static int MaxAmplitude; + static int MaxDuration; + + TactonPlayer *_tactonPlayer; +}; + +#endif // TACTONDEBUG_H diff --git a/TactonDebug/TactonDebug/tactondebug.qrc b/TactonDebug/TactonDebug/tactondebug.qrc new file mode 100644 index 0000000..0dc7b88 --- /dev/null +++ b/TactonDebug/TactonDebug/tactondebug.qrc @@ -0,0 +1,4 @@ + + + + diff --git a/TactonDebug/TactonDebug/tactondebug.ui b/TactonDebug/TactonDebug/tactondebug.ui new file mode 100644 index 0000000..c6deb50 --- /dev/null +++ b/TactonDebug/TactonDebug/tactondebug.ui @@ -0,0 +1,291 @@ + + + TactonDebugClass + + + + 0 + 0 + 231 + 371 + + + + TactonDebug + + + + + + 10 + 10 + 211 + 349 + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Fréquence + + + + + + + 250 + + + 3 + + + + + + + 400 + + + 250 + + + Qt::Horizontal + + + QSlider::TicksBothSides + + + 50 + + + + + + + Amplitude + + + + + + + 255 + + + 3 + + + + + + + 255 + + + 255 + + + Qt::Horizontal + + + QSlider::TicksBothSides + + + 32 + + + + + + + Duration + + + + + + + 200 + + + 4 + + + + + + + 2000 + + + 10 + + + 100 + + + 200 + + + Qt::Horizontal + + + QSlider::TicksBothSides + + + 100 + + + + + + + Play + + + + + + + + + + + + + diff --git a/TactonLibrary.suo b/TactonLibrary.suo index 5078e9b4664158857d3903bcacb8318ea7b52c26..6134b9ff7d21aa4f600c1f195dbbfdfed24fab4e 100644 GIT binary patch delta 727 zcmYk3PfQb05XRqIcDvP5>}m_qR4Ii5EeLI`fE1O`1{xr?1W}`elpu*D#+XWoRwxxc z;GYBVdGH7xj3=}9T{NO0!6=Y=An{_n5N~=j@t_y$tV+U5es90|-pph+lg;yNp6ip6 zqlz(BNw|sMg+k#kVqW^pOKkqs$FH^zyojFKE0LDht*nf+nV`%9Hsva;XtKDj^h)v# zaiAiFLm?gwdwZ~-T2T1NBwyVW>NkT3Tkh5o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acton.hpp @@ -1,9 +1,9 @@ #ifndef _TACTON_ #define _TACTON_ -#define POS1_UP_FOREWARD 0x01 +#define POS1_UP_FORWARD 0x01 #define POS1_UP_BACKWARD 0x02 -#define POS1_DOWN_FOREWARD 0x08 +#define POS1_DOWN_FORWARD 0x08 #define POS1_DOWN_BACKWARD 0x04 #define POS2_RIGHT 0x01 diff --git a/TactonPlayer/TactonPlayer.cpp b/TactonPlayer/TactonPlayer.cpp index e57595c..d2f3be0 100644 --- a/TactonPlayer/TactonPlayer.cpp +++ b/TactonPlayer/TactonPlayer.cpp @@ -12,6 +12,7 @@ TactonPlayer::TactonPlayer(const char *port) } catch(...) { + _comport = NULL; } } -- 2.30.2