24 #include "MFEAxis.hpp"
26 #include <ccut/async.hpp>
27 #include <ccut/utils.hpp>
29 #include "MFEPlatform.hpp"
32 using namespace smc::internal;
35 MFEAxis::MFEAxis(
const std::string &uid,
36 const std::shared_ptr<MFEPlatform> &mfe,
37 const std::shared_ptr<GrblPlatform> &grbl) :
41 std::future<void> MFEAxis::setActualPosition(
48 if (!
convert(pos, units::unit_t::steps))
49 throw Exception(ErrorCode::IncompatibleUnits,
50 "failed to convert in steps");
57 return ccut::make_future_error(ex);
65 std::shared_ptr<GrblPlatform> grbl(m_grbl.lock());
67 throw Exception(ErrorCode::Canceled,
"platform stopped (deleted)");
69 grbl::Axis grblAxis = grbl->getAxis(
uid());
71 return grbl->run<std::set<std::string>>(
73 std::set<std::string> ret;
74 for (
const std::string &name : ctx.listConfig(grblAxis))
76 if (!ccut::startsWith(name,
77 MFEPlatform::s_resolverSettingPrefix))
80 cmd.prom->get<std::set<std::string>>().set_value(ret);
85 return ccut::make_future_error<std::set<std::string>>(ex);
DeviceId uid() const
Get the address of device.
Exception thrown by MotionController in case of issues with command.
std::future< std::set< std::string > > listConfig() const override
list device configuration options
bool convert(units::Value &value, units::unit_t unit) const override
Convert value in a manner specific to this device.
std::future< void > setConfig(const std::string &name, const std::string &value) const override
set device configuration value
const std::string & to_string(Axis::State state)
convert State to string
main motion-lib namespace