Automatically select external spool if it's the only installed filament (#13356)

* Clean up code

* Filament mapping select ext slot automatically when no AMS filament inserted (OrcaSlicer/OrcaSlicer#13103)

* Show warning if external filament type does not match the one in sliced file
This commit is contained in:
Noisyfox
2026-05-09 13:14:27 +08:00
committed by GitHub
parent a29d4fc495
commit fb1f4a7d24
7 changed files with 55 additions and 31 deletions

View File

@@ -1092,23 +1092,13 @@ bool SelectMachineDialog::do_ams_mapping(MachineObject *obj_,bool use_ams)
//single nozzle
else {
if (obj_->is_support_amx_ext_mix_mapping()){
map_opt = { false, true, false, false }; //four values: use_left_ams, use_right_ams, use_left_ext, use_right_ext
if (!use_ams) {
map_opt[1] = false;
map_opt[3] = true;
}
filament_result = DevMappingUtil::ams_filament_mapping(obj_, m_filaments, m_ams_mapping_result, map_opt);
//auto_supply_with_ext(obj_->vt_slot);
}
else {
map_opt = { false, true, false, false };
if (!use_ams) {
map_opt[1] = false;
map_opt[3] = true;
}
filament_result = DevMappingUtil::ams_filament_mapping(obj_, m_filaments, m_ams_mapping_result, map_opt);
map_opt = { false, true, false, false }; //four values: use_left_ams, use_right_ams, use_left_ext, use_right_ext
if (!use_ams) {
map_opt[1] = false;
map_opt[3] = true;
}
filament_result = DevMappingUtil::ams_filament_mapping(obj_, m_filaments, m_ams_mapping_result, map_opt);
//auto_supply_with_ext(obj_->vt_slot);
}
if (filament_result == 0) {
@@ -1147,7 +1137,7 @@ bool SelectMachineDialog::do_ams_mapping(MachineObject *obj_,bool use_ams)
return true;
}
bool SelectMachineDialog::get_ams_mapping_result(std::string &mapping_array_str, std::string& mapping_array_str2, std::string &ams_mapping_info)
bool SelectMachineDialog::get_ams_mapping_result(std::string &mapping_array_str, std::string& mapping_array_str2, std::string &ams_mapping_info) const
{
if (m_ams_mapping_result.empty())
return false;
@@ -1438,7 +1428,7 @@ bool SelectMachineDialog::is_nozzle_type_match(DevExtderSystem data, wxString& e
return true;
}
int SelectMachineDialog::convert_filament_map_nozzle_id_to_task_nozzle_id(int nozzle_id)
int SelectMachineDialog::convert_filament_map_nozzle_id_to_task_nozzle_id(int nozzle_id) const
{
if (nozzle_id == (int)FilamentMapNozzleId::NOZZLE_LEFT) {
return (int)CloudTaskNozzleId::NOZZLE_LEFT;
@@ -1691,6 +1681,9 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
} else if (status == PrintDialogStatus::PrintStatusFilamentWarningHighChamberTempSoft || status == PrintDialogStatus::PrintStatusFilamentWarningUnknownHighChamberTempSoft) {
Enable_Refresh_Button(true);
Enable_Send_Button(true);
} else if (status == PrintStatusWarningExtFilamentNotMatch) {
Enable_Refresh_Button(true);
Enable_Send_Button(true);
}
/*enter perpare mode*/
@@ -3458,7 +3451,7 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
std::string filament_type = boost::to_upper_copy(m_ams_mapping_result[i].type);
std::string filament_brand;
for (auto fs : m_filaments) {
for (auto& fs : m_filaments) {
if (fs.id == m_ams_mapping_result[i].id) { filament_brand = m_filaments[i].brand; }
}
@@ -3520,6 +3513,19 @@ void SelectMachineDialog::update_show_status(MachineObject* obj_)
}
}
// Orca: show warning if external filament does not match
for (auto& m : m_ams_mapping_result) {
if (devPrinterUtil::IsVirtualSlot(m.ams_id)) {
for (auto& fs : m_filaments) {
if (fs.id == m.id && m.type != fs.type) {
show_status(PrintDialogStatus::PrintStatusWarningExtFilamentNotMatch);
goto ext_mismatch;
}
}
}
}
ext_mismatch:
/*STUDIO-10970 check the k value and flow cali option*/
if (m_checkbox_list["flow_cali"]->IsShown() && m_checkbox_list["flow_cali"]->getValue() == "auto") {
const auto &not_default_ams_names = _check_kval_not_default(obj_, m_ams_mapping_result);