28{
30 int dir = input_val > 0 ? 1 : -1;
32 if (axis.compare("Y") == 0 || axis.compare("Z") == 0) {
33 dir = -dir;
34 }
35 }
37 j["print"]["command"] = "xyz_ctrl";
38 j["print"]["axis"] = axis;
39 j["print"]["dir"] = dir;
40 j["print"]["mode"] = (std::abs(input_val) >= 10) ? 1 : 0;
42 return m_owner->publish_json(j);
43 }
44
45 double value = input_val;
47 if (axis.compare("Y") == 0 || axis.compare("Z") == 0) {
48 value = -1.0 * input_val;
49 }
50 }
51
52 char cmd[256];
53 if (axis.compare("X") == 0 || axis.compare("Y") == 0 || axis.compare("Z") == 0) {
54 sprintf(cmd, "M211 S \nM211 X1 Y1 Z1\nM1002 push_ref_mode\nG91 \nG1 %s%0.1f F%d\nM1002 pop_ref_mode\nM211 R\n", axis.c_str(), value * unit, speed);
55 } else if (axis.compare("E") == 0) {
56 sprintf(cmd, "M83 \nG0 %s%0.1f F%d\n", axis.c_str(), value * unit, speed);
57 } else {
58 return -1;
59 }
60
61
62 return m_owner->publish_gcode(cmd);
63}
bool IsArchCoreXY() const
Definition DevAxis.cpp:24
bool m_is_support_mqtt_axis_ctrl
Definition DevAxis.h:36
static int m_sequence_id
Definition DeviceManager.hpp:197
nlohmann::json json
Definition AssembleList.cpp:42