Attempt at simple collision detection

smart-pointers
Phil Taylor 2023-02-11 11:40:30 +00:00
rodzic 9afc661c4c
commit feac83b997
2 zmienionych plików z 10 dodań i 1 usunięć

Wyświetl plik

@ -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"))

Wyświetl plik

@ -57,6 +57,7 @@ private:
//QDataStream stream;
QByteArray outPortData;
QByteArray inPortData;
QByteArray previousSent;
//QDataStream outStream;
//QDataStream inStream;