FIX: Prompt user when mix ams and vtslot in an extruder

jira: none
Change-Id: I9a1d4936056fc872c75bf0454e4ca89665ece2f8
This commit is contained in:
zhimin.zeng 2024-09-30 11:41:30 +08:00 committed by lane.wei
parent d715353fa6
commit 65c00e00fe
4 changed files with 55 additions and 7 deletions

View File

@ -1147,6 +1147,23 @@ bool MachineObject::need_SD_card() const
return !is_multi_extruders();
}
int MachineObject::get_extruder_id_by_ams_id(const std::string &ams_id)
{
if (ams_id.empty())
return 0;
auto it = amsList.find(ams_id);
if (it != amsList.end())
return it->second->nozzle;
else if (stoi(ams_id) == VIRTUAL_TRAY_MAIN_ID)
return 0;
else if (stoi(ams_id) == VIRTUAL_TRAY_DEPUTY_ID)
return 1;
assert(false);
return 0;
}
bool MachineObject::is_bbl_filament(std::string tag_uid)
{
if (tag_uid.empty())

View File

@ -588,6 +588,7 @@ public:
bool is_main_extruder_on_left() const;
bool is_multi_extruders() const;
bool need_SD_card() const;
int get_extruder_id_by_ams_id(const std::string &ams_id);
/*online*/
bool online_rfid;

View File

@ -2538,6 +2538,12 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
Enable_Send_Button(true);
Enable_Refresh_Button(true);
}
else if (status == PrintStatusMixAmsAndVtSlotWarning) {
wxString msg_text = _L("You selected external and AMS filament at the same time in an extruder, you will need manually change external filament.");
update_print_status_msg(msg_text, true, false);
Enable_Send_Button(true);
Enable_Refresh_Button(true);
}
// m_panel_warn m_simplebook
if (status == PrintDialogStatus::PrintStatusSending) {
@ -3921,6 +3927,29 @@ void SelectMachineDialog::update_show_status()
}
}
// check ams and vt_slot mix use status
{
struct ExtruderStatus
{
bool has_ams{false};
bool has_vt_slot{false};
};
std::vector<ExtruderStatus> extruder_status(nozzle_nums);
for (const FilamentInfo &item : m_ams_mapping_result) {
int extruder_id = obj_->get_extruder_id_by_ams_id(item.ams_id);
if (DeviceManager::is_virtual_slot(stoi(item.ams_id)))
extruder_status[extruder_id].has_vt_slot = true;
else
extruder_status[extruder_id].has_ams = true;
}
for (auto extruder : extruder_status) {
if (extruder.has_ams && extruder.has_vt_slot) {
show_status(PrintDialogStatus::PrintStatusMixAmsAndVtSlotWarning);
return;
}
}
}
if (!obj_->is_support_ams_mapping()) {
int exceed_index = -1;
if (obj_->is_mapping_exceed_filament(m_ams_mapping_result, exceed_index)) {

View File

@ -174,7 +174,7 @@ public:
const wxSize & size = wxDefaultSize,
long style = wxTAB_TRAVERSAL,
const wxString &name = wxEmptyString);
~MachineObjectPanel();
void show_bind_dialog();
@ -192,7 +192,7 @@ protected:
};
#define SELECT_MACHINE_POPUP_SIZE wxSize(FromDIP(216), FromDIP(364))
#define SELECT_MACHINE_LIST_SIZE wxSize(FromDIP(212), FromDIP(360))
#define SELECT_MACHINE_LIST_SIZE wxSize(FromDIP(212), FromDIP(360))
#define SELECT_MACHINE_ITEM_SIZE wxSize(FromDIP(190), FromDIP(35))
#define SELECT_MACHINE_GREY900 wxColour(38, 46, 48)
#define SELECT_MACHINE_GREY600 wxColour(144,144,144)
@ -274,7 +274,7 @@ private:
std::string m_print_info = "";
bool m_dismiss { false };
std::map<std::string, MachineObject*> m_bind_machine_list;
std::map<std::string, MachineObject*> m_bind_machine_list;
std::map<std::string, MachineObject*> m_free_machine_list;
private:
@ -331,7 +331,8 @@ enum PrintDialogStatus {
PrintStatusNotSupportedPrintAll,
PrintStatusBlankPlate,
PrintStatusUnsupportedPrinter,
PrintStatusTimelapseWarning
PrintStatusTimelapseWarning,
PrintStatusMixAmsAndVtSlotWarning
};
@ -362,7 +363,7 @@ private:
wxColour m_colour_bold_color{wxColour(38, 46, 48)};
StateColor m_btn_bg_enable;
Label* m_text_bed_type;
std::shared_ptr<int> m_token = std::make_shared<int>(0);
std::map<std::string, CheckBox *> m_checkbox_list;
//std::map<std::string, bool> m_checkbox_state_list;
@ -374,7 +375,7 @@ private:
std::shared_ptr<BBLStatusBarSend> m_status_bar;
Slic3r::DynamicPrintConfig m_required_data_config;
Slic3r::Model m_required_data_model;
Slic3r::Model m_required_data_model;
Slic3r::PlateDataPtrs m_required_data_plate_data_list;
std::string m_required_data_file_name;
std::string m_required_data_file_path;
@ -388,7 +389,7 @@ protected:
Plater * m_plater{nullptr};
wxBoxSizer* m_sizer_options{ nullptr };
wxBoxSizer* m_sizer_thumbnail{ nullptr };
wxBoxSizer* m_sizer_main{ nullptr };
wxBoxSizer* m_basicl_sizer{ nullptr };
wxBoxSizer* rename_sizer_v{ nullptr };