FIX: Should not sync when machine types are inconsistent

jira: none
Change-Id: If769fe0d19fb06c4a70e616416bf28f194ebcd45
This commit is contained in:
zhimin.zeng 2024-09-27 19:49:21 +08:00 committed by lane.wei
parent 14ceceb3d7
commit 8360bd2473
2 changed files with 15 additions and 1 deletions

View File

@ -2048,9 +2048,22 @@ void Sidebar::sync_extruder_list()
p->sync_extruder_list();
}
bool Sidebar::should_sync_extruder_list(MachineObject *obj)
{
if (obj && obj->is_connected() && obj->is_multi_extruders() && wxGetApp().plater()->is_multi_extruder_ams_empty()) {
std::string machine_print_name = obj->printer_type;
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
std::string target_model_id = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
if (machine_print_name == target_model_id) {
return true;
}
}
return false;
}
void Sidebar::load_ams_list(std::string const &device, MachineObject* obj)
{
if (obj && obj->is_connected() && obj->is_multi_extruders() && wxGetApp().plater()->is_multi_extruder_ams_empty())
if (should_sync_extruder_list(obj))
sync_extruder_list();
std::map<int, DynamicPrintConfig> filament_ams_list = build_filament_ams_list(obj);

View File

@ -151,6 +151,7 @@ public:
std::map<int, DynamicPrintConfig> build_filament_ams_list(MachineObject* obj);
void sync_ams_list();
void sync_extruder_list();
bool should_sync_extruder_list(MachineObject* obj);
ObjectList* obj_list();
ObjectSettings* obj_settings();