From a14e463989edbebc9f1c6e5d70efd8c0fe2acf1a Mon Sep 17 00:00:00 2001 From: Nffj84 Date: Wed, 3 Jul 2024 18:40:13 +0300 Subject: [PATCH] Added small sleep after reading pipe. --- misc/camera/a8/remoteControl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/misc/camera/a8/remoteControl.cpp b/misc/camera/a8/remoteControl.cpp index a96c954..009bc3c 100644 --- a/misc/camera/a8/remoteControl.cpp +++ b/misc/camera/a8/remoteControl.cpp @@ -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); } }