diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 3212c6872f..0d4934fb3f 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -2140,6 +2140,15 @@ int MachineObject::command_stop_buzzer() int MachineObject::command_set_bed(int temp) { + if (m_support_mqtt_bet_ctrl) + { + json j; + j["print"]["command"] = "set_bed_temp"; + j["print"]["temp"] = temp; + j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); + return this->publish_json(j.dump()); + } + std::string gcode_str = (boost::format("M140 S%1%\n") % temp).str(); return this->publish_gcode(gcode_str); } @@ -2522,6 +2531,17 @@ int MachineObject::command_ams_air_print_detect(bool air_print_detect) int MachineObject::command_axis_control(std::string axis, double unit, double input_val, int speed) { + if (m_support_mqtt_axis_control) + { + json j; + j["print"]["command"] = "xyz_ctrl"; + j["print"]["axis"] = axis; + j["print"]["dir"] = input_val > 0 ? 1 : -1; + j["print"]["mode"] = (std::abs(input_val) >= 10) ? 1 : 0; + j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); + return this->publish_json(j.dump()); + } + double value = input_val; if (!is_core_xy()) { if ( axis.compare("Y") == 0 @@ -6265,6 +6285,8 @@ void MachineObject::parse_new_info(json print) is_support_internal_timelapse = get_flag_bits(fun, 28); is_support_command_homing = get_flag_bits(fun, 32); is_support_brtc = get_flag_bits(fun, 31); + m_support_mqtt_axis_control = get_flag_bits(fun, 38); + m_support_mqtt_bet_ctrl = get_flag_bits(fun, 39); } /*aux*/ diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 4e3967743c..dd5c2199b1 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -1205,7 +1205,9 @@ public: int command_stop_buzzer(); /* temp*/ + bool m_support_mqtt_bet_ctrl = false; int command_set_bed(int temp); + int command_set_nozzle(int temp); int command_set_nozzle_new(int nozzle_id, int temp); int command_set_chamber(int temp); @@ -1245,6 +1247,7 @@ public: int command_nozzle_blob_detect(bool nozzle_blob_detect); // axis string is X, Y, Z, E + bool m_support_mqtt_axis_control = false; int command_axis_control(std::string axis, double unit = 1.0f, double input_val = 1.0f, int speed = 3000); int command_extruder_control(int nozzle_id, double val);