Merge prusa 2.6.1

This commit is contained in:
QIDI TECH
2023-09-16 16:26:29 +08:00
parent 1338e60f8b
commit 963e22db99
203 changed files with 25254 additions and 6453 deletions

View File

@@ -1624,6 +1624,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Advanced"));
optgroup->append_single_option_line("interface_shells");
optgroup->append_single_option_line("mmu_segmented_region_max_width");
optgroup->append_single_option_line("mmu_segmented_region_interlocking_depth");
page = add_options_page(L("Advanced"), "wrench");
optgroup = page->new_optgroup(L("Extrusion width"));
@@ -1901,6 +1902,13 @@ void TabFilament::add_filament_overrides_page()
"filament_retract_before_wipe"
})
create_line_with_near_label_widget(optgroup, opt_key, extruder_idx);
optgroup = page->new_optgroup(L("Retraction when tool is disabled"));
for (const std::string opt_key : { "filament_retract_length_toolchange",
"filament_retract_restart_extra_toolchange"
})
create_line_with_near_label_widget(optgroup, opt_key, extruder_idx);
}
void TabFilament::update_filament_overrides_page()
@@ -1909,7 +1917,7 @@ void TabFilament::update_filament_overrides_page()
return;
Page* page = m_active_page;
const auto og_it = std::find_if(page->m_optgroups.begin(), page->m_optgroups.end(), [](const ConfigOptionsGroupShp og) { return og->title == "Retraction"; });
auto og_it = std::find_if(page->m_optgroups.begin(), page->m_optgroups.end(), [](const ConfigOptionsGroupShp og) { return og->title == "Retraction"; });
if (og_it == page->m_optgroups.end())
return;
ConfigOptionsGroupShp optgroup = *og_it;
@@ -1937,6 +1945,16 @@ void TabFilament::update_filament_overrides_page()
bool is_checked = opt_key=="filament_retract_length" ? true : have_retract_length;
update_line_with_near_label_widget(optgroup, opt_key, extruder_idx, is_checked);
}
og_it = std::find_if(page->m_optgroups.begin(), page->m_optgroups.end(), [](const ConfigOptionsGroupShp og) { return og->title == "Retraction when tool is disabled"; });
if (og_it == page->m_optgroups.end())
return;
optgroup = *og_it;
for (const std::string& opt_key : {"filament_retract_length_toolchange", "filament_retract_restart_extra_toolchange"})
update_line_with_near_label_widget(optgroup, opt_key, extruder_idx);
}
void TabFilament::create_extruder_combobox()
@@ -1967,8 +1985,16 @@ void TabFilament::update_extruder_combobox()
m_extruders_cb->Append(format_wxstr("%1% %2%", _L("Extruder"), id), *get_bmp_bundle("funnel"));
}
if (m_active_extruder >= int(extruder_cnt))
if (m_active_extruder >= int(extruder_cnt)) {
m_active_extruder = 0;
// update selected and, as a result, editing preset
const std::string& preset_name = m_preset_bundle->extruders_filaments[0].get_selected_preset_name();
m_presets->select_preset_by_name(preset_name, true);
// To avoid inconsistance between value of active_extruder in FilamentTab and TabPresetComboBox,
// which can causes a crash on switch preset from MM printer to SM printer
m_presets_choice->set_active_extruder(m_active_extruder);
}
m_extruders_cb->SetSelection(m_active_extruder);
}
@@ -2011,7 +2037,7 @@ void TabFilament::build()
optgroup->append_single_option_line("filament_density");
optgroup->append_single_option_line("filament_cost");
optgroup->append_single_option_line("filament_spool_weight");
//B
optgroup->append_single_option_line("enable_advance_pressure");
optgroup->append_single_option_line("advance_pressure");
optgroup->append_single_option_line("smooth_time");
@@ -2140,6 +2166,12 @@ void TabFilament::build()
});
optgroup = page->new_optgroup(L("Toolchange parameters with multi extruder MM printers"));
optgroup->append_single_option_line("filament_multitool_ramming");
optgroup->append_single_option_line("filament_multitool_ramming_volume");
optgroup->append_single_option_line("filament_multitool_ramming_flow");
add_filament_overrides_page();
@@ -2242,6 +2274,13 @@ void TabFilament::toggle_options()
}
}
if (m_active_page->title() == "Advanced")
{
bool multitool_ramming = m_config->opt_bool("filament_multitool_ramming", 0);
toggle_option("filament_multitool_ramming_volume", multitool_ramming);
toggle_option("filament_multitool_ramming_flow", multitool_ramming);
}
if (m_active_page->title() == "Filament Overrides")
update_filament_overrides_page();
@@ -2305,12 +2344,37 @@ void TabFilament::sys_color_changed()
void TabFilament::load_current_preset()
{
const std::string& selected_filament_name = m_presets->get_selected_preset_name();
if (m_active_extruder < 0) {
// active extruder was invalidated before load new project file or configuration,
// so we have to update active extruder selection from selected filament
const std::string& edited_filament_name = m_presets->get_edited_preset().name;
assert(!selected_filament_name.empty() && selected_filament_name == edited_filament_name);
for (int i = 0; i < int(m_preset_bundle->extruders_filaments.size()); i++) {
const std::string& selected_extr_filament_name = m_preset_bundle->extruders_filaments[i].get_selected_preset_name();
if (selected_extr_filament_name == edited_filament_name) {
m_active_extruder = i;
break;
}
}
assert(m_active_extruder >= 0);
m_presets_choice->set_active_extruder(m_active_extruder);
if (m_active_extruder != m_extruders_cb->GetSelection())
m_extruders_cb->Select(m_active_extruder);
}
assert(m_active_extruder >= 0 && m_active_extruder < m_preset_bundle->extruders_filaments.size());
const std::string& selected_extr_filament_name = m_preset_bundle->extruders_filaments[m_active_extruder].get_selected_preset_name();
const std::string& selected_filament_name = m_presets->get_selected_preset_name();
if (selected_extr_filament_name != selected_filament_name)
if (selected_extr_filament_name != selected_filament_name) {
m_presets->select_preset_by_name(selected_extr_filament_name, false);
// To avoid inconsistance between value of active_extruder in FilamentTab and TabPresetComboBox,
// which can causes a crash on switch preset from MM printer to SM printer
m_presets_choice->set_active_extruder(m_active_extruder);
}
Tab::load_current_preset();
}
@@ -3635,8 +3699,17 @@ bool Tab::select_preset(std::string preset_name, bool delete_current /*=false*/,
for (PresetUpdate &pu : updates) {
pu.old_preset_dirty = (old_printer_technology == pu.technology) && pu.presets->current_is_dirty();
pu.new_preset_compatible = (new_printer_technology == pu.technology) && is_compatible_with_printer(pu.presets->get_edited_preset_with_vendor_profile(), new_printer_preset_with_vendor_profile);
bool force_update_edited_preset = false;
if (pu.tab_type == Preset::TYPE_FILAMENT && pu.new_preset_compatible) {
// check if edited preset will be still correct after selection new printer
const int active_extruder = dynamic_cast<const TabFilament*>(wxGetApp().get_tab(Preset::TYPE_FILAMENT))->get_active_extruder();
const int extruder_count_new = int(dynamic_cast<const ConfigOptionFloats*>(new_printer_preset.config.option("nozzle_diameter"))->size());
// if active_extruder is bigger than extruders_count,
// then it means that edited filament preset will be changed and we have to check this changes
force_update_edited_preset = active_extruder >= extruder_count_new;
}
if (!canceled)
canceled = pu.old_preset_dirty && !pu.new_preset_compatible && !may_discard_current_dirty_preset(pu.presets, preset_name);
canceled = pu.old_preset_dirty && (!pu.new_preset_compatible || force_update_edited_preset) && !may_discard_current_dirty_preset(pu.presets, preset_name);
}
if (!canceled) {
for (PresetUpdate &pu : updates) {
@@ -3679,7 +3752,8 @@ bool Tab::select_preset(std::string preset_name, bool delete_current /*=false*/,
}
}
// update_tab_ui(); //! ysFIXME delete after testing
// ! update preset combobox, to revert previously selection
update_tab_ui();
// Trigger the on_presets_changed event so that we also restore the previous value in the plater selector,
// if this action was initiated from the plater.
@@ -4101,7 +4175,7 @@ void Tab::rename_preset()
if (dlg.ShowModal() != wxID_OK)
return;
const std::string new_name = into_u8(dlg.get_name());
const std::string new_name = dlg.get_name();
if (new_name.empty() || new_name == m_presets->get_selected_preset().name)
return;