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

jira: none
Change-Id: I9a1d4936056fc872c75bf0454e4ca89665ece2f8
(cherry picked from commit 65c00e00fe8709255c40e94679fa4ced6d3ae688)
This commit is contained in:
zhimin.zeng 2024-09-30 11:41:30 +08:00 committed by Noisyfox
parent 9e05f88a36
commit ca6a3fe17b
4 changed files with 52 additions and 4 deletions

View file

@ -1161,6 +1161,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

@ -630,6 +630,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

@ -1697,6 +1697,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) {
@ -3028,6 +3034,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

@ -90,7 +90,8 @@ enum PrintDialogStatus {
PrintStatusNotSupportedPrintAll,
PrintStatusBlankPlate,
PrintStatusUnsupportedPrinter,
PrintStatusTimelapseWarning
PrintStatusTimelapseWarning,
PrintStatusMixAmsAndVtSlotWarning
};
@ -194,7 +195,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;
@ -207,7 +208,7 @@ private:
std::unique_ptr<Worker> m_worker;
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;
@ -221,7 +222,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 };