mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-23 01:56:34 +00:00
Added small sleep after reading pipe.
This commit is contained in:
@@ -251,6 +251,7 @@ void RemoteControl::run()
|
|||||||
ssize_t bytesRead = read(mFifoFdIn, buffer, sizeof(buffer) - 1);
|
ssize_t bytesRead = read(mFifoFdIn, buffer, sizeof(buffer) - 1);
|
||||||
|
|
||||||
if (bytesRead > 0) {
|
if (bytesRead > 0) {
|
||||||
|
mIsBusy = true;
|
||||||
buffer[bytesRead] = '\0';
|
buffer[bytesRead] = '\0';
|
||||||
|
|
||||||
QJsonDocument commandDoc = QJsonDocument::fromJson(buffer);
|
QJsonDocument commandDoc = QJsonDocument::fromJson(buffer);
|
||||||
@@ -261,6 +262,7 @@ void RemoteControl::run()
|
|||||||
|
|
||||||
// Ignore own messages and messages that don't have sender
|
// Ignore own messages and messages that don't have sender
|
||||||
if (commandObject.contains("sender") == false || commandObject["sender"] == FIFO_WHO_AM_I) {
|
if (commandObject.contains("sender") == false || commandObject["sender"] == FIFO_WHO_AM_I) {
|
||||||
|
mIsBusy = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -305,10 +307,15 @@ void RemoteControl::run()
|
|||||||
Config::updateState();
|
Config::updateState();
|
||||||
|
|
||||||
QTimer::singleShot(0, this, [this, commandObject]() mutable { turnToTarget(commandObject); });
|
QTimer::singleShot(0, this, [this, commandObject]() mutable { turnToTarget(commandObject); });
|
||||||
|
} else {
|
||||||
|
mIsBusy = false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
mIsBusy = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
|
QThread::msleep(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user