From 99722056d72ece6338e7e3a076b73a47c874d71a Mon Sep 17 00:00:00 2001 From: "xin.zhang" Date: Thu, 19 Dec 2024 15:58:55 +0800 Subject: [PATCH] FIX:GUI error about nozzle temperature in device status page jira:[STUDIO-9147] Change-Id: I5148097418376e4cd0f0e1fbaaa5f25205f35e6e --- src/slic3r/GUI/DeviceManager.hpp | 3 +++ src/slic3r/GUI/StatusPanel.cpp | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/DeviceManager.hpp b/src/slic3r/GUI/DeviceManager.hpp index 83968ba29..998d40e20 100644 --- a/src/slic3r/GUI/DeviceManager.hpp +++ b/src/slic3r/GUI/DeviceManager.hpp @@ -37,8 +37,11 @@ #define HOLD_COUNT_CAMERA 6 #define GET_VERSION_RETRYS 10 #define RETRY_INTERNAL 2000 + #define MAIN_NOZZLE_ID 0 #define DEPUTY_NOZZLE_ID 1 +#define UNIQUE_NOZZLE_ID MAIN_NOZZLE_ID + #define VIRTUAL_TRAY_MAIN_ID 255 #define VIRTUAL_TRAY_DEPUTY_ID 254 #define START_SEQ_ID 20000 diff --git a/src/slic3r/GUI/StatusPanel.cpp b/src/slic3r/GUI/StatusPanel.cpp index d54752326..8b0116e8b 100644 --- a/src/slic3r/GUI/StatusPanel.cpp +++ b/src/slic3r/GUI/StatusPanel.cpp @@ -1383,7 +1383,7 @@ wxBoxSizer *StatusBasePanel::create_temp_control(wxWindow *parent) auto sizer = new wxBoxSizer(wxVERTICAL); wxWindowID nozzle_id = wxWindow::NewControlId(); - m_tempCtrl_nozzle = new TempInput(parent, nozzle_id, TEMP_BLANK_STR, TempInputType::TEMP_OF_MAIN_NOZZLE_TYPE, TEMP_BLANK_STR, wxString("monitor_nozzle_temp"), + m_tempCtrl_nozzle = new TempInput(parent, nozzle_id, TEMP_BLANK_STR, TempInputType::TEMP_OF_NORMAL_TYPE, TEMP_BLANK_STR, wxString("monitor_nozzle_temp"), wxString("monitor_nozzle_temp_active"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER); m_tempCtrl_nozzle->SetMinSize(TEMP_CTRL_MIN_SIZE_OF_SINGLE_NOZZLE); m_tempCtrl_nozzle->SetMinTemp(nozzle_temp_range[0]); @@ -2174,6 +2174,8 @@ StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, co on_set_nozzle_temp(MAIN_NOZZLE_ID); } else if (e.GetString() == wxString::Format("%d", DEPUTY_NOZZLE_ID)) { on_set_nozzle_temp(DEPUTY_NOZZLE_ID); + } else { + on_set_nozzle_temp(UNIQUE_NOZZLE_ID);//there is only one nozzle } } else if (id == m_tempCtrl_chamber->GetType()) { on_set_chamber_temp(); @@ -2828,7 +2830,6 @@ void StatusPanel::update_temp_ctrl(MachineObject *obj) { if (!obj) return; - int nozzle_num = obj->m_extder_data.total_extder_count; m_tempCtrl_bed->SetCurrTemp((int) obj->bed_temp); m_tempCtrl_bed->SetMaxTemp(obj->get_bed_temperature_limit()); @@ -2845,8 +2846,17 @@ void StatusPanel::update_temp_ctrl(MachineObject *obj) m_tempCtrl_bed->SetIconNormal(); } - m_tempCtrl_nozzle->SetCurrTemp((int) obj->m_extder_data.extders[MAIN_NOZZLE_ID].temp); - if (nozzle_num == 2 && obj->m_extder_data.extders.size() > 1) { + int nozzle_num = obj->m_extder_data.total_extder_count; + if (nozzle_num == 1 && obj->m_extder_data.extders.size() > MAIN_NOZZLE_ID) + { + m_tempCtrl_nozzle->SetCurrType(TEMP_OF_NORMAL_TYPE); + m_tempCtrl_nozzle->SetCurrTemp((int)obj->m_extder_data.extders[MAIN_NOZZLE_ID].temp); + m_tempCtrl_nozzle_deputy->SetCurrType(TEMP_OF_NORMAL_TYPE); + m_tempCtrl_nozzle_deputy->SetLabel(TEMP_BLANK_STR); + m_tempCtrl_nozzle_deputy->Hide(); + } + else if (nozzle_num == 2 && obj->m_extder_data.extders.size() > 1) + { m_tempCtrl_nozzle->SetCurrType(TEMP_OF_MAIN_NOZZLE_TYPE); m_tempCtrl_nozzle_deputy->SetCurrType(TEMP_OF_DEPUTY_NOZZLE_TYPE); m_tempCtrl_nozzle_deputy->Show();