diff --git a/src/core/atcore.cpp b/src/core/atcore.cpp --- a/src/core/atcore.cpp +++ b/src/core/atcore.cpp @@ -691,23 +691,29 @@ void AtCore::processQueue() { d->ready = true; - if (d->commandQueue.isEmpty()) { return; } - if (!serialInitialized()) { qCDebug(ATCORE_PLUGIN) << "Can't process queue ! Serial not initialized."; return; } - QString text = d->commandQueue.takeAt(0); + for (int attempts = 0; attempts < 3; attempts++) { + if (firmwarePluginLoaded()) { + d->serial->pushCommand(firmwarePlugin()->translate(text)); + } else { + d->serial->pushCommand(text.toLocal8Bit()); + } - if (firmwarePluginLoaded()) { - d->serial->pushCommand(firmwarePlugin()->translate(text)); - } else { - d->serial->pushCommand(text.toLocal8Bit()); + if (d->lastMessage.contains(QStringLiteral("Resend").toLatin1())) { + qCDebug(ATCORE_CORE) << QStringLiteral("Retry attempt: %1").arg(QString::number(attempts + 1)); + } else { + d->ready = false; + return; + } } + qCDebug(ATCORE_CORE) << QStringLiteral("Failed To Push: %1").arg(text); d->ready = false; }