|
|
@@ -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) |
|
|
|
{ |
|
|
|
tac1ON = state; |
|
|
|
pushDirection(); |
|
|
|
} |
|
|
|
|
|
|
|
void MainWindow::pushTac2(const bool state) |
|
|
|
{ |
|
|
|
leftON = state; |
|
|
|
tac2ON = state; |
|
|
|
pushDirection(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void MainWindow::pushRight(const bool state) |
|
|
|
void MainWindow::pushTac3(const bool state) |
|
|
|
{ |
|
|
|
rightON = state; |
|
|
|
tac3ON = state; |
|
|
|
pushDirection(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void MainWindow::pushForward(const bool state) |
|
|
|
void MainWindow::pushTac4(const bool state) |
|
|
|
{ |
|
|
|
forwardON = state; |
|
|
|
tac4ON = state; |
|
|
|
pushDirection(); |
|
|
|
} |
|
|
|
|
|
|
|
void MainWindow::pushTac5(const bool state) |
|
|
|
{ |
|
|
|
tac5ON = state; |
|
|
|
pushDirection(); |
|
|
|
} |
|
|
|
|
|
|
|
void MainWindow::pushBack(const bool state) |
|
|
|
void MainWindow::pushTac6(const bool state) |
|
|
|
{ |
|
|
|
backON = 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); |
|
|
|
} |