FIX: Add a matching rule with the same name for PA value
jira: 8339 Change-Id: Ib11be988a8e3cdbcaa853627cb946446730062c4
This commit is contained in:
parent
3cb36b5111
commit
f4379b3e19
|
@ -1172,6 +1172,14 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
|||
m_pa_profile_items.clear();
|
||||
m_comboBox_cali_result->SetValue(wxEmptyString);
|
||||
|
||||
auto get_cali_index = [this](const std::string& str) -> int{
|
||||
for (int i = 0; i < int(m_pa_profile_items.size()); ++i) {
|
||||
if (m_pa_profile_items[i].name == str)
|
||||
return i;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
if (obj->cali_version >= 0) {
|
||||
// add default item
|
||||
PACalibResult default_item;
|
||||
|
@ -1192,6 +1200,7 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
|||
|
||||
m_comboBox_cali_result->Set(items);
|
||||
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) {
|
||||
if (slot.id == std::to_string(ams_id))
|
||||
cali_select_idx = CalibUtils::get_selected_calib_idx(m_pa_profile_items, slot.cali_idx);
|
||||
|
@ -1203,6 +1212,12 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
|||
m_comboBox_cali_result->SetSelection(0);
|
||||
}
|
||||
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()) {
|
||||
Ams* selected_ams = this->obj->amsList[std::to_string(ams_id)];
|
||||
if (!selected_ams)
|
||||
|
@ -1219,6 +1234,11 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
|||
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) {
|
||||
m_input_k_val->GetTextCtrl()->SetValue(float_to_string_with_precision(m_pa_profile_items[cali_select_idx].k_value));
|
||||
|
|
Loading…
Reference in New Issue