diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index d43b176e2b..17fd64cb34 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -2089,6 +2089,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"] = ""; @@ -2099,6 +2101,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; @@ -2109,6 +2113,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; @@ -2121,6 +2127,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; @@ -2309,6 +2317,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; @@ -3007,6 +3017,7 @@ void MachineObject::reset() network_wired = false; dev_connection_name = ""; job_id_ = ""; + jobState_ = 0; m_plate_index = -1; nt_reset_data(); @@ -3900,6 +3911,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 af422d536b..bae83e257e 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -1126,6 +1126,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;