diff --git a/src/atcore.h b/src/atcore.h --- a/src/atcore.h +++ b/src/atcore.h @@ -53,6 +53,10 @@ E = 1 << 3, }; +enum MeasurementUnits { + METRIC, IMPERIAL +}; + //TODO: PrinterStatus should also move to d->pointer; struct KATCORE_EXPORT PrinterStatus { float percentage; @@ -265,6 +269,12 @@ */ void showMessage(const QString &message); + /** + * @brief setUnits sets the measurement units do be used + * @param system : the measurement units (METRIC / IMPERIAL) + */ + void setUnits(MeasurementUnits units); + private slots: /** * @brief processQueue send commands from the queue. diff --git a/src/atcore.cpp b/src/atcore.cpp --- a/src/atcore.cpp +++ b/src/atcore.cpp @@ -517,3 +517,13 @@ pushCommand(GCode::toCommand((GCode::M117), message)); } } + +void AtCore::setUnits(MeasurementUnits units) +{ + switch (units) { + case METRIC: + pushCommand(GCode::toCommand(GCode::G21)); + case IMPERIAL: + pushCommand(GCode::toCommand(GCode::G20)); + } +}