FIX: Add a matching rule with the same name for PA value

jira: 8339
Change-Id: Ib11be988a8e3cdbcaa853627cb946446730062c4
(cherry picked from commit f4379b3e193ac6d30b8ee91b5c3ff5518aec1f31)
This commit is contained in:
zhimin.zeng
2024-10-17 18:30:08 +08:00
committed by Noisyfox
parent f888fafc07
commit d841b2d178

View File

@@ -1142,9 +1142,14 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
m_pa_profile_items.clear(); m_pa_profile_items.clear();
m_comboBox_cali_result->SetValue(wxEmptyString); m_comboBox_cali_result->SetValue(wxEmptyString);
// TODO: Orca hack auto get_cali_index = [this](const std::string& str) -> int{
int extruder_id = 0; for (int i = 0; i < int(m_pa_profile_items.size()); ++i) {
NozzleVolumeType nozzle_volume_type = NozzleVolumeType::nvtNormal; if (m_pa_profile_items[i].name == str)
return i;
}
return 0;
};
if (obj->cali_version >= 0) { if (obj->cali_version >= 0) {
// add default item // add default item
PACalibResult default_item; PACalibResult default_item;
@@ -1167,6 +1172,7 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
m_comboBox_cali_result->Set(items); m_comboBox_cali_result->Set(items);
if (ams_id == VIRTUAL_TRAY_MAIN_ID || ams_id == VIRTUAL_TRAY_DEPUTY_ID) { if (ams_id == VIRTUAL_TRAY_MAIN_ID || ams_id == VIRTUAL_TRAY_DEPUTY_ID) {
if (from_printer && (*from_printer == 1)) {
for (auto slot : obj->vt_slot) { for (auto slot : obj->vt_slot) {
if (slot.id == std::to_string(ams_id)) if (slot.id == std::to_string(ams_id))
cali_select_idx = CalibUtils::get_selected_calib_idx(m_pa_profile_items, slot.cali_idx); cali_select_idx = CalibUtils::get_selected_calib_idx(m_pa_profile_items, slot.cali_idx);
@@ -1178,6 +1184,12 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
m_comboBox_cali_result->SetSelection(0); m_comboBox_cali_result->SetSelection(0);
} }
else { else {
int index = get_cali_index(m_comboBox_filament->GetLabel().ToStdString());
m_comboBox_cali_result->SetSelection(index);
}
}
else {
if (from_printer && (*from_printer == 1)) {
if (this->obj->amsList.find(std::to_string(ams_id)) != this->obj->amsList.end()) { if (this->obj->amsList.find(std::to_string(ams_id)) != this->obj->amsList.end()) {
Ams* selected_ams = this->obj->amsList[std::to_string(ams_id)]; Ams* selected_ams = this->obj->amsList[std::to_string(ams_id)];
if (!selected_ams) if (!selected_ams)
@@ -1194,6 +1206,11 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
m_comboBox_cali_result->SetSelection(cali_select_idx); m_comboBox_cali_result->SetSelection(cali_select_idx);
} }
} }
else {
int index = get_cali_index(m_comboBox_filament->GetLabel().ToStdString());
m_comboBox_cali_result->SetSelection(index);
}
}
if (cali_select_idx >= 0) { if (cali_select_idx >= 0) {
m_input_k_val->GetTextCtrl()->SetValue(float_to_string_with_precision(m_pa_profile_items[cali_select_idx].k_value)); m_input_k_val->GetTextCtrl()->SetValue(float_to_string_with_precision(m_pa_profile_items[cali_select_idx].k_value));