Changeset View
Changeset View
Standalone View
Standalone View
src/core/atcore.cpp
Show All 25 Lines | |||||
26 | #include <QDir> | 26 | #include <QDir> | ||
27 | #include <QSerialPortInfo> | 27 | #include <QSerialPortInfo> | ||
28 | #include <QPluginLoader> | 28 | #include <QPluginLoader> | ||
29 | #include <QCoreApplication> | 29 | #include <QCoreApplication> | ||
30 | #include <QLoggingCategory> | 30 | #include <QLoggingCategory> | ||
31 | #include <QTime> | 31 | #include <QTime> | ||
32 | #include <QTimer> | 32 | #include <QTimer> | ||
33 | #include <QThread> | 33 | #include <QThread> | ||
34 | #include <QMetaEnum> | ||||
34 | 35 | | |||
35 | #include "atcore.h" | 36 | #include "atcore.h" | ||
36 | #include "atcore_version.h" | 37 | #include "atcore_version.h" | ||
37 | #include "seriallayer.h" | 38 | #include "seriallayer.h" | ||
38 | #include "gcodecommands.h" | 39 | #include "gcodecommands.h" | ||
39 | #include "printthread.h" | 40 | #include "printthread.h" | ||
40 | #include "atcore_default_folders.h" | 41 | #include "atcore_default_folders.h" | ||
41 | 42 | | |||
▲ Show 20 Lines • Show All 553 Lines • ▼ Show 20 Line(s) | |||||
595 | 596 | | |||
596 | void AtCore::setFlowRate(uint speed) | 597 | void AtCore::setFlowRate(uint speed) | ||
597 | { | 598 | { | ||
598 | pushCommand(GCode::toCommand(GCode::M221, QString::number(speed))); | 599 | pushCommand(GCode::toCommand(GCode::M221, QString::number(speed))); | ||
599 | } | 600 | } | ||
600 | 601 | | |||
601 | void AtCore::move(AtCore::AXES axis, int arg) | 602 | void AtCore::move(AtCore::AXES axis, int arg) | ||
602 | { | 603 | { | ||
603 | static QLatin1Char a('?'); | 604 | const auto axisAsString = QMetaEnum::fromType<decltype(axis)>().valueToKey(axis); | ||
604 | switch (axis) { | 605 | move(QLatin1Char(axisAsString[0]), arg); | ||
605 | case AtCore::X: | | |||
606 | a = QLatin1Char('X'); | | |||
607 | break; | | |||
608 | case AtCore::Y: | | |||
609 | a = QLatin1Char('Y'); | | |||
610 | break; | | |||
611 | case AtCore::Z: | | |||
612 | a = QLatin1Char('Z'); | | |||
613 | break; | | |||
614 | case AtCore::E: | | |||
615 | a = QLatin1Char('E'); | | |||
616 | break; | | |||
617 | default: | | |||
618 | break; | | |||
619 | }; | | |||
620 | move(a, arg); | | |||
621 | } | 606 | } | ||
622 | 607 | | |||
623 | void AtCore::move(QLatin1Char axis, int arg) | 608 | void AtCore::move(QLatin1Char axis, int arg) | ||
624 | { | 609 | { | ||
625 | pushCommand(GCode::toCommand(GCode::G1, QStringLiteral("%1 %2").arg(axis).arg(QString::number(arg)))); | 610 | pushCommand(GCode::toCommand(GCode::G1, QStringLiteral("%1 %2").arg(axis).arg(QString::number(arg)))); | ||
626 | } | 611 | } | ||
627 | 612 | | |||
628 | int AtCore::extruderCount() const | 613 | int AtCore::extruderCount() const | ||
▲ Show 20 Lines • Show All 154 Lines • Show Last 20 Lines |