From 3d865528ec4d3312ec987fb3b3a9d22295b0e27f Mon Sep 17 00:00:00 2001 From: Igor Beloschapkin Date: Mon, 9 Nov 2020 15:09:02 +0100 Subject: [PATCH] WIP Add 6 Tactilo Motors --- TactileBCIFilter.pro.user | 7 +- mainwindow.cpp | 158 ++++++++++++++++--------- mainwindow.h | 12 +- mainwindow.ui | 236 ++++++++++++++++++++++---------------- 4 files changed, 257 insertions(+), 156 deletions(-) diff --git a/TactileBCIFilter.pro.user b/TactileBCIFilter.pro.user index f5d379e..a277450 100644 --- a/TactileBCIFilter.pro.user +++ b/TactileBCIFilter.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -308,8 +308,9 @@ 2 - Qt4ProjectManager.Qt4RunConfiguration:C:/Users/bci/Desktop/Qt Filter Program/TactileBCIFilter/TactileBCIFilter.pro - C:/Users/bci/Desktop/Qt Filter Program/TactileBCIFilter/TactileBCIFilter.pro + TactileBCIFilter2 + Qt4ProjectManager.Qt4RunConfiguration:C:/Users/bci/Desktop/tactilebcifilter/TactileBCIFilter.pro + C:/Users/bci/Desktop/tactilebcifilter/TactileBCIFilter.pro false diff --git a/mainwindow.cpp b/mainwindow.cpp index ad9ed19..79346d0 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -29,10 +29,12 @@ MainWindow::MainWindow(QWidget *parent) : stylesheet_tac_unmarked = "QLabel {background-color: white;}"; logBCIData = true; - leftON = false; - rightON = false; - forwardON = false; - backON = false; + tac1ON = false; + tac2ON = false; + tac3ON = false; + tac4ON = false; + tac5ON = false; + tac6ON = false; lastBufferStr = "0"; @@ -51,10 +53,12 @@ void MainWindow::setupSignalsAndSlots() connect(ui->check_LogBCI, SIGNAL(toggled(bool)), this, SLOT(setLogBCIData(bool))); connect(ui->push_ClearLog, SIGNAL(clicked()), this, SLOT(clearLog())); - connect(ui->push_Left, SIGNAL(clicked(bool)), this, SLOT(pushLeft(bool))); - connect(ui->push_Right, SIGNAL(clicked(bool)), this, SLOT(pushRight(bool))); - connect(ui->push_Forward, SIGNAL(clicked(bool)), this, SLOT(pushForward(bool))); - connect(ui->push_Back, SIGNAL(clicked(bool)), this, SLOT(pushBack(bool))); + connect(ui->push_Tac1, SIGNAL(clicked(bool)), this, SLOT(pushTac1(bool))); + connect(ui->push_Tac2, SIGNAL(clicked(bool)), this, SLOT(pushTac2(bool))); + connect(ui->push_Tac3, SIGNAL(clicked(bool)), this, SLOT(pushTac3(bool))); + connect(ui->push_Tac4, SIGNAL(clicked(bool)), this, SLOT(pushTac4(bool))); + connect(ui->push_Tac5, SIGNAL(clicked(bool)), this, SLOT(pushTac5(bool))); + connect(ui->push_Tac6, SIGNAL(clicked(bool)), this, SLOT(pushTac6(bool))); connect(ui->push_allLOW, SIGNAL(clicked()), this, SLOT(allLOW())); connect(ui->push_allHIGH, SIGNAL(clicked()), this, SLOT(allHIGH())); } @@ -254,34 +258,60 @@ void MainWindow::markDirectionTactile(const QString direction) switch (i_direction) { case 0: //nothing - ui->label_Left->setStyleSheet(stylesheet_tac_unmarked); - ui->label_Right->setStyleSheet(stylesheet_tac_unmarked); - ui->label_Forward->setStyleSheet(stylesheet_tac_unmarked); - ui->label_Back->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac1->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac2->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac3->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac4->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac5->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac6->setStyleSheet(stylesheet_tac_unmarked); break; - case 1: //left - ui->label_Left->setStyleSheet(stylesheet_tac_marked); - ui->label_Right->setStyleSheet(stylesheet_tac_unmarked); - ui->label_Forward->setStyleSheet(stylesheet_tac_unmarked); - ui->label_Back->setStyleSheet(stylesheet_tac_unmarked); + case 1: //Tac1 + ui->label_Tac1->setStyleSheet(stylesheet_tac_marked); + ui->label_Tac2->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac3->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac4->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac5->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac6->setStyleSheet(stylesheet_tac_unmarked); break; - case 2: //right - ui->label_Left->setStyleSheet(stylesheet_tac_unmarked); - ui->label_Right->setStyleSheet(stylesheet_tac_marked); - ui->label_Forward->setStyleSheet(stylesheet_tac_unmarked); - ui->label_Back->setStyleSheet(stylesheet_tac_unmarked); + case 2: //Tac2 + ui->label_Tac1->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac2->setStyleSheet(stylesheet_tac_marked); + ui->label_Tac3->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac4->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac5->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac6->setStyleSheet(stylesheet_tac_unmarked); break; - case 3: //forward - ui->label_Left->setStyleSheet(stylesheet_tac_unmarked); - ui->label_Right->setStyleSheet(stylesheet_tac_unmarked); - ui->label_Forward->setStyleSheet(stylesheet_tac_marked); - ui->label_Back->setStyleSheet(stylesheet_tac_unmarked); + case 3: //Tac3 + ui->label_Tac1->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac2->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac3->setStyleSheet(stylesheet_tac_marked); + ui->label_Tac4->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac5->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac6->setStyleSheet(stylesheet_tac_unmarked); break; - case 4: //back - ui->label_Left->setStyleSheet(stylesheet_tac_unmarked); - ui->label_Right->setStyleSheet(stylesheet_tac_unmarked); - ui->label_Forward->setStyleSheet(stylesheet_tac_unmarked); - ui->label_Back->setStyleSheet(stylesheet_tac_marked); + case 4: //Tac4 + ui->label_Tac1->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac2->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac3->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac4->setStyleSheet(stylesheet_tac_marked); + ui->label_Tac5->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac6->setStyleSheet(stylesheet_tac_unmarked); + break; + case 5: //Tac5 + ui->label_Tac1->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac2->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac3->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac4->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac5->setStyleSheet(stylesheet_tac_marked); + ui->label_Tac6->setStyleSheet(stylesheet_tac_unmarked); + break; + case 6: //Tac6 + ui->label_Tac1->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac2->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac3->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac4->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac5->setStyleSheet(stylesheet_tac_unmarked); + ui->label_Tac6->setStyleSheet(stylesheet_tac_marked); break; } } @@ -296,29 +326,41 @@ void MainWindow::clearLog() ui->plain_Log->clear(); } -void MainWindow::pushLeft(const bool state) +void MainWindow::pushTac1(const bool state) { - leftON = state; + tac1ON = state; pushDirection(); } -void MainWindow::pushRight(const bool state) +void MainWindow::pushTac2(const bool state) { - rightON = state; + tac2ON = state; pushDirection(); } -void MainWindow::pushForward(const bool state) +void MainWindow::pushTac3(const bool state) { - forwardON = state; + tac3ON = state; pushDirection(); } -void MainWindow::pushBack(const bool state) +void MainWindow::pushTac4(const bool state) { - backON = state; + tac4ON = state; + pushDirection(); +} + +void MainWindow::pushTac5(const bool state) +{ + tac5ON = state; + pushDirection(); +} + +void MainWindow::pushTac6(const bool state) +{ + tac6ON = state; pushDirection(); } @@ -327,26 +369,34 @@ void MainWindow::pushDirection() //first switch off all udpSocket_Feather->writeDatagram(QByteArray::number(0), FeatherIP_full, FeatherPort); - if(leftON) + if(tac1ON) udpSocket_Feather->writeDatagram(QByteArray::number(1), FeatherIP_full, FeatherPort); - if(rightON) + if(tac2ON) udpSocket_Feather->writeDatagram(QByteArray::number(2), FeatherIP_full, FeatherPort); - if(forwardON) + if(tac3ON) udpSocket_Feather->writeDatagram(QByteArray::number(3), FeatherIP_full, FeatherPort); - if(backON) + if(tac4ON) udpSocket_Feather->writeDatagram(QByteArray::number(4), FeatherIP_full, FeatherPort); + + if(tac5ON) + udpSocket_Feather->writeDatagram(QByteArray::number(5), FeatherIP_full, FeatherPort); + + if(tac6ON) + udpSocket_Feather->writeDatagram(QByteArray::number(6), FeatherIP_full, FeatherPort); } void MainWindow::allLOW() { udpSocket_Feather->writeDatagram(QByteArray::number(0), FeatherIP_full, FeatherPort); - ui->push_Left->setChecked(false); - ui->push_Right->setChecked(false); - ui->push_Forward->setChecked(false); - ui->push_Back->setChecked(false); + ui->push_Tac1->setChecked(false); + ui->push_Tac2->setChecked(false); + ui->push_Tac3->setChecked(false); + ui->push_Tac4->setChecked(false); + ui->push_Tac5->setChecked(false); + ui->push_Tac6->setChecked(false); } void MainWindow::allHIGH() @@ -355,8 +405,12 @@ void MainWindow::allHIGH() udpSocket_Feather->writeDatagram(QByteArray::number(2), FeatherIP_full, FeatherPort); udpSocket_Feather->writeDatagram(QByteArray::number(3), FeatherIP_full, FeatherPort); udpSocket_Feather->writeDatagram(QByteArray::number(4), FeatherIP_full, FeatherPort); - ui->push_Left->setChecked(true); - ui->push_Right->setChecked(true); - ui->push_Forward->setChecked(true); - ui->push_Back->setChecked(true); + udpSocket_Feather->writeDatagram(QByteArray::number(5), FeatherIP_full, FeatherPort); + udpSocket_Feather->writeDatagram(QByteArray::number(6), FeatherIP_full, FeatherPort); + ui->push_Tac1->setChecked(true); + ui->push_Tac2->setChecked(true); + ui->push_Tac3->setChecked(true); + ui->push_Tac4->setChecked(true); + ui->push_Tac5->setChecked(true); + ui->push_Tac6->setChecked(true); } diff --git a/mainwindow.h b/mainwindow.h index 6a28a6a..cdc6a22 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -21,10 +21,12 @@ private slots: void readPCSocketData(); void setLogBCIData(const bool log); void clearLog(); - void pushLeft(const bool checked); - void pushRight(const bool checked); - void pushForward(const bool state); - void pushBack(const bool state); + void pushTac1(const bool checked); + void pushTac2(const bool checked); + void pushTac3(const bool state); + void pushTac4(const bool state); + void pushTac5(const bool state); + void pushTac6(const bool state); void allLOW(); void allHIGH(); private: @@ -52,7 +54,7 @@ private: bool logBCIData; - bool leftON, rightON, forwardON, backON; + bool tac1ON, tac2ON, tac3ON, tac4ON, tac5ON, tac6ON; void pushDirection(); bool checkPort(const quint16 port); }; diff --git a/mainwindow.ui b/mainwindow.ui index 0e0c1b8..000e7ff 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 515 - 486 + 532 @@ -616,37 +616,8 @@ 5 - - - - - 0 - 40 - - - - - 12 - 75 - true - - - - background-color: rgb(255, 255, 255); - - - QFrame::Box - - - LINKS - - - Qt::AlignCenter - - - - + 0 @@ -667,36 +638,7 @@ QFrame::Box - RECHTS - - - Qt::AlignCenter - - - - - - - - 0 - 40 - - - - - 12 - 75 - true - - - - background-color: rgb(255, 255, 255); - - - QFrame::Box - - - VOR + Motor 2 Qt::AlignCenter @@ -704,7 +646,7 @@ - + 0 @@ -725,7 +667,65 @@ QFrame::Box - ZURÜCK + Motor 4 + + + Qt::AlignCenter + + + + + + + + 0 + 40 + + + + + 12 + 75 + true + + + + background-color: rgb(255, 255, 255); + + + QFrame::Box + + + Motor 3 + + + Qt::AlignCenter + + + + + + + + 0 + 40 + + + + + 12 + 75 + true + + + + background-color: rgb(255, 255, 255); + + + QFrame::Box + + + Motor 1 Qt::AlignCenter @@ -746,7 +746,51 @@ - + + + + + 0 + 40 + + + + + 75 + true + + + + Motor 1 + + + true + + + + + + + + 0 + 40 + + + + + 75 + true + + + + Motor 2 + + + true + + + + @@ -759,8 +803,8 @@ - - + + 0 @@ -774,14 +818,36 @@ - VOR + Motor 4 true - + + + + + 0 + 40 + + + + + 75 + true + + + + Motor 3 + + + true + + + + @@ -794,8 +860,8 @@ - - + + 0 @@ -809,15 +875,15 @@ - LINKS + Motor 6 true - - + + 0 @@ -831,29 +897,7 @@ - ZURÜCK - - - true - - - - - - - - 0 - 40 - - - - - 75 - true - - - - RECHTS + Motor 5 true