Changeset View
Changeset View
Standalone View
Standalone View
src/core/atcore.cpp
Show First 20 Lines • Show All 749 Lines • ▼ Show 20 Line(s) | 749 | if (d->extruderCount != newCount && newCount >= 1) { | |||
---|---|---|---|---|---|
750 | d->extruderCount = newCount; | 750 | d->extruderCount = newCount; | ||
751 | emit extruderCountChanged(newCount); | 751 | emit extruderCountChanged(newCount); | ||
752 | qCDebug(ATCORE_CORE) << "Extruder Count:" << QString::number(extruderCount()); | 752 | qCDebug(ATCORE_CORE) << "Extruder Count:" << QString::number(extruderCount()); | ||
753 | } | 753 | } | ||
754 | } | 754 | } | ||
755 | void AtCore::processQueue() | 755 | void AtCore::processQueue() | ||
756 | { | 756 | { | ||
757 | d->ready = true; | 757 | d->ready = true; | ||
758 | | ||||
759 | if (d->commandQueue.isEmpty()) { | 758 | if (d->commandQueue.isEmpty()) { | ||
760 | return; | 759 | return; | ||
761 | } | 760 | } | ||
762 | | ||||
763 | if (!serialInitialized()) { | 761 | if (!serialInitialized()) { | ||
764 | qCDebug(ATCORE_PLUGIN) << "Can't process queue ! Serial not initialized."; | 762 | qCDebug(ATCORE_PLUGIN) << "Can't process queue ! Serial not initialized."; | ||
765 | return; | 763 | return; | ||
766 | } | 764 | } | ||
767 | 765 | | |||
768 | d->lastCommand = d->commandQueue.takeAt(0); | 766 | d->lastCommand = d->commandQueue.takeAt(0); | ||
769 | 767 | | |||
768 | for (int attempts = 0; attempts < 3; attempts++) { | ||||
770 | if (firmwarePluginLoaded()) { | 769 | if (firmwarePluginLoaded()) { | ||
771 | d->serial->pushCommand(firmwarePlugin()->translate(d->lastCommand)); | 770 | d->serial->pushCommand(firmwarePlugin()->translate(d->lastCommand)); | ||
772 | } else { | 771 | } else { | ||
773 | d->serial->pushCommand(d->lastCommand.toLocal8Bit()); | 772 | d->serial->pushCommand(d->lastCommand.toLocal8Bit()); | ||
774 | } | 773 | } | ||
774 | | ||||
775 | if (d->lastMessage.contains(QStringLiteral("Resend").toLatin1())) { | ||||
776 | qCDebug(ATCORE_CORE) << QStringLiteral("Retry attempt: %1").arg(QString::number(attempts + 1)); | ||||
777 | } else { | ||||
778 | d->ready = false; | ||||
779 | return; | ||||
780 | } | ||||
patrickelectric: if( ! contains
d->ready = false
return
with this you can remove the else | |||||
781 | } | ||||
782 | qCDebug(ATCORE_CORE) << QStringLiteral("Failed To Push: %1").arg(d->lastCommand); | ||||
775 | d->ready = false; | 783 | d->ready = false; | ||
776 | } | 784 | } | ||
777 | 785 | | |||
778 | void AtCore::checkTemperature() | 786 | void AtCore::checkTemperature() | ||
779 | { | 787 | { | ||
780 | //One request for the temperature in the queue at a time. | 788 | //One request for the temperature in the queue at a time. | ||
781 | if (d->commandQueue.contains(GCode::toCommand(GCode::MCommands::M105))) { | 789 | if (d->commandQueue.contains(GCode::toCommand(GCode::MCommands::M105))) { | ||
782 | return; | 790 | return; | ||
▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines |
if( ! contains
d->ready = false
return
with this you can remove the else