Changeset View
Changeset View
Standalone View
Standalone View
src/core/atcore.cpp
Context not available. | |||||
76 | { | 76 | { | ||
---|---|---|---|---|---|
77 | //Register MetaTypes | 77 | //Register MetaTypes | ||
78 | qRegisterMetaType<AtCore::STATES>("AtCore::STATES"); | 78 | qRegisterMetaType<AtCore::STATES>("AtCore::STATES"); | ||
79 | setState(AtCore::DISCONNECTED); | 79 | setState(AtCore::STATES::DISCONNECTED); | ||
80 | 80 | | |||
81 | //Create and start the timer that checks for temperature. | 81 | //Create and start the timer that checks for temperature. | ||
82 | d->tempTimer = new QTimer(this); | 82 | d->tempTimer = new QTimer(this); | ||
Context not available. | |||||
97 | return; | 97 | return; | ||
98 | } | 98 | } | ||
99 | } | 99 | } | ||
100 | setState(AtCore::DISCONNECTED); | 100 | setState(AtCore::STATES::DISCONNECTED); | ||
101 | } | 101 | } | ||
102 | 102 | | |||
103 | QString AtCore::version() const | 103 | QString AtCore::version() const | ||
Context not available. | |||||
133 | 133 | | |||
134 | void AtCore::findFirmware(const QByteArray &message) | 134 | void AtCore::findFirmware(const QByteArray &message) | ||
135 | { | 135 | { | ||
136 | if (state() == AtCore::DISCONNECTED) { | 136 | if (state() == AtCore::STATES::DISCONNECTED) { | ||
137 | qCWarning(ATCORE_CORE) << tr("Cant find firwmware, serial not connected!"); | 137 | qCWarning(ATCORE_CORE) << tr("Cant find firwmware, serial not connected!"); | ||
138 | return; | 138 | return; | ||
139 | } | 139 | } | ||
140 | 140 | | |||
141 | if (state() == AtCore::CONNECTING) { | 141 | if (state() == AtCore::STATES::CONNECTING) { | ||
142 | //Most Firmwares will return "start" on connect, some return their firmware name. | 142 | //Most Firmwares will return "start" on connect, some return their firmware name. | ||
143 | if (message.contains("start")) { | 143 | if (message.contains("start")) { | ||
144 | qCDebug(ATCORE_CORE) << "Waiting requestFirmware."; | 144 | qCDebug(ATCORE_CORE) << "Waiting requestFirmware."; | ||
Context not available. | |||||
195 | //Plugin was not loaded, Provide some debug info. | 195 | //Plugin was not loaded, Provide some debug info. | ||
196 | qCDebug(ATCORE_CORE) << "Plugin Loading: Failed."; | 196 | qCDebug(ATCORE_CORE) << "Plugin Loading: Failed."; | ||
197 | qCDebug(ATCORE_CORE) << d->pluginLoader.errorString(); | 197 | qCDebug(ATCORE_CORE) << d->pluginLoader.errorString(); | ||
198 | setState(AtCore::CONNECTING); | 198 | setState(AtCore::STATES::CONNECTING); | ||
199 | } else { | 199 | } else { | ||
200 | //Plugin was loaded successfully. | 200 | //Plugin was loaded successfully. | ||
201 | d->firmwarePlugin = qobject_cast<IFirmware *>(d->pluginLoader.instance()); | 201 | d->firmwarePlugin = qobject_cast<IFirmware *>(d->pluginLoader.instance()); | ||
Context not available. | |||||
225 | d->serial = new SerialLayer(port, baud); | 225 | d->serial = new SerialLayer(port, baud); | ||
226 | connect(serial(), &SerialLayer::serialError, this, &AtCore::handleSerialError); | 226 | connect(serial(), &SerialLayer::serialError, this, &AtCore::handleSerialError); | ||
227 | if (serialInitialized() && d->serial->isWritable()) { | 227 | if (serialInitialized() && d->serial->isWritable()) { | ||
228 | setState(AtCore::CONNECTING); | 228 | setState(AtCore::STATES::CONNECTING); | ||
229 | connect(serial(), &SerialLayer::receivedCommand, this, &AtCore::findFirmware); | 229 | connect(serial(), &SerialLayer::receivedCommand, this, &AtCore::findFirmware); | ||
230 | d->serialTimer->stop(); | 230 | d->serialTimer->stop(); | ||
231 | return true; | 231 | return true; | ||
Context not available. | |||||
324 | 324 | | |||
325 | void AtCore::setRelativePosition() | 325 | void AtCore::setRelativePosition() | ||
326 | { | 326 | { | ||
327 | pushCommand(GCode::toCommand(GCode::G91)); | 327 | pushCommand(GCode::toCommand(GCode::GCommands::G91)); | ||
328 | } | 328 | } | ||
329 | 329 | | |||
330 | void AtCore::setAbsolutePosition() | 330 | void AtCore::setAbsolutePosition() | ||
331 | { | 331 | { | ||
332 | pushCommand(GCode::toCommand(GCode::G90)); | 332 | pushCommand(GCode::toCommand(GCode::GCommands::G90)); | ||
333 | } | 333 | } | ||
334 | 334 | | |||
335 | float AtCore::percentagePrinted() const | 335 | float AtCore::percentagePrinted() const | ||
Context not available. | |||||
339 | 339 | | |||
340 | void AtCore::print(const QString &fileName, bool sdPrint) | 340 | void AtCore::print(const QString &fileName, bool sdPrint) | ||
341 | { | 341 | { | ||
342 | if (state() == AtCore::CONNECTING) { | 342 | if (state() == AtCore::STATES::CONNECTING) { | ||
343 | qCDebug(ATCORE_CORE) << "Load a firmware plugin to print."; | 343 | qCDebug(ATCORE_CORE) << "Load a firmware plugin to print."; | ||
344 | return; | 344 | return; | ||
345 | } | 345 | } | ||
346 | //Start a print job. | 346 | //Start a print job. | ||
347 | setState(AtCore::STARTPRINT); | 347 | setState(AtCore::STATES::STARTPRINT); | ||
348 | //Only try to print from Sd if the firmware has support for sd cards | 348 | //Only try to print from Sd if the firmware has support for sd cards | ||
349 | if (firmwarePlugin()->isSdSupported()) { | 349 | if (firmwarePlugin()->isSdSupported()) { | ||
350 | if (sdPrint) { | 350 | if (sdPrint) { | ||
351 | //Printing from the sd card requires us to send some M commands. | 351 | //Printing from the sd card requires us to send some M commands. | ||
352 | pushCommand(GCode::toCommand(GCode::M23, fileName)); | 352 | pushCommand(GCode::toCommand(GCode::MCommands::M23, fileName)); | ||
353 | d->sdCardFileName = fileName; | 353 | d->sdCardFileName = fileName; | ||
354 | pushCommand(GCode::toCommand(GCode::M24)); | 354 | pushCommand(GCode::toCommand(GCode::MCommands::M24)); | ||
355 | setState(AtCore::BUSY); | 355 | setState(AtCore::STATES::BUSY); | ||
356 | d->sdCardPrinting = true; | 356 | d->sdCardPrinting = true; | ||
357 | connect(d->tempTimer, &QTimer::timeout, this, &AtCore::sdCardPrintStatus); | 357 | connect(d->tempTimer, &QTimer::timeout, this, &AtCore::sdCardPrintStatus); | ||
358 | return; | 358 | return; | ||
Context not available. | |||||
387 | void AtCore::closeConnection() | 387 | void AtCore::closeConnection() | ||
388 | { | 388 | { | ||
389 | if (serialInitialized()) { | 389 | if (serialInitialized()) { | ||
390 | if (AtCore::state() == AtCore::BUSY && !d->sdCardPrinting) { | 390 | if (AtCore::state() == AtCore::STATES::BUSY && !d->sdCardPrinting) { | ||
391 | //We have to clean up the print job if printing from the host. | 391 | //We have to clean up the print job if printing from the host. | ||
392 | //However disconnecting while printing from sd card should not affect the print job. | 392 | //However disconnecting while printing from sd card should not affect the print job. | ||
393 | setState(AtCore::STOP); | 393 | setState(AtCore::STATES::STOP); | ||
394 | } | 394 | } | ||
395 | if (firmwarePluginLoaded()) { | 395 | if (firmwarePluginLoaded()) { | ||
396 | disconnect(firmwarePlugin(), &IFirmware::readyForCommand, this, &AtCore::processQueue); | 396 | disconnect(firmwarePlugin(), &IFirmware::readyForCommand, this, &AtCore::processQueue); | ||
Context not available. | |||||
409 | serial()->close(); | 409 | serial()->close(); | ||
410 | //Clear our copy of the sdcard filelist | 410 | //Clear our copy of the sdcard filelist | ||
411 | clearSdCardFileList(); | 411 | clearSdCardFileList(); | ||
412 | setState(AtCore::DISCONNECTED); | 412 | setState(AtCore::STATES::DISCONNECTED); | ||
413 | d->serialTimer->start(); | 413 | d->serialTimer->start(); | ||
414 | } | 414 | } | ||
415 | } | 415 | } | ||
Context not available. | |||||
426 | .arg(QVariant::fromValue(d->printerState).value<QString>(), | 426 | .arg(QVariant::fromValue(d->printerState).value<QString>(), | ||
427 | QVariant::fromValue(state).value<QString>()); | 427 | QVariant::fromValue(state).value<QString>()); | ||
428 | d->printerState = state; | 428 | d->printerState = state; | ||
429 | if (state == AtCore::FINISHEDPRINT && d->sdCardPrinting) { | 429 | if (state == AtCore::STATES::FINISHEDPRINT && d->sdCardPrinting) { | ||
430 | //Clean up the sd card print | 430 | //Clean up the sd card print | ||
431 | d->sdCardPrinting = false; | 431 | d->sdCardPrinting = false; | ||
432 | disconnect(d->tempTimer, &QTimer::timeout, this, &AtCore::sdCardPrintStatus); | 432 | disconnect(d->tempTimer, &QTimer::timeout, this, &AtCore::sdCardPrintStatus); | ||
Context not available. | |||||
438 | void AtCore::stop() | 438 | void AtCore::stop() | ||
439 | { | 439 | { | ||
440 | //Stop a print job | 440 | //Stop a print job | ||
441 | setState(AtCore::STOP); | 441 | setState(AtCore::STATES::STOP); | ||
442 | d->commandQueue.clear(); | 442 | d->commandQueue.clear(); | ||
443 | if (d->sdCardPrinting) { | 443 | if (d->sdCardPrinting) { | ||
444 | stopSdPrint(); | 444 | stopSdPrint(); | ||
445 | } | 445 | } | ||
446 | setExtruderTemp(0, 0); | 446 | setExtruderTemp(0, 0); | ||
447 | setBedTemp(0); | 447 | setBedTemp(0); | ||
448 | home(AtCore::X); | 448 | home(AtCore::AXES::X); | ||
449 | } | 449 | } | ||
450 | 450 | | |||
451 | void AtCore::emergencyStop() | 451 | void AtCore::emergencyStop() | ||
Context not available. | |||||
455 | //Before sending the command to ensure | 455 | //Before sending the command to ensure | ||
456 | //Less chance of movement after the restart. | 456 | //Less chance of movement after the restart. | ||
457 | d->commandQueue.clear(); | 457 | d->commandQueue.clear(); | ||
458 | if (AtCore::state() == AtCore::BUSY) { | 458 | if (AtCore::state() == AtCore::STATES::BUSY) { | ||
459 | if (!d->sdCardPrinting) { | 459 | if (!d->sdCardPrinting) { | ||
460 | //Stop our running print thread | 460 | //Stop our running print thread | ||
461 | setState(AtCore::STOP); | 461 | setState(AtCore::STATES::STOP); | ||
462 | } | 462 | } | ||
463 | } | 463 | } | ||
464 | //push command through serial to bypass atcore's queue. | 464 | //push command through serial to bypass atcore's queue. | ||
465 | serial()->pushCommand(GCode::toCommand(GCode::M112).toLocal8Bit()); | 465 | serial()->pushCommand(GCode::toCommand(GCode::MCommands::M112).toLocal8Bit()); | ||
466 | } | 466 | } | ||
467 | 467 | | |||
468 | void AtCore::stopSdPrint() | 468 | void AtCore::stopSdPrint() | ||
469 | { | 469 | { | ||
470 | //Stop an SdCard Print. | 470 | //Stop an SdCard Print. | ||
471 | pushCommand(GCode::toCommand(GCode::M25)); | 471 | pushCommand(GCode::toCommand(GCode::MCommands::M25)); | ||
472 | d->sdCardFileName = QString(); | 472 | d->sdCardFileName = QString(); | ||
473 | pushCommand(GCode::toCommand(GCode::M23, d->sdCardFileName)); | 473 | pushCommand(GCode::toCommand(GCode::MCommands::M23, d->sdCardFileName)); | ||
474 | AtCore::setState(AtCore::FINISHEDPRINT); | 474 | AtCore::setState(AtCore::STATES::FINISHEDPRINT); | ||
475 | AtCore::setState(AtCore::IDLE); | 475 | AtCore::setState(AtCore::STATES::IDLE); | ||
476 | } | 476 | } | ||
477 | 477 | | |||
478 | void AtCore::requestFirmware() | 478 | void AtCore::requestFirmware() | ||
479 | { | 479 | { | ||
480 | if (serialInitialized()) { | 480 | if (serialInitialized()) { | ||
481 | qCDebug(ATCORE_CORE) << "Sending " << GCode::description(GCode::M115); | 481 | qCDebug(ATCORE_CORE) << "Sending " << GCode::description(GCode::MCommands::M115); | ||
482 | serial()->pushCommand(GCode::toCommand(GCode::M115).toLocal8Bit()); | 482 | serial()->pushCommand(GCode::toCommand(GCode::MCommands::M115).toLocal8Bit()); | ||
483 | } else { | 483 | } else { | ||
484 | qCDebug(ATCORE_CORE) << "There is no open device to send commands"; | 484 | qCDebug(ATCORE_CORE) << "There is no open device to send commands"; | ||
485 | } | 485 | } | ||
Context not available. | |||||
532 | void AtCore::pause(const QString &pauseActions) | 532 | void AtCore::pause(const QString &pauseActions) | ||
533 | { | 533 | { | ||
534 | if (d->sdCardPrinting) { | 534 | if (d->sdCardPrinting) { | ||
535 | pushCommand(GCode::toCommand(GCode::M25)); | 535 | pushCommand(GCode::toCommand(GCode::MCommands::M25)); | ||
536 | } | 536 | } | ||
537 | //Push the command to request current coordinates. | 537 | //Push the command to request current coordinates. | ||
538 | //This will be read by AtCore::newMessage and stored for use on resume. | 538 | //This will be read by AtCore::newMessage and stored for use on resume. | ||
539 | pushCommand(GCode::toCommand(GCode::M114)); | 539 | pushCommand(GCode::toCommand(GCode::MCommands::M114)); | ||
540 | if (!pauseActions.isEmpty()) { | 540 | if (!pauseActions.isEmpty()) { | ||
541 | QStringList temp = pauseActions.split(QChar::fromLatin1(',')); | 541 | QStringList temp = pauseActions.split(QChar::fromLatin1(',')); | ||
542 | for (int i = 0; i < temp.length(); i++) { | 542 | for (int i = 0; i < temp.length(); i++) { | ||
Context not available. | |||||
549 | void AtCore::resume() | 549 | void AtCore::resume() | ||
550 | { | 550 | { | ||
551 | if (d->sdCardPrinting) { | 551 | if (d->sdCardPrinting) { | ||
552 | pushCommand(GCode::toCommand(GCode::M24)); | 552 | pushCommand(GCode::toCommand(GCode::MCommands::M24)); | ||
553 | } else { | 553 | } else { | ||
554 | //Move back to previous coordinates. | 554 | //Move back to previous coordinates. | ||
555 | pushCommand(GCode::toCommand(GCode::G0, QString::fromLatin1(d->posString))); | 555 | pushCommand(GCode::toCommand(GCode::GCommands::G0, QString::fromLatin1(d->posString))); | ||
556 | } | 556 | } | ||
557 | setState(AtCore::BUSY); | 557 | setState(AtCore::BUSY); | ||
558 | } | 558 | } | ||
Context not available. | |||||
561 | 561 | | |||
562 | void AtCore::home() | 562 | void AtCore::home() | ||
563 | { | 563 | { | ||
564 | pushCommand(GCode::toCommand(GCode::G28)); | 564 | pushCommand(GCode::toCommand(GCode::GCommands::G28)); | ||
565 | } | 565 | } | ||
566 | 566 | | |||
567 | void AtCore::home(uchar axis) | 567 | void AtCore::home(uchar axis) | ||
568 | { | 568 | { | ||
569 | QString args; | 569 | QString args; | ||
570 | 570 | | |||
571 | if (axis & AtCore::X) { | 571 | if (axis & AtCore::AXES::X) { | ||
572 | args.append(QStringLiteral("X0 ")); | 572 | args.append(QStringLiteral("X0 ")); | ||
573 | } | 573 | } | ||
574 | 574 | | |||
575 | if (axis & AtCore::Y) { | 575 | if (axis & AtCore::AXES::Y) { | ||
576 | args.append(QStringLiteral("Y0 ")); | 576 | args.append(QStringLiteral("Y0 ")); | ||
577 | } | 577 | } | ||
578 | 578 | | |||
579 | if (axis & AtCore::Z) { | 579 | if (axis & AtCore::AXES::Z) { | ||
580 | args.append(QStringLiteral("Z0")); | 580 | args.append(QStringLiteral("Z0")); | ||
581 | } | 581 | } | ||
582 | pushCommand(GCode::toCommand(GCode::G28, args)); | 582 | pushCommand(GCode::toCommand(GCode::GCommands::G28, args)); | ||
583 | } | 583 | } | ||
584 | 584 | | |||
585 | void AtCore::setExtruderTemp(uint temp, uint extruder, bool andWait) | 585 | void AtCore::setExtruderTemp(uint temp, uint extruder, bool andWait) | ||
Context not available. | |||||
588 | extruder = std::min<uint>(extruder, 10000); | 588 | extruder = std::min<uint>(extruder, 10000); | ||
589 | 589 | | |||
590 | if (andWait) { | 590 | if (andWait) { | ||
591 | pushCommand(GCode::toCommand(GCode::M109, QString::number(temp), QString::number(extruder))); | 591 | pushCommand(GCode::toCommand(GCode::MCommands::M109, QString::number(temp), QString::number(extruder))); | ||
592 | } else { | 592 | } else { | ||
593 | pushCommand(GCode::toCommand(GCode::M104, QString::number(extruder), QString::number(temp))); | 593 | pushCommand(GCode::toCommand(GCode::MCommands::M104, QString::number(extruder), QString::number(temp))); | ||
594 | } | 594 | } | ||
595 | } | 595 | } | ||
596 | 596 | | |||
Context not available. | |||||
599 | temp = std::min<uint>(temp, 10000); | 599 | temp = std::min<uint>(temp, 10000); | ||
600 | 600 | | |||
601 | if (andWait) { | 601 | if (andWait) { | ||
602 | pushCommand(GCode::toCommand(GCode::M190, QString::number(temp))); | 602 | pushCommand(GCode::toCommand(GCode::MCommands::M190, QString::number(temp))); | ||
603 | } else { | 603 | } else { | ||
604 | pushCommand(GCode::toCommand(GCode::M140, QString::number(temp))); | 604 | pushCommand(GCode::toCommand(GCode::MCommands::M140, QString::number(temp))); | ||
605 | } | 605 | } | ||
606 | } | 606 | } | ||
607 | 607 | | |||
Context not available. | |||||
610 | speed = std::min<uint>(speed, 10000); | 610 | speed = std::min<uint>(speed, 10000); | ||
611 | fanNumber = std::min<uint>(fanNumber, 10000); | 611 | fanNumber = std::min<uint>(fanNumber, 10000); | ||
612 | 612 | | |||
613 | pushCommand(GCode::toCommand(GCode::M106, QString::number(fanNumber), QString::number(speed))); | 613 | pushCommand(GCode::toCommand(GCode::MCommands::M106, QString::number(fanNumber), QString::number(speed))); | ||
614 | } | 614 | } | ||
615 | 615 | | |||
616 | void AtCore::setPrinterSpeed(uint speed) | 616 | void AtCore::setPrinterSpeed(uint speed) | ||
617 | { | 617 | { | ||
618 | speed = std::min<uint>(speed, 10000); | 618 | speed = std::min<uint>(speed, 10000); | ||
619 | pushCommand(GCode::toCommand(GCode::M220, QString::number(speed))); | 619 | pushCommand(GCode::toCommand(GCode::MCommands::M220, QString::number(speed))); | ||
620 | } | 620 | } | ||
621 | 621 | | |||
622 | void AtCore::setFlowRate(uint speed) | 622 | void AtCore::setFlowRate(uint speed) | ||
623 | { | 623 | { | ||
624 | speed = std::min<uint>(speed, 10000); | 624 | speed = std::min<uint>(speed, 10000); | ||
625 | pushCommand(GCode::toCommand(GCode::M221, QString::number(speed))); | 625 | pushCommand(GCode::toCommand(GCode::MCommands::M221, QString::number(speed))); | ||
626 | } | 626 | } | ||
627 | 627 | | |||
628 | void AtCore::move(AtCore::AXES axis, double arg) | 628 | void AtCore::move(AtCore::AXES axis, double arg) | ||
Context not available. | |||||
636 | //Using QString::number(double, format, precision) | 636 | //Using QString::number(double, format, precision) | ||
637 | //f = 'format as [-]9.9' | 637 | //f = 'format as [-]9.9' | ||
638 | //3 = use 3 decimal precision | 638 | //3 = use 3 decimal precision | ||
639 | pushCommand(GCode::toCommand(GCode::G1, QStringLiteral("%1 %2").arg(axis).arg(QString::number(arg, 'f', 3)))); | 639 | pushCommand(GCode::toCommand(GCode::GCommands::G1, QStringLiteral("%1 %2").arg(axis).arg(QString::number(arg, 'f', 3)))); | ||
640 | } | 640 | } | ||
641 | 641 | | |||
642 | int AtCore::extruderCount() const | 642 | int AtCore::extruderCount() const | ||
Context not available. | |||||
678 | void AtCore::checkTemperature() | 678 | void AtCore::checkTemperature() | ||
679 | { | 679 | { | ||
680 | //One request for the temperature in the queue at a time. | 680 | //One request for the temperature in the queue at a time. | ||
681 | if (d->commandQueue.contains(GCode::toCommand(GCode::M105))) { | 681 | if (d->commandQueue.contains(GCode::toCommand(GCode::MCommands::M105))) { | ||
682 | return; | 682 | return; | ||
683 | } | 683 | } | ||
684 | pushCommand(GCode::toCommand(GCode::M105)); | 684 | pushCommand(GCode::toCommand(GCode::MCommands::M105)); | ||
685 | } | 685 | } | ||
686 | 686 | | |||
687 | void AtCore::showMessage(const QString &message) | 687 | void AtCore::showMessage(const QString &message) | ||
688 | { | 688 | { | ||
689 | if (!message.isEmpty()) { | 689 | if (!message.isEmpty()) { | ||
690 | pushCommand(GCode::toCommand((GCode::M117), message)); | 690 | pushCommand(GCode::toCommand((GCode::MCommands::M117), message)); | ||
691 | } | 691 | } | ||
692 | } | 692 | } | ||
693 | 693 | | |||
694 | void AtCore::setUnits(AtCore::UNITS units) | 694 | void AtCore::setUnits(AtCore::UNITS units) | ||
695 | { | 695 | { | ||
696 | switch (units) { | 696 | switch (units) { | ||
697 | case AtCore::METRIC: | 697 | case AtCore::UNITS::METRIC: | ||
698 | pushCommand(GCode::toCommand(GCode::G21)); | 698 | pushCommand(GCode::toCommand(GCode::GCommands::G21)); | ||
699 | break; | 699 | break; | ||
700 | case AtCore::IMPERIAL: | 700 | case AtCore::UNITS::IMPERIAL: | ||
701 | pushCommand(GCode::toCommand(GCode::G20)); | 701 | pushCommand(GCode::toCommand(GCode::GCommands::G20)); | ||
702 | break; | 702 | break; | ||
703 | } | 703 | } | ||
704 | } | 704 | } | ||
Context not available. | |||||
712 | { | 712 | { | ||
713 | //Disables motors | 713 | //Disables motors | ||
714 | if (delay) { | 714 | if (delay) { | ||
715 | pushCommand(GCode::toCommand(GCode::M84, QString::number(delay))); | 715 | pushCommand(GCode::toCommand(GCode::MCommands::M84, QString::number(delay))); | ||
716 | } else { | 716 | } else { | ||
717 | pushCommand(GCode::toCommand(GCode::M84)); | 717 | pushCommand(GCode::toCommand(GCode::MCommands::M84)); | ||
718 | } | 718 | } | ||
719 | } | 719 | } | ||
720 | //Most firmwares will not report if an sdcard is mounted on boot. | 720 | //Most firmwares will not report if an sdcard is mounted on boot. | ||
Context not available. | |||||
733 | 733 | | |||
734 | void AtCore::getSDFileList() | 734 | void AtCore::getSDFileList() | ||
735 | { | 735 | { | ||
736 | pushCommand(GCode::toCommand(GCode::M20)); | 736 | pushCommand(GCode::toCommand(GCode::MCommands::M20)); | ||
737 | } | 737 | } | ||
738 | 738 | | |||
739 | QStringList AtCore::sdFileList() | 739 | QStringList AtCore::sdFileList() | ||
Context not available. | |||||
759 | void AtCore::sdDelete(const QString &fileName) | 759 | void AtCore::sdDelete(const QString &fileName) | ||
760 | { | 760 | { | ||
761 | if (d->sdCardFileList.contains(fileName)) { | 761 | if (d->sdCardFileList.contains(fileName)) { | ||
762 | pushCommand(GCode::toCommand(GCode::M30, fileName)); | 762 | pushCommand(GCode::toCommand(GCode::MCommands::M30, fileName)); | ||
763 | getSDFileList(); | 763 | getSDFileList(); | ||
764 | } else { | 764 | } else { | ||
765 | qCDebug(ATCORE_CORE) << "Delete failed file not found:" << fileName; | 765 | qCDebug(ATCORE_CORE) << "Delete failed file not found:" << fileName; | ||
Context not available. | |||||
768 | 768 | | |||
769 | void AtCore::mountSd(uint slot) | 769 | void AtCore::mountSd(uint slot) | ||
770 | { | 770 | { | ||
771 | pushCommand(GCode::toCommand(GCode::M21, QString::number(slot))); | 771 | pushCommand(GCode::toCommand(GCode::MCommands::M21, QString::number(slot))); | ||
772 | } | 772 | } | ||
773 | 773 | | |||
774 | void AtCore::umountSd(uint slot) | 774 | void AtCore::umountSd(uint slot) | ||
775 | { | 775 | { | ||
776 | pushCommand(GCode::toCommand(GCode::M22, QString::number(slot))); | 776 | pushCommand(GCode::toCommand(GCode::MCommands::M22, QString::number(slot))); | ||
777 | } | 777 | } | ||
778 | 778 | | |||
779 | bool AtCore::isReadingSdCardList() const | 779 | bool AtCore::isReadingSdCardList() const | ||
Context not available. | |||||
789 | void AtCore::sdCardPrintStatus() | 789 | void AtCore::sdCardPrintStatus() | ||
790 | { | 790 | { | ||
791 | //One request for the Sd Job status in the queue at a time. | 791 | //One request for the Sd Job status in the queue at a time. | ||
792 | if (d->commandQueue.contains(GCode::toCommand(GCode::M27))) { | 792 | if (d->commandQueue.contains(GCode::toCommand(GCode::MCommands::M27))) { | ||
793 | return; | 793 | return; | ||
794 | } | 794 | } | ||
795 | pushCommand(GCode::toCommand(GCode::M27)); | 795 | pushCommand(GCode::toCommand(GCode::MCommands::M27)); | ||
796 | } | 796 | } | ||
797 | 797 | | |||
798 | void AtCore::disableResetOnConnect(const QString &port) | 798 | void AtCore::disableResetOnConnect(const QString &port) | ||
Context not available. | |||||
818 | QString errorString; | 818 | QString errorString; | ||
819 | 819 | | |||
820 | switch (error) { | 820 | switch (error) { | ||
821 | case (QSerialPort::DeviceNotFoundError): | 821 | case (QSerialPort::SerialPortError::DeviceNotFoundError): | ||
822 | errorString = tr("Device not found"); | 822 | errorString = tr("Device not found"); | ||
823 | break; | 823 | break; | ||
824 | case (QSerialPort::WriteError): | 824 | case (QSerialPort::SerialPortError::WriteError): | ||
825 | errorString = tr("Unable to write to device"); | 825 | errorString = tr("Unable to write to device"); | ||
826 | break; | 826 | break; | ||
827 | case (QSerialPort::ReadError): | 827 | case (QSerialPort::SerialPortError::ReadError): | ||
828 | errorString = tr("Unable to read from device"); | 828 | errorString = tr("Unable to read from device"); | ||
829 | break; | 829 | break; | ||
830 | case (QSerialPort::ResourceError): | 830 | case (QSerialPort::SerialPortError::ResourceError): | ||
831 | case (QSerialPort::TimeoutError): | 831 | case (QSerialPort::SerialPortError::TimeoutError): | ||
832 | errorString = tr("The device no longer available"); | 832 | errorString = tr("The device no longer available"); | ||
833 | closeConnection(); | 833 | closeConnection(); | ||
834 | break; | 834 | break; | ||
835 | case (QSerialPort::UnsupportedOperationError): | 835 | case (QSerialPort::SerialPortError::UnsupportedOperationError): | ||
836 | errorString = tr("Device does not support the operation"); | 836 | errorString = tr("Device does not support the operation"); | ||
837 | break; | 837 | break; | ||
838 | case (QSerialPort::UnknownError): | 838 | case (QSerialPort::SerialPortError::UnknownError): | ||
839 | errorString = tr("Unknown Error"); | 839 | errorString = tr("Unknown Error"); | ||
840 | break; | 840 | break; | ||
841 | default: | 841 | default: | ||
Context not available. |