Changeset View
Changeset View
Standalone View
Standalone View
src/core/atcore.cpp
Show First 20 Lines • Show All 298 Lines • ▼ Show 20 Line(s) | 297 | if (message.startsWith(QString::fromLatin1("X:").toLocal8Bit())) { | |||
---|---|---|---|---|---|
299 | d->posString.resize(d->posString.indexOf('E')); | 299 | d->posString.resize(d->posString.indexOf('E')); | ||
300 | d->posString.replace(':', ""); | 300 | d->posString.replace(':', ""); | ||
301 | } | 301 | } | ||
302 | 302 | | |||
303 | //Check if have temperature info and decode it | 303 | //Check if have temperature info and decode it | ||
304 | if (d->lastMessage.contains("T:") || d->lastMessage.contains("B:")) { | 304 | if (d->lastMessage.contains("T:") || d->lastMessage.contains("B:")) { | ||
305 | temperature().decodeTemp(message); | 305 | temperature().decodeTemp(message); | ||
306 | } | 306 | } | ||
307 | emit(receivedMessage(d->lastMessage)); | 307 | emit receivedMessage(d->lastMessage); | ||
308 | } | 308 | } | ||
309 | 309 | | |||
310 | void AtCore::setRelativePosition() | 310 | void AtCore::setRelativePosition() | ||
311 | { | 311 | { | ||
312 | pushCommand(GCode::toCommand(GCode::G91)); | 312 | pushCommand(GCode::toCommand(GCode::G91)); | ||
313 | } | 313 | } | ||
314 | 314 | | |||
315 | void AtCore::setAbsolutePosition() | 315 | void AtCore::setAbsolutePosition() | ||
▲ Show 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 408 | qCDebug(ATCORE_CORE) << QStringLiteral("Atcore state changed from [%1] to [%2]") | |||
409 | .arg(QVariant::fromValue(d->printerState).value<QString>()) | 409 | .arg(QVariant::fromValue(d->printerState).value<QString>()) | ||
410 | .arg(QVariant::fromValue(state).value<QString>()); | 410 | .arg(QVariant::fromValue(state).value<QString>()); | ||
411 | d->printerState = state; | 411 | d->printerState = state; | ||
412 | if (state == AtCore::FINISHEDPRINT && d->sdCardPrinting) { | 412 | if (state == AtCore::FINISHEDPRINT && d->sdCardPrinting) { | ||
413 | //Clean up the sd card print | 413 | //Clean up the sd card print | ||
414 | d->sdCardPrinting = false; | 414 | d->sdCardPrinting = false; | ||
415 | disconnect(d->tempTimer, &QTimer::timeout, this, &AtCore::sdCardPrintStatus); | 415 | disconnect(d->tempTimer, &QTimer::timeout, this, &AtCore::sdCardPrintStatus); | ||
416 | } | 416 | } | ||
417 | emit(stateChanged(d->printerState)); | 417 | emit stateChanged(d->printerState); | ||
418 | } | 418 | } | ||
419 | } | 419 | } | ||
420 | 420 | | |||
421 | void AtCore::stop() | 421 | void AtCore::stop() | ||
422 | { | 422 | { | ||
423 | //Stop a print job | 423 | //Stop a print job | ||
424 | setState(AtCore::STOP); | 424 | setState(AtCore::STOP); | ||
425 | d->commandQueue.clear(); | 425 | d->commandQueue.clear(); | ||
▲ Show 20 Lines • Show All 282 Lines • ▼ Show 20 Line(s) | |||||
708 | { | 708 | { | ||
709 | return d->sdCardMounted; | 709 | return d->sdCardMounted; | ||
710 | } | 710 | } | ||
711 | 711 | | |||
712 | void AtCore::setSdMounted(bool mounted) | 712 | void AtCore::setSdMounted(bool mounted) | ||
713 | { | 713 | { | ||
714 | if (mounted != isSdMounted()) { | 714 | if (mounted != isSdMounted()) { | ||
715 | d->sdCardMounted = mounted; | 715 | d->sdCardMounted = mounted; | ||
716 | emit(sdMountChanged(d->sdCardMounted)); | 716 | emit sdMountChanged(d->sdCardMounted); | ||
717 | } | 717 | } | ||
718 | } | 718 | } | ||
719 | 719 | | |||
720 | void AtCore::getSDFileList() | 720 | void AtCore::getSDFileList() | ||
721 | { | 721 | { | ||
722 | pushCommand(GCode::toCommand(GCode::M20)); | 722 | pushCommand(GCode::toCommand(GCode::M20)); | ||
723 | } | 723 | } | ||
724 | 724 | | |||
725 | QStringList AtCore::sdFileList() | 725 | QStringList AtCore::sdFileList() | ||
726 | { | 726 | { | ||
727 | if (!d->sdCardReadingFileList) { | 727 | if (!d->sdCardReadingFileList) { | ||
728 | getSDFileList(); | 728 | getSDFileList(); | ||
729 | } | 729 | } | ||
730 | return d->sdCardFileList; | 730 | return d->sdCardFileList; | ||
731 | } | 731 | } | ||
732 | 732 | | |||
733 | void AtCore::appendSdCardFileList(const QString &fileName) | 733 | void AtCore::appendSdCardFileList(const QString &fileName) | ||
734 | { | 734 | { | ||
735 | d->sdCardFileList.append(fileName); | 735 | d->sdCardFileList.append(fileName); | ||
736 | emit(sdCardFileListChanged(d->sdCardFileList)); | 736 | emit sdCardFileListChanged(d->sdCardFileList); | ||
737 | } | 737 | } | ||
738 | 738 | | |||
739 | void AtCore::clearSdCardFileList() | 739 | void AtCore::clearSdCardFileList() | ||
740 | { | 740 | { | ||
741 | d->sdCardFileList.clear(); | 741 | d->sdCardFileList.clear(); | ||
742 | emit(sdCardFileListChanged(d->sdCardFileList)); | 742 | emit sdCardFileListChanged(d->sdCardFileList); | ||
743 | } | 743 | } | ||
744 | 744 | | |||
745 | void AtCore::sdDelete(const QString &fileName) | 745 | void AtCore::sdDelete(const QString &fileName) | ||
746 | { | 746 | { | ||
747 | if (d->sdCardFileList.contains(fileName)) { | 747 | if (d->sdCardFileList.contains(fileName)) { | ||
748 | pushCommand(GCode::toCommand(GCode::M30, fileName)); | 748 | pushCommand(GCode::toCommand(GCode::M30, fileName)); | ||
749 | getSDFileList(); | 749 | getSDFileList(); | ||
750 | } else { | 750 | } else { | ||
Show All 32 Lines |