mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-22 06:46: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);
|
||||
|
||||
if (bytesRead > 0) {
|
||||
mIsBusy = true;
|
||||
buffer[bytesRead] = '\0';
|
||||
|
||||
QJsonDocument commandDoc = QJsonDocument::fromJson(buffer);
|
||||
@@ -261,6 +262,7 @@ void RemoteControl::run()
|
||||
|
||||
// Ignore own messages and messages that don't have sender
|
||||
if (commandObject.contains("sender") == false || commandObject["sender"] == FIFO_WHO_AM_I) {
|
||||
mIsBusy = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -305,10 +307,15 @@ void RemoteControl::run()
|
||||
Config::updateState();
|
||||
|
||||
QTimer::singleShot(0, this, [this, commandObject]() mutable { turnToTarget(commandObject); });
|
||||
} else {
|
||||
mIsBusy = false;
|
||||
}
|
||||
} else {
|
||||
mIsBusy = false;
|
||||
}
|
||||
}
|
||||
|
||||
QCoreApplication::processEvents();
|
||||
QThread::msleep(100);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user