kopia lustrzana https://gitlab.com/eliggett/wfview
Attempt at simple collision detection
rodzic
9afc661c4c
commit
feac83b997
|
@ -103,6 +103,8 @@ void commHandler::sendDataOut(const QByteArray &writeData)
|
|||
|
||||
qint64 bytesWritten;
|
||||
|
||||
previousSent = writeData;
|
||||
|
||||
if(PTTviaRTS)
|
||||
{
|
||||
// Size: 1 2 3 4 5 6 7 8
|
||||
|
@ -170,6 +172,13 @@ void commHandler::receiveDataIn()
|
|||
port->startTransaction();
|
||||
inPortData = port->readAll();
|
||||
|
||||
if (inPortData.startsWith("\xFC\xFC\xFC\xFC\xFC"))
|
||||
{
|
||||
// Colission detected by remote end, re-send previous command.
|
||||
sendDataOut(previousSent);
|
||||
return;
|
||||
}
|
||||
|
||||
if(inPortData.size() == 1)
|
||||
{
|
||||
// Generally for baud <= 9600
|
||||
|
@ -185,7 +194,6 @@ void commHandler::receiveDataIn()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if (inPortData.startsWith("\xFE\xFE"))
|
||||
{
|
||||
if(inPortData.contains("\xFC"))
|
||||
|
|
|
@ -57,6 +57,7 @@ private:
|
|||
//QDataStream stream;
|
||||
QByteArray outPortData;
|
||||
QByteArray inPortData;
|
||||
QByteArray previousSent;
|
||||
|
||||
//QDataStream outStream;
|
||||
//QDataStream inStream;
|
||||
|
|
Ładowanie…
Reference in New Issue