diff --git a/src/core/atcore.cpp b/src/core/atcore.cpp --- a/src/core/atcore.cpp +++ b/src/core/atcore.cpp @@ -769,23 +769,31 @@ void AtCore::processQueue() { d->ready = true; - if (d->commandQueue.isEmpty()) { return; } - if (!serialInitialized()) { qCDebug(ATCORE_PLUGIN) << "Can't process queue ! Serial not initialized."; return; } d->lastCommand = d->commandQueue.takeAt(0); - if (firmwarePluginLoaded()) { - d->serial->pushCommand(firmwarePlugin()->translate(d->lastCommand)); - } else { - d->serial->pushCommand(d->lastCommand.toLocal8Bit()); + for (int attempts = 0; attempts < 3; attempts++) { + if (firmwarePluginLoaded()) { + d->serial->pushCommand(firmwarePlugin()->translate(d->lastCommand)); + } else { + d->serial->pushCommand(d->lastCommand.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(d->lastCommand); d->ready = false; }