mirror of
https://github.com/thunderbug1/Spherebot-Host-GUI.git
synced 2026-03-04 09:04:00 +01:00
outsourced the receiving to a seperate thread. This allows us to use much lower baudrates but still have a responsive UI. Set Baudrate to 57600 baud
28 lines
435 B
C++
28 lines
435 B
C++
#include "rxthread.h"
|
|
|
|
rxThread::rxThread(spherebot *uibot)
|
|
{
|
|
bot = uibot;
|
|
}
|
|
|
|
rxThread::~rxThread()
|
|
{
|
|
|
|
}
|
|
void rxThread::receiveData()
|
|
{
|
|
if(bot->port->canReadLine())
|
|
{
|
|
line = bot->port->readLine(1024);
|
|
line.chop(1);
|
|
qDebug()<<"receiving: " << line << endl;/////////////////////////////
|
|
emit lineReceived(line);
|
|
}
|
|
}
|
|
|
|
void rxThread::run()
|
|
{
|
|
qDebug()<<"start Receiver";
|
|
line = "";
|
|
}
|