FIX: the load filament steps shown fault

jira: [STUDIO-9684]
Change-Id: Ic238993302156788200482ed34e3092b9ab94dfd
(cherry picked from commit f8b4949353fbb4cead3249d5e8f6beb06859164c)
This commit is contained in:
xin.zhang
2025-01-13 17:21:06 +08:00
committed by Noisyfox
parent 9f831d7536
commit 34e06c2b4f
7 changed files with 43 additions and 30 deletions

View File

@@ -3522,7 +3522,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
}
/*the param is invalid in np for Yeshu*/
if (jj.contains("hw_switch_state")) {
if (!check_enable_np(jj) && jj.contains("hw_switch_state")) {
hw_switch_state = jj["hw_switch_state"].get<int>();
m_extder_data.extders[MAIN_NOZZLE_ID].ext_has_filament = hw_switch_state;
}
@@ -5548,6 +5548,17 @@ NozzleFlowType MachineObject::get_nozzle_flow_type(int extruder_id) const
return NozzleFlowType::NONE_FLOWTYPE;
}
const Extder& MachineObject::get_current_extruder() const
{
if (m_extder_data.extders.size() <= m_extder_data.current_extder_id)
{
BOOST_LOG_TRIVIAL(error) << "get_current_extruder() failed";
return Extder();
}
return m_extder_data.extders[m_extder_data.current_extder_id];
}
void MachineObject::converse_to_duct(bool is_suppt_part_fun, bool is_suppt_aux_fun, bool is_suppt_cham_fun)
{
m_air_duct_data.modes.clear();

View File

@@ -749,6 +749,7 @@ public:
/*extruder*/
[[nodiscard]] bool is_nozzle_flow_type_supported() const { return is_enable_np; };
[[nodiscard]] NozzleFlowType get_nozzle_flow_type(int extruder_id) const;
[[nodiscard]] const Extder& get_current_extruder() const;
//new fan data
AirDuctData m_air_duct_data;

View File

@@ -1925,6 +1925,8 @@ void StatusBasePanel::show_filament_load_group(bool show)
m_img_filament_loading->SetBitmap(create_scaled_bitmap("filament_load_fold", this, 24));
}
m_scale_panel->Show(show);
m_filament_step->SetupSteps(obj->get_current_extruder().ext_has_filament);
m_show_filament_group = show;
Layout();
Fit();
@@ -3110,7 +3112,7 @@ void StatusPanel::update_ams(MachineObject *obj)
}
if (ams_loading_state) {
update_filament_step();
update_load_with_temp();
m_filament_step->updateID(std::atoi(obj->m_ams_id.c_str()), std::atoi(obj->m_tray_id.c_str()));
bool busy_for_vt_loading = false;
@@ -3897,9 +3899,8 @@ void StatusPanel::on_ams_load(SimpleEvent &event)
on_ams_load_curr();
}
void StatusPanel::update_filament_step()
void StatusPanel::update_load_with_temp()
{
m_filament_step->UpdateStepCtrl(obj->is_filament_at_extruder());
if (!obj->is_filament_at_extruder()) {
m_is_load_with_temp = true;
}
@@ -3915,7 +3916,7 @@ void StatusPanel::on_ams_load_curr()
std::string curr_can_id = m_ams_control->GetCurrentCan(curr_ams_id);
update_filament_step();
update_load_with_temp();
//virtual tray
if (curr_ams_id.compare(std::to_string(VIRTUAL_TRAY_MAIN_ID)) == 0 ||
curr_ams_id.compare(std::to_string(VIRTUAL_TRAY_DEPUTY_ID)) == 0)

View File

@@ -640,7 +640,7 @@ protected:
/* extruder apis */
void on_ams_load(SimpleEvent &event);
void update_filament_step();
void update_load_with_temp();
void on_ams_load_curr();
void on_ams_load_vams(wxCommandEvent& event);
void on_ams_switch(SimpleEvent &event);

View File

@@ -124,7 +124,7 @@ void FilamentLoad::SetFilamentStep(FilamentStep item_idx, FilamentStepType f_typ
step_control->SetSlotInformation(slot_info);
}
void FilamentLoad::UpdateStepCtrl(bool has_fila_to_switch) {
void FilamentLoad::SetupSteps(bool has_fila_to_switch) {
m_filament_load_steps->DeleteAllItems();
m_filament_unload_steps->DeleteAllItems();
m_filament_vt_load_steps->DeleteAllItems();

View File

@@ -44,7 +44,7 @@ public:
void SetFilamentStep(FilamentStep item_idx, FilamentStepType f_type);
void ShowFilamentTip(bool hasams = true);
void UpdateStepCtrl(bool is_extrusion_exist);
void SetupSteps(bool is_extrusion_exist);
void show_nofilament_mode(bool show);
void updateID(int ams_id, int slot_id) { m_ams_id = ams_id; m_slot_id = slot_id; };