FIX: update the extruder image in status panel

jira: [STUDIO-10732]
Change-Id: I5437c4ef1538f0022f97c7ef7fb40ec2242328ed
(cherry picked from commit f5c49c89a80e508a442440218b068446d1e9e797)
This commit is contained in:
xin.zhang
2025-03-06 19:43:59 +08:00
committed by Noisyfox
parent b791a31aff
commit 03ea48c6b4
9 changed files with 97 additions and 12 deletions

View File

@@ -913,7 +913,7 @@ std::vector<AMSinfo> AMSControl::GenerateSimulateData() {
}
void AMSControl::UpdateAms(std::vector<AMSinfo> ams_info, std::vector<AMSinfo>ext_info, ExtderData data, std::string dev_id, bool is_reset, bool test)
void AMSControl::UpdateAms(const std::string& series_name, std::vector<AMSinfo> ams_info, std::vector<AMSinfo>ext_info, ExtderData data, std::string dev_id, bool is_reset, bool test)
{
if (!test){
// update item
@@ -1082,6 +1082,9 @@ void AMSControl::UpdateAms(std::vector<AMSinfo> ams_info, std::vector<AMSinfo>ex
}
}
}
/*update ams extruder*/
m_extruder->updateNozzleNum(m_extder_data.total_extder_count, series_name);
}
void AMSControl::AddAmsPreview(AMSinfo info, AMSModel type)

View File

@@ -152,7 +152,7 @@ public:
void CreateAmsDoubleNozzle();
void CreateAmsSingleNozzle();
void ClearAms();
void UpdateAms(std::vector<AMSinfo> ams_info, std::vector<AMSinfo> ext_info, ExtderData data, std::string dev_id, bool is_reset = true, bool test = false);
void UpdateAms(const std::string& series_name, std::vector<AMSinfo> ams_info, std::vector<AMSinfo> ext_info, ExtderData data, std::string dev_id, bool is_reset = true, bool test = false);
std::vector<AMSinfo> GenerateSimulateData();
void AddAms(AMSinfo info, AMSPanelPos pos = AMSPanelPos::LEFT_PANEL);

View File

@@ -766,9 +766,10 @@ void AMSextruder::OnAmsLoading(bool load, int nozzle_id, wxColour col /*= AMS_CO
}
}
void AMSextruder::updateNozzleNum(int nozzle_num)
void AMSextruder::updateNozzleNum(int nozzle_num, const string& series_name)
{
if (m_nozzle_num == nozzle_num) return;
if (m_nozzle_num == nozzle_num && m_series_name == series_name) return;
m_series_name = series_name;
m_nozzle_num = nozzle_num;
this->DestroyChildren();
@@ -786,7 +787,19 @@ void AMSextruder::updateNozzleNum(int nozzle_num)
}
else
{
m_left_extruder = new AMSextruderImage(this, wxID_ANY, "single_nozzle", AMS_EXTRUDER_SINGLE_NOZZLE_BITMAP_SIZE);
if (MachineObject::is_series_n(m_series_name))
{
m_left_extruder = new AMSextruderImage(this, wxID_ANY, "single_nozzle_n", AMS_EXTRUDER_SINGLE_NOZZLE_BITMAP_SIZE);
}
else if(MachineObject::is_series_x(m_series_name) || MachineObject::is_series_p(m_series_name))
{
m_left_extruder = new AMSextruderImage(this, wxID_ANY, "single_nozzle_xp", AMS_EXTRUDER_SINGLE_NOZZLE_BITMAP_SIZE);
}
else
{
m_left_extruder = new AMSextruderImage(this, wxID_ANY, "single_nozzle_xp", AMS_EXTRUDER_SINGLE_NOZZLE_BITMAP_SIZE);
}
m_left_extruder->setShowState(true);
m_right_extruder->setShowState(false);
m_bitmap_sizer->Add(m_left_extruder, 0, wxALIGN_LEFT | wxALIGN_TOP, 0);
@@ -794,6 +807,7 @@ void AMSextruder::updateNozzleNum(int nozzle_num)
}
SetSizer(m_bitmap_sizer);
Layout();
Refresh();
}

View File

@@ -398,7 +398,9 @@ private:
class AMSextruder : public wxWindow
{
private:
int m_nozzle_num = -1;
int m_nozzle_num = -1;
string m_series_name;
public:
void TurnOn(wxColour col);
void TurnOff();
@@ -407,7 +409,7 @@ public:
void msw_rescale();
void has_ams(bool hams) {m_has_vams = hams; Refresh();};
void no_ams_mode(bool mode) {m_none_ams_mode = mode; Refresh();};
void updateNozzleNum(int nozzle_num);
void updateNozzleNum(int nozzle_num, const std::string& series_name = string());
bool m_none_ams_mode{true};
bool m_has_vams{false};