13#include <QSerialPortInfo>
16#include "atcore_export.h"
44class ATCORE_EXPORT
AtCore :
public QObject
47 Q_PROPERTY(QString version READ version CONSTANT)
48 Q_PROPERTY(QStringList availableFirmwarePlugins READ availableFirmwarePlugins NOTIFY availableFirmwarePluginsChanged)
49 Q_PROPERTY(
int extruderCount READ extruderCount WRITE setExtruderCount NOTIFY extruderCountChanged)
50 Q_PROPERTY(
int temperatureTimerInterval READ temperatureTimerInterval WRITE setTemperatureTimerInterval NOTIFY temperatureTimerIntervalChanged);
51 Q_PROPERTY(
int serialTimerInterval READ serialTimerInterval WRITE setSerialTimerInterval NOTIFY serialTimerIntervalChanged)
52 Q_PROPERTY(QStringList serialPorts READ serialPorts NOTIFY portsChanged)
53 Q_PROPERTY(
float percentagePrinted READ percentagePrinted NOTIFY printProgressChanged)
54 Q_PROPERTY(QStringList portSpeeds READ portSpeeds CONSTANT)
55 Q_PROPERTY(QString connectedPort READ connectedPort CONSTANT)
56 Q_PROPERTY(
AtCore::
STATES state READ state WRITE setState NOTIFY stateChanged)
57 Q_PROPERTY(
bool sdMount READ isSdMounted WRITE setSdMounted NOTIFY sdMountChanged)
58 Q_PROPERTY(QStringList sdFileList READ sdFileList NOTIFY sdCardFileListChanged)
59 Q_PROPERTY(
bool autoTemperatureReport READ autoTemperatureReport WRITE setAutoTemperatureReport NOTIFY autoTemperatureReportChanged)
60 Q_PROPERTY(
Temperature *temperature READ temperature CONSTANT)
62 friend class AtCoreTests;
109 explicit AtCore(QObject *parent =
nullptr);
116 QString version()
const;
123 QStringList serialPorts()
const;
129 QString connectedPort()
const;
140 Q_INVOKABLE
bool newConnection(
const QString &port,
int baud,
const QString &fwName,
bool disableROC =
false);
145 QStringList portSpeeds()
const;
151 Q_INVOKABLE
void closeConnection();
158 Q_INVOKABLE
IFirmware *firmwarePlugin()
const;
164 QStringList availableFirmwarePlugins()
const;
178 int extruderCount()
const;
184 float percentagePrinted()
const;
189 std::shared_ptr<BedDeform> bedDeform();
199 int serialTimerInterval()
const;
204 int temperatureTimerInterval()
const;
210 Q_INVOKABLE
void mountSd(uint slot = 0);
216 Q_INVOKABLE
void umountSd(uint slot = 0);
228 bool isSdMounted()
const;
234 bool autoTemperatureReport()
const;
338 Q_INVOKABLE
void updateFWPlugins();
345 Q_INVOKABLE
void pushCommand(
const QString &comm);
352 Q_INVOKABLE
void print(
const QString &fileName,
bool sdPrint =
false);
358 Q_INVOKABLE
void stop();
364 Q_INVOKABLE
void emergencyStop();
374 void pause(
const QString &pauseActions);
381 Q_INVOKABLE
void resume();
388 Q_INVOKABLE
void home(uchar axis);
394 Q_INVOKABLE
void home();
402 Q_INVOKABLE
void setExtruderTemp(uint temp = 0, uint extruder = 0,
bool andWait =
false);
418 Q_INVOKABLE
void move(QLatin1Char axis,
double arg);
426 Q_INVOKABLE
void setBedTemp(uint temp = 0,
bool andWait =
false);
433 Q_INVOKABLE
void setFanSpeed(uint speed = 0, uint fanNumber = 0);
439 Q_INVOKABLE
void setAbsolutePosition();
445 Q_INVOKABLE
void setRelativePosition();
451 Q_INVOKABLE
void disableMotors(uint delay = 0);
457 Q_INVOKABLE
void setPrinterSpeed(uint speed = 100);
463 Q_INVOKABLE
void setFlowRate(uint rate = 100);
470 Q_INVOKABLE
void close();
476 Q_INVOKABLE
void showMessage(
const QString &message);
489 void setSerialTimerInterval(
int newTime);
495 void setTemperatureTimerInterval(
int newTime);
501 void setAutoTemperatureReport(
bool autoReport);
507 Q_INVOKABLE
void setAutoCheckTemperatureInterval(
int newTime);
512 Q_INVOKABLE
void sdDelete(
const QString &fileName);
517 void sdCardPrintStatus();
528 void checkTemperature();
534 void newMessage(
const QByteArray &message);
540 void newCommand(
const QByteArray &command);
547 void findFirmware(
const QByteArray &message);
552 void locateSerialPort();
558 void disableResetOnConnect(
const QString &port);
563 void getSDFileList();
568 void handleSerialError(QSerialPort::SerialPortError error);
576 Q_INVOKABLE
void loadFirmwarePlugin(
const QString &fwName);
581 bool firmwarePluginLoaded()
const;
586 bool serialInitialized()
const;
591 void requestFirmware();
597 bool isReadingSdCardList()
const;
610 void waitForPrinterReboot(
const QByteArray &message,
const QString &fwName);
616 std::unique_ptr<AtCorePrivate>
d;
624 void setExtruderCount(
int newCount);
629 void appendSdCardFileList(
const QString &fileName);
634 void clearSdCardFileList();
640 void setSdMounted(
const bool mounted);
646 void setReadingSdCardList(
bool readingList);
The AtCore class aims to provides a high level interface for serial based gcode devices
Definition atcore.h:45
void sdMountChanged(bool newState)
Sd Card Mount Changed.
void availableFirmwarePluginsChanged()
availableFirmwarePluginsChanged notify about the new plugins available
STATES
STATES enum Possible states the printer can be in.
Definition atcore.h:75
@ STOP
Stop Printing and Clean Queue.
Definition atcore.h:82
@ STARTPRINT
Just Starting a print job.
Definition atcore.h:83
@ BUSY
Printer is Printing or working.
Definition atcore.h:79
@ PAUSE
Printer is paused.
Definition atcore.h:80
@ DISCONNECTED
Not Connected to a printer, initial state.
Definition atcore.h:76
@ ERRORSTATE
Printer Returned Error.
Definition atcore.h:81
@ FINISHEDPRINT
Just Finished print job.
Definition atcore.h:84
@ IDLE
Connected to printer and ready for commands.
Definition atcore.h:78
@ CONNECTING
Attempting to connect, Fw not probed.
Definition atcore.h:77
void receivedMessage(const QByteArray &message)
New message was received from the printer.
void atcoreMessage(const QString &msg)
Message emit from atcore these should be displayed to the user for debug.
void pushedCommand(const QByteArray &comm)
pushedCommand via serialLayer connect this to your log to see send commands
void extruderCountChanged(const int newCount)
New number of extruders.
AtCore::STATES state()
Get Printer state.
void autoTemperatureReportChanged(bool autoReport)
use of automatic temperature reporting has changed
void temperatureTimerIntervalChanged(const int newTime)
New interval for temperature timer.
void serialTimerIntervalChanged(const int newTime)
New interval for serial timer.
QStringList sdFileList()
sdFileList
Temperature * temperature()
The temperature of the current hotend as told by the Firmware.
void portsChanged(const QStringList &portList)
Available serialports Changed.
std::unique_ptr< AtCorePrivate > d
Definition atcore.h:616
void printProgressChanged(const float newProgress)
Print job's precentage changed.
void sdCardFileListChanged(const QStringList &fileList)
The files on the sd card have changed.
AXES
The AXES enum - Printer Axes.
Definition atcore.h:90
void stateChanged(AtCore::STATES newState)
The Printer's State Changed.
void autoCheckTemperatureIntervalChanged(const int newTime)
New interval for automatic temperature report.
UNITS
The UNITS enum - Possible Mesurment Units.
Definition atcore.h:100
@ METRIC
Metric Units (Meters)
Definition atcore.h:101
The IFirmware class Base Class for Firmware Plugins.
Definition ifirmware.h:25
The MarlinPlugin class Plugin for Marlin.
Definition marlinplugin.h:18
The RepetierPlugin class Plugin for Repetier.
Definition repetierplugin.h:18
The SerialLayer class. Provide the low level serial operations.
Definition seriallayer.h:20
The Temperature class.
Definition temperature.h:21
The AtCorePrivate struct Provides a private data set for atcore.
Definition atcore.cpp:36