mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-08-19 12:39:13 +08:00
FIX: modify for virtual slot when multi_extruder
jira: none Change-Id: Ic7284018ecb44e24536788b05dba572b96460e66
This commit is contained in:
parent
fb72d19a44
commit
52e890fba1
@ -679,9 +679,14 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
|
||||
;
|
||||
}
|
||||
|
||||
auto vt_tray = ams_id;
|
||||
if (!obj->is_enable_np) {
|
||||
vt_tray = VIRTUAL_TRAY_DEPUTY_ID;
|
||||
}
|
||||
|
||||
if (obj->cali_version >= 0) {
|
||||
PACalibIndexInfo select_index_info;
|
||||
select_index_info.tray_id = slot_id;
|
||||
select_index_info.tray_id = vt_tray;
|
||||
select_index_info.nozzle_diameter = obj->m_nozzle_data.nozzles[0].diameter;
|
||||
|
||||
auto cali_select_id = m_comboBox_cali_result->GetSelection();
|
||||
@ -697,7 +702,7 @@ void AMSMaterialsSetting::on_select_ok(wxCommandEvent &event)
|
||||
CalibUtils::select_PA_calib_result(select_index_info);
|
||||
}
|
||||
else {
|
||||
obj->command_extrusion_cali_set(VIRTUAL_TRAY_MAIN_ID, "", "", k, n);
|
||||
obj->command_extrusion_cali_set(vt_tray, "", "", k, n);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -1186,7 +1191,7 @@ void AMSMaterialsSetting::on_select_filament(wxCommandEvent &evt)
|
||||
}
|
||||
|
||||
m_comboBox_cali_result->Set(items);
|
||||
if (ams_id == VIRTUAL_TRAY_DEPUTY_ID) {
|
||||
if (ams_id == VIRTUAL_TRAY_MAIN_ID) {
|
||||
cali_select_idx = CalibUtils::get_selected_calib_idx(m_pa_profile_items,this->obj->vt_slot[0].cali_idx);
|
||||
if (cali_select_idx >= 0) {
|
||||
m_comboBox_cali_result->SetSelection(cali_select_idx);
|
||||
|
@ -19,12 +19,6 @@ static const wxString NA_STR = _L("N/A");
|
||||
static const float MIN_PA_K_VALUE_STEP = 0.001;
|
||||
static const int MAX_PA_HISTORY_RESULTS_NUMS = 16;
|
||||
|
||||
void get_ams_id_and_slot_id(int tray_id, int& ams_id, int& slot_id)
|
||||
{
|
||||
ams_id = tray_id / 4;
|
||||
slot_id = tray_id % 4;
|
||||
}
|
||||
|
||||
std::map<int, Preset*> get_cached_selected_filament(MachineObject* obj) {
|
||||
std::map<int, Preset*> selected_filament_map;
|
||||
if (!obj) return selected_filament_map;
|
||||
@ -110,6 +104,26 @@ CalibrationWizard::~CalibrationWizard()
|
||||
;
|
||||
}
|
||||
|
||||
void CalibrationWizard::get_tray_ams_and_slot_id(int in_tray_id, int &ams_id, int &slot_id, int &tray_id)
|
||||
{
|
||||
assert(curr_obj);
|
||||
if (!curr_obj)
|
||||
return;
|
||||
|
||||
if (in_tray_id == VIRTUAL_TRAY_MAIN_ID || in_tray_id == VIRTUAL_TRAY_DEPUTY_ID) {
|
||||
ams_id = in_tray_id;
|
||||
slot_id = 0;
|
||||
tray_id = ams_id;
|
||||
if (!curr_obj->is_enable_np)
|
||||
tray_id = VIRTUAL_TRAY_DEPUTY_ID;
|
||||
}
|
||||
else {
|
||||
ams_id = in_tray_id / 4;
|
||||
slot_id = in_tray_id % 4;
|
||||
tray_id = in_tray_id;
|
||||
}
|
||||
}
|
||||
|
||||
void CalibrationWizard::on_cali_job_finished(wxCommandEvent& event)
|
||||
{
|
||||
this->on_cali_job_finished(event.GetString());
|
||||
@ -598,11 +612,10 @@ void PressureAdvanceWizard::on_cali_start()
|
||||
}
|
||||
|
||||
X1CCalibInfos::X1CCalibInfo calib_info;
|
||||
get_ams_id_and_slot_id(item.first, calib_info.ams_id, calib_info.slot_id);
|
||||
get_tray_ams_and_slot_id(item.first, calib_info.ams_id, calib_info.slot_id, calib_info.tray_id);
|
||||
calib_info.extruder_id = preset_page->get_extruder_id(calib_info.ams_id);
|
||||
calib_info.extruder_type = preset_page->get_extruder_type(calib_info.extruder_id);
|
||||
calib_info.nozzle_volume_type = preset_page->get_nozzle_volume_type(calib_info.extruder_id);
|
||||
calib_info.tray_id = item.first;
|
||||
calib_info.nozzle_diameter = nozzle_dia;
|
||||
calib_info.filament_id = item.second->filament_id;
|
||||
calib_info.setting_id = item.second->setting_id;
|
||||
@ -634,13 +647,14 @@ void PressureAdvanceWizard::on_cali_start()
|
||||
return;
|
||||
}
|
||||
|
||||
int selected_tray_id = 0;
|
||||
CalibInfo calib_info;
|
||||
calib_info.dev_id = curr_obj->dev_id;
|
||||
get_ams_id_and_slot_id(selected_filaments.begin()->first, calib_info.ams_id, calib_info.slot_id);
|
||||
get_tray_ams_and_slot_id(selected_filaments.begin()->first, calib_info.ams_id, calib_info.slot_id, selected_tray_id);
|
||||
calib_info.extruder_id = preset_page->get_extruder_id(calib_info.ams_id);
|
||||
calib_info.extruder_type = preset_page->get_extruder_type(calib_info.extruder_id);
|
||||
calib_info.extruder_id = preset_page->get_nozzle_volume_type(calib_info.extruder_id);
|
||||
calib_info.select_ams = "[" + std::to_string(selected_filaments.begin()->first) + "]";
|
||||
calib_info.nozzle_volume_type = preset_page->get_nozzle_volume_type(calib_info.extruder_id);
|
||||
calib_info.select_ams = "[" + std::to_string(selected_tray_id) + "]";
|
||||
Preset *preset = selected_filaments.begin()->second;
|
||||
Preset * temp_filament_preset = new Preset(preset->type, preset->name + "_temp");
|
||||
temp_filament_preset->config = preset->config;
|
||||
@ -1006,10 +1020,10 @@ void FlowRateWizard::on_cali_start(CaliPresetStage stage, float cali_value, Flow
|
||||
|
||||
X1CCalibInfos::X1CCalibInfo calib_info;
|
||||
calib_info.tray_id = item.first;
|
||||
get_ams_id_and_slot_id(item.first, calib_info.ams_id, calib_info.slot_id);
|
||||
get_tray_ams_and_slot_id(item.first, calib_info.ams_id, calib_info.slot_id, calib_info.tray_id);
|
||||
calib_info.extruder_id = preset_page->get_extruder_id(calib_info.ams_id);
|
||||
calib_info.extruder_type = preset_page->get_extruder_type(calib_info.extruder_id);
|
||||
calib_info.extruder_id = preset_page->get_nozzle_volume_type(calib_info.extruder_id);
|
||||
calib_info.nozzle_volume_type = preset_page->get_nozzle_volume_type(calib_info.extruder_id);
|
||||
calib_info.nozzle_diameter = nozzle_dia;
|
||||
calib_info.filament_id = item.second->filament_id;
|
||||
calib_info.setting_id = item.second->setting_id;
|
||||
@ -1060,8 +1074,9 @@ void FlowRateWizard::on_cali_start(CaliPresetStage stage, float cali_value, Flow
|
||||
}
|
||||
|
||||
if (!selected_filaments.empty()) {
|
||||
calib_info.select_ams = "[" + std::to_string(selected_filaments.begin()->first) + "]";
|
||||
get_ams_id_and_slot_id(selected_filaments.begin()->first, calib_info.ams_id, calib_info.slot_id);
|
||||
int selected_tray_id = 0;
|
||||
get_tray_ams_and_slot_id(selected_filaments.begin()->first, calib_info.ams_id, calib_info.slot_id, selected_tray_id);
|
||||
calib_info.select_ams = "[" + std::to_string(selected_tray_id) + "]";
|
||||
calib_info.extruder_id = preset_page->get_extruder_id(calib_info.ams_id);
|
||||
calib_info.extruder_type = preset_page->get_extruder_type(calib_info.extruder_id);
|
||||
calib_info.nozzle_volume_type = preset_page->get_nozzle_volume_type(calib_info.extruder_id);
|
||||
@ -1440,7 +1455,12 @@ void MaxVolumetricSpeedWizard::on_cali_start()
|
||||
calib_info.params = params;
|
||||
calib_info.dev_id = curr_obj->dev_id;
|
||||
if (!selected_filaments.empty()) {
|
||||
calib_info.select_ams = "[" + std::to_string(selected_filaments.begin()->first) + "]";
|
||||
int selected_tray_id = 0;
|
||||
get_tray_ams_and_slot_id(selected_filaments.begin()->first, calib_info.ams_id, calib_info.slot_id, selected_tray_id);
|
||||
calib_info.select_ams = "[" + std::to_string(selected_tray_id) + "]";
|
||||
calib_info.extruder_id = preset_page->get_extruder_id(calib_info.ams_id);
|
||||
calib_info.extruder_type = preset_page->get_extruder_type(calib_info.extruder_id);
|
||||
calib_info.nozzle_volume_type = preset_page->get_nozzle_volume_type(calib_info.extruder_id);
|
||||
calib_info.filament_prest = selected_filaments.begin()->second;
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
|
||||
protected:
|
||||
void on_cali_go_home();
|
||||
void get_tray_ams_and_slot_id(int in_tray_id, int &ams_id, int &slot_id, int &tray_id);
|
||||
|
||||
protected:
|
||||
/* wx widgets*/
|
||||
|
@ -752,12 +752,20 @@ void CalibrationPresetPage::create_filament_list_panel(wxWindow* parent)
|
||||
|
||||
NozzleVolumeType CalibrationPresetPage::get_nozzle_volume_type(int extruder_id) const
|
||||
{
|
||||
if (m_comboBox_nozzle_volume_types.size() > extruder_id)
|
||||
return NozzleVolumeType(m_comboBox_nozzle_volume_types[extruder_id]->GetSelection());
|
||||
else {
|
||||
return NozzleVolumeType::nvtNormal;
|
||||
}
|
||||
}
|
||||
|
||||
ExtruderType CalibrationPresetPage::get_extruder_type(int extruder_id) const
|
||||
{
|
||||
if (m_extrder_types.size() > extruder_id)
|
||||
return ExtruderType(m_extrder_types[extruder_id]);
|
||||
else {
|
||||
return ExtruderType::etDirectDrive;
|
||||
}
|
||||
}
|
||||
|
||||
void CalibrationPresetPage::create_multi_extruder_filament_list_panel(wxWindow *parent)
|
||||
@ -2387,17 +2395,17 @@ void CalibrationPresetPage::update_filament_combobox(std::string ams_id)
|
||||
empty_config.set_key_value("filament_colour", new ConfigOptionStrings{ "" });
|
||||
empty_config.set_key_value("filament_exist", new ConfigOptionBools{ false });
|
||||
|
||||
/* update virtual tray combo box*/
|
||||
// update virtual tray combo box
|
||||
m_virtual_tray_comboBox->update_from_preset();
|
||||
auto it = std::find_if(filament_ams_list.begin(), filament_ams_list.end(), [](auto& entry) {
|
||||
return entry.first == VIRTUAL_TRAY_DEPUTY_ID;
|
||||
return entry.first == VIRTUAL_TRAY_MAIN_ID;
|
||||
});
|
||||
|
||||
if (it != filament_ams_list.end()) {
|
||||
m_virtual_tray_comboBox->load_tray_from_ams(VIRTUAL_TRAY_DEPUTY_ID, it->second);
|
||||
m_virtual_tray_comboBox->load_tray_from_ams(VIRTUAL_TRAY_MAIN_ID, it->second);
|
||||
}
|
||||
else {
|
||||
m_virtual_tray_comboBox->load_tray_from_ams(VIRTUAL_TRAY_DEPUTY_ID, empty_config);
|
||||
m_virtual_tray_comboBox->load_tray_from_ams(VIRTUAL_TRAY_MAIN_ID, empty_config);
|
||||
}
|
||||
|
||||
if (filament_ams_list.empty())
|
||||
|
Loading…
x
Reference in New Issue
Block a user