diff --git a/APBUARTPLUGIN/apbuart_plugin_ui.cpp b/APBUARTPLUGIN/apbuart_plugin_ui.cpp --- a/APBUARTPLUGIN/apbuart_plugin_ui.cpp +++ b/APBUARTPLUGIN/apbuart_plugin_ui.cpp @@ -29,7 +29,7 @@ APBUART_Plugin_ui::APBUART_Plugin_ui(QWi { ui->setupUi(this); connect(this->ui->FIFODebugChkBx,SIGNAL(stateChanged(int)),this,SIGNAL(loopbackChkBxStateChanged(int))); - connect(this,SIGNAL(apbUartTextReceived(QString)),this->ui->UART_TERM,SLOT(append(QString))); + connect(this,SIGNAL(apbUartTextReceived(QString)),this->ui->UART_TERM,SLOT(apbUartTextReceived(QString))); connect(this->ui->ConnectQpb,SIGNAL(clicked()),this,SIGNAL(connectPort())); connect(this->ui->UART_TERM,SIGNAL(sendChar(char)),this,SIGNAL(sendChar(char))); connect(this->ui->PortNameLineEdit,SIGNAL(textChanged(QString)),this,SIGNAL(PortNameChanged(QString))); diff --git a/APBUARTPLUGIN/apbuart_plugin_ui.ui b/APBUARTPLUGIN/apbuart_plugin_ui.ui --- a/APBUARTPLUGIN/apbuart_plugin_ui.ui +++ b/APBUARTPLUGIN/apbuart_plugin_ui.ui @@ -17,7 +17,7 @@ - 1 + 0 @@ -33,7 +33,7 @@ Enable FIFO debug mode - true + false diff --git a/APBUARTPLUGIN/apbuartterminal.cpp b/APBUARTPLUGIN/apbuartterminal.cpp --- a/APBUARTPLUGIN/apbuartterminal.cpp +++ b/APBUARTPLUGIN/apbuartterminal.cpp @@ -24,12 +24,22 @@ ApbUartTerminal::ApbUartTerminal(QWidget *parent) : QTextEdit(parent) { - connect(this,SIGNAL(apbUartTextReceived(QString)),this,SLOT(append(QString))); +// connect(this,SIGNAL(apbUartTextReceived(QString)),this,SLOT(append(QString))); setReadOnly(true); } void ApbUartTerminal::keyPressEvent(QKeyEvent *e) { - emit this->sendChar((char)e->key()); + if((e->modifiers()==(Qt::ShiftModifier | Qt::ControlModifier)) && (e->key()==Qt::Key_L)) + this->clear(); + else + emit this->sendChar((char)e->key()); e->accept(); } + +void ApbUartTerminal::apbUartTextReceived(QString text) +{ + moveCursor (QTextCursor::End); + insertPlainText (text); + moveCursor (QTextCursor::End); +} diff --git a/APBUARTPLUGIN/apbuartterminal.h b/APBUARTPLUGIN/apbuartterminal.h --- a/APBUARTPLUGIN/apbuartterminal.h +++ b/APBUARTPLUGIN/apbuartterminal.h @@ -34,9 +34,9 @@ public: protected: void keyPressEvent(QKeyEvent * e); - +public slots: + void apbUartTextReceived(QString text); signals: - void apbUartTextReceived(QString text); void sendChar(char c); public slots: diff --git a/APBUARTPLUGIN/uartpollingthread.cpp b/APBUARTPLUGIN/uartpollingthread.cpp --- a/APBUARTPLUGIN/uartpollingthread.cpp +++ b/APBUARTPLUGIN/uartpollingthread.cpp @@ -29,9 +29,16 @@ UARTPollingThread::UARTPollingThread(soc uartMutex = new QMutex(); uartOpened = false; fifoDebugConfigured = false; + fifoDebugEnabled = false; this->moveToThread(this); } +UARTPollingThread::~UARTPollingThread() +{ + this->requestInterruption(); + while(isRunning()); +} + void UARTPollingThread::run() { @@ -70,19 +77,21 @@ void UARTPollingThread::run() else { int read =0; - char ch; + char ch[1]; uartMutex->lock(); if(uartOpened) { - read =rs232read(this->uart,&ch,1); + read =rs232read(this->uart,ch,1); + SocExplorerEngine::message(this->plugin,QString("Read %1 bytes on uart").arg(read),3); } uartMutex->unlock(); - if(read==1) + if(read>=1) { - emit this->sendChar(ch); + SocExplorerEngine::message(this->plugin,QString("Received one char from APBUART"),3); + emit this->apbUartTextReceived(QString(ch[0])); } + msleep(1); } - msleep(100); } } @@ -106,16 +115,20 @@ void UARTPollingThread::sendChar(char c) bool UARTPollingThread::openUart() { + uartMutex->lock(); if(uartOpened) { closeUart(); } + SocExplorerEngine::message(this->plugin,"Opening UART "+this->portName,3); this->uart = rs232open((char*)this->portName.toStdString().c_str()); if(this->uart!=badPortValue) { + SocExplorerEngine::message(this->plugin,QString("Configuring UART, speed =%1").arg(this->uartSpeed),3); rs232setup(this->uart,8,this->uartSpeed,rs232parityNo,rs232OneStop); uartOpened = true; } + uartMutex->unlock(); return uartOpened; } @@ -129,16 +142,19 @@ void UARTPollingThread::closeUart() void UARTPollingThread::setPortName(QString name) { + SocExplorerEngine::message(this->plugin,"Changing UART port Name: "+name,3); this->portName = name; } void UARTPollingThread::setPortSpeedStr(QString speed) { + SocExplorerEngine::message(this->plugin,"Changing UART speed: "+speed,3); this->uartSpeed = speed.toInt(); } void UARTPollingThread::setPortSpeed(int speed) { + SocExplorerEngine::message(this->plugin,QString("Changing UART speed: %1").arg(speed),3); this->uartSpeed = speed; } diff --git a/APBUARTPLUGIN/uartpollingthread.h b/APBUARTPLUGIN/uartpollingthread.h --- a/APBUARTPLUGIN/uartpollingthread.h +++ b/APBUARTPLUGIN/uartpollingthread.h @@ -39,6 +39,7 @@ class UARTPollingThread : public QThread Q_OBJECT public: explicit UARTPollingThread(socexplorerplugin *parent = 0); + ~UARTPollingThread(); void run(); signals: void apbUartTextReceived(QString text); diff --git a/spwplugin/GR-ESB/gr_esb_bridge.cpp b/spwplugin/GR-ESB/gr_esb_bridge.cpp --- a/spwplugin/GR-ESB/gr_esb_bridge.cpp +++ b/spwplugin/GR-ESB/gr_esb_bridge.cpp @@ -40,6 +40,8 @@ GR_ESB_bridge::GR_ESB_bridge(socexplorer GR_ESB_bridge::~GR_ESB_bridge() { + this->manager->requestInterruption(); + while(this->manager->isRunning()); } void GR_ESB_bridge::toggleBridgeConnection() diff --git a/spwplugin/StarDundee/stardundeespw_usb.cpp b/spwplugin/StarDundee/stardundeespw_usb.cpp --- a/spwplugin/StarDundee/stardundeespw_usb.cpp +++ b/spwplugin/StarDundee/stardundeespw_usb.cpp @@ -37,6 +37,7 @@ stardundeeSPW_USB::stardundeeSPW_USB(soc stardundeeSPW_USB::~stardundeeSPW_USB() { this->manager->requestInterruption(); + while(this->manager->isRunning()); } void stardundeeSPW_USB::toggleBridgeConnection()