diff --git a/src/slic3r/GUI/DeviceManager.cpp b/src/slic3r/GUI/DeviceManager.cpp index 9b7e5b38f3..ea9cac54e0 100644 --- a/src/slic3r/GUI/DeviceManager.cpp +++ b/src/slic3r/GUI/DeviceManager.cpp @@ -1725,8 +1725,13 @@ int MachineObject::command_select_extruder(int id) j["print"]["sequence_id"] = std::to_string(MachineObject::m_sequence_id++); j["print"]["command"] = "select_extruder"; j["print"]["extruder_index"] = id; + int rtn = this->publish_json(j.dump(), 1); + if (rtn == 0) + { + targ_nozzle_id_from_pc = id; + } - return this->publish_json(j.dump(), 1); + return rtn; } int MachineObject::command_get_version(bool with_retry) @@ -6021,10 +6026,12 @@ void MachineObject::parse_new_info(json print) if (m_extder_data.current_extder_id != extder_data.current_extder_id) { flag_update_nozzle = true; + targ_nozzle_id_from_pc = INVALID_NOZZLE_ID; } else if (extder_data.switch_extder_state == ES_SWITCHING_FAILED) { flag_update_nozzle = true; + targ_nozzle_id_from_pc = INVALID_NOZZLE_ID; } extder_data.current_loading_extder_id = get_flag_bits(extruder["state"].get(), 15, 4); diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index ce12a34270..7271d4b92b 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -954,6 +954,9 @@ public: int nozzle_selected_count = 0; bool flag_update_nozzle = {true}; + /*target from Studio-SwitchBoard, default to INVALID_NOZZLE_ID if no switching control from PC*/ + int targ_nozzle_id_from_pc = INVALID_NOZZLE_ID; + //supported features bool is_support_chamber_edit{false}; bool is_support_extrusion_cali{false}; diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index 2d0398923b..1bc5e76544 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -2859,7 +2859,6 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj) m_nozzle_btn_panel->updateState("left"); } - targ_nozzle_id_from_pc = INVALID_NOZZLE_ID;// the switching is finished obj->flag_update_nozzle = false; } @@ -2867,7 +2866,7 @@ void StatusPanel::update_misc_ctrl(MachineObject *obj) /* Can do switch while printing pause STUDIO-9789*/ if ((obj->is_in_printing() && !obj->is_in_printing_pause()) || obj->ams_status_main == AMS_STATUS_MAIN_FILAMENT_CHANGE || - targ_nozzle_id_from_pc != INVALID_NOZZLE_ID) + obj->targ_nozzle_id_from_pc != INVALID_NOZZLE_ID) { m_nozzle_btn_panel->Disable(); } @@ -4776,9 +4775,8 @@ void StatusPanel::on_nozzle_selected(wxCommandEvent &event) } auto nozzle_id = event.GetInt(); - if(obj->command_select_extruder(nozzle_id) == 0) + if (obj->command_select_extruder(nozzle_id) == 0) { - targ_nozzle_id_from_pc = nozzle_id; return; } } diff --git a/src/slic3r/GUI/StatusPanel.hpp b/src/slic3r/GUI/StatusPanel.hpp index fd8f4b37e9..a323c11028 100644 --- a/src/slic3r/GUI/StatusPanel.hpp +++ b/src/slic3r/GUI/StatusPanel.hpp @@ -401,8 +401,6 @@ protected: wxSimplebook* m_extruder_book; std::vector m_extruderImage; - /*the target nozzle id from PC-SwitchBoard, default to INVALID_NOZZLE_ID if not switching*/ - int targ_nozzle_id_from_pc = INVALID_NOZZLE_ID; SwitchBoard * m_nozzle_btn_panel; wxStaticText * m_text_tasklist_caption;