Fixed regression bug that MANUAL_TOOL_CHANGE not working for BBL printers (#13516)

* fix: manual filament change not emitting MANUAL_TOOL_CHANGE for BBL printers
BBL-specific M1020 S handling in toolchange() bypassed toolchange_prefix(),so manual_filament_change had no effect — M1020 was always emitted regardless of the setting. Move the BBL logic into toolchange_prefix() so all callers respect the option consistently.
Fixes #11795

* add comment
This commit is contained in:
SoftFever
2026-05-08 00:31:35 +08:00
committed by GitHub
parent 100a9a20d1
commit 762c935fb0

View File

@@ -506,9 +506,20 @@ std::string GCodeWriter::update_progress(unsigned int num, unsigned int tot, boo
std::string GCodeWriter::toolchange_prefix() const std::string GCodeWriter::toolchange_prefix() const
{ {
return config.manual_filament_change ? ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Manual_Tool_Change) + "T": std::string gcode = "T";
FLAVOR_IS(gcfMakerWare) ? "M135 T" : if (config.manual_filament_change)
FLAVOR_IS(gcfSailfish) ? "M108 T" : "T"; gcode = ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Manual_Tool_Change) + "T";
else {
if (m_is_bbl_printers)
gcode = "M1020 S";
else {
if (FLAVOR_IS(gcfMakerWare))
gcode = "M135 T";
else if (FLAVOR_IS(gcfSailfish))
gcode = "M108 T";
}
}
return gcode;
} }
std::string GCodeWriter::toolchange(unsigned int filament_id) std::string GCodeWriter::toolchange(unsigned int filament_id)
@@ -523,12 +534,8 @@ std::string GCodeWriter::toolchange(unsigned int filament_id)
// if we are running a single-extruder setup, just set the extruder and return nothing // if we are running a single-extruder setup, just set the extruder and return nothing
std::ostringstream gcode; std::ostringstream gcode;
if (this->multiple_extruders || (this->config.filament_diameter.values.size() > 1 && !is_bbl_printers())) { if (this->multiple_extruders || (this->config.filament_diameter.values.size() > 1 && !is_bbl_printers())) {
// BBS // Orca: call toolchange_prefix() to get the correct command prefix based on the configuration and flavor.
if (this->m_is_bbl_printers) gcode << this->toolchange_prefix() << filament_id;
gcode << "M1020 S" << filament_id;
else
gcode << this->toolchange_prefix() << filament_id;
//BBS
if (GCodeWriter::full_gcode_comment) if (GCodeWriter::full_gcode_comment)
gcode << " ; change extruder"; gcode << " ; change extruder";
gcode << "\n"; gcode << "\n";