From 573db9bf60bffd053c68b8e5c021dd737de12cee Mon Sep 17 00:00:00 2001 From: tao wang Date: Mon, 12 May 2025 17:46:01 +0800 Subject: [PATCH] ENH:prohibit resume2D tasks jira:[none] Change-Id: I038928bbe06b9f8f711513dca9021a9a08c92e6f --- src/slic3r/GUI/DeviceManager.cpp | 16 ++++++++++++++++ src/slic3r/GUI/DeviceManager.hpp | 3 +++ 2 files changed, 19 insertions(+) diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 29e337594..0444e3992 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -2112,6 +2112,8 @@ int MachineObject::command_task_pause() int MachineObject::command_task_resume() { + if (jobState_ > 1) return 0; + json j; j["print"]["command"] = "resume"; j["print"]["param"] = ""; @@ -2122,6 +2124,8 @@ int MachineObject::command_task_resume() int MachineObject::command_hms_idle_ignore(const std::string &error_str, int type) { + if (jobState_ > 1) return 0; + json j; j["print"]["command"] = "idle_ignore"; j["print"]["err"] = error_str; @@ -2132,6 +2136,8 @@ int MachineObject::command_hms_idle_ignore(const std::string &error_str, int typ int MachineObject::command_hms_resume(const std::string& error_str, const std::string& job_id) { + if (jobState_ > 1) return 0; + json j; j["print"]["command"] = "resume"; j["print"]["err"] = error_str; @@ -2144,6 +2150,8 @@ int MachineObject::command_hms_resume(const std::string& error_str, const std::s int MachineObject::command_hms_ignore(const std::string& error_str, const std::string& job_id) { + if (jobState_ > 1) return 0; + json j; j["print"]["command"] = "ignore"; j["print"]["err"] = error_str; @@ -2382,6 +2390,8 @@ int MachineObject::command_ams_select_tray(std::string tray_id) int MachineObject::command_ams_control(std::string action) { + if (action == "resume" && jobState_ > 1 ) return 0; + //valid actions if (action == "resume" || action == "reset" || action == "pause" || action == "done" || action == "abort") { json j; @@ -3098,6 +3108,7 @@ void MachineObject::reset() network_wired = false; dev_connection_name = ""; job_id_ = ""; + jobState_ = 0; m_plate_index = -1; nt_reset_data(); @@ -3984,6 +3995,11 @@ int MachineObject::parse_json(std::string tunnel, std::string payload, bool key_ this->task_id_ = jj["task_id"].get(); } + if (jj.contains("job_attr")) { + int jobAttr = jj["job_attr"].get(); + jobState_ = get_flag_bits(jobAttr, 4, 4); + } + if (jj.contains("gcode_file")) this->m_gcode_file = jj["gcode_file"].get(); if (jj.contains("gcode_file_prepare_percent")) { diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 4b719df21..b1803f2ca 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -1125,6 +1125,9 @@ public: boost::thread* get_slice_info_thread { nullptr }; boost::thread* get_model_task_thread { nullptr }; + /* job attr */ + int jobState_ = 0; + /* key: sequence id, value: callback */ std::map m_callback_list;