From 50fe1f73128771ca91018e8da3b14efe56fa3da8 Mon Sep 17 00:00:00 2001 From: tao wang Date: Fri, 10 Jan 2025 20:50:51 +0800 Subject: [PATCH] NEW:use new homing command jira:[none] Change-Id: I9d60d0b5c2d0e2cf7ac5c5e4b0dbcf2daf6edbb1 (cherry picked from commit 9dce95d401e8333077db63dbad57bda837d0ce19) --- src/slic3r/GUI/DeviceManager.cpp | 9 +++++++++ src/slic3r/GUI/DeviceManager.hpp | 1 + src/slic3r/GUI/StatusPanel.cpp | 8 +++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 5d4874d1f5..9cb07b8b86 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -1824,6 +1824,15 @@ int MachineObject::command_go_home() return this->publish_gcode("G28 \n"); } +int MachineObject::command_go_home2() +{ + BOOST_LOG_TRIVIAL(info) << "New protocol of command_go_home2"; + json j; + j["print"]["command"] = "back_to_center"; + j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); + return this->publish_json(j.dump()); +} + int MachineObject::command_control_fan(FanType fan_type, bool on_off) { std::string gcode = (boost::format("M106 P%1% S%2% \n") % (int)fan_type % (on_off ? 255 : 0)).str(); diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 49fcc9f350..b742cefa33 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -946,6 +946,7 @@ public: int command_xyz_abs(); int command_auto_leveling(); int command_go_home(); + int command_go_home2(); int command_control_fan(FanType fan_type, bool on_off); int command_control_fan_val(FanType fan_type, int val); int command_task_abort(); diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index 719ed4b30a..687cccef54 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -3314,7 +3314,13 @@ void StatusPanel::on_axis_ctrl_xy(wxCommandEvent &event) if (event.GetInt() == 5) { obj->command_axis_control("X", 1.0, -1.0f, 3000); } if (event.GetInt() == 6) { obj->command_axis_control("Y", 1.0, -1.0f, 3000); } if (event.GetInt() == 7) { obj->command_axis_control("X", 1.0, 1.0f, 3000); } - if (event.GetInt() == 8) { obj->command_go_home(); } + if (event.GetInt() == 8) { + if (obj->is_enable_np) { + obj->command_go_home2(); + } else { + obj->command_go_home(); + } + } //check is at home if (event.GetInt() == 1