This commit is contained in:
SoftFever
2026-08-05 18:09:36 +08:00
parent 194ef34080
commit 1d023216f2
4 changed files with 59 additions and 69 deletions

View File

@@ -1345,6 +1345,8 @@ public:
{
std::string buffer;
if (wait_for_moves)
// Not flush_planner_queue_command(): this BBL precool path wants M400, which every
// flavor it reaches understands, not the zero dwell the other flavors flush with.
buffer += "M400\n";
buffer += "M104";
if (target_extruder != -1)

View File

@@ -26,16 +26,11 @@ enum GCodeFlavor : unsigned char;
Polylines construct_gap_for_skip_points(
const Polygon& polygon, const std::vector<Vec2f>& skip_points, float wt_width, float gap_length, Polygon& insert_skip_polygon);
// Returns the command that makes the firmware finish its queued moves around an M104/M109
// or custom-G-code boundary. Klipper acts on commands the instant it parses them, and its G4
// reads only P, so the zero dwell other flavors use synchronizes nothing there — M400 does.
// Defined in WipeTower.cpp, shared by WipeTower and WipeTower2.
const char* flush_planner_queue_command(GCodeFlavor flavor);
// Returns the command that pauses for `seconds`. Klipper's G4 reads only P, in
// milliseconds, and ignores S, so the seconds form the other flavors use would dwell zero
// there. Defined in WipeTower.cpp, shared by WipeTower and WipeTower2.
std::string wait_command(GCodeFlavor flavor, float seconds);
// Klipper acts on commands the instant it parses them, and its G4 reads only P (milliseconds),
// so the zero-second and seconds-valued dwells every other flavor uses neither synchronize nor
// pause there. Both defined in WipeTower.cpp, shared by WipeTower and WipeTower2.
const char* flush_planner_queue_command(GCodeFlavor flavor); // finish queued moves, e.g. around M104/M109
std::string wait_command(GCodeFlavor flavor, float seconds); // pause for `seconds`
class WipeTower
{

View File

@@ -386,8 +386,8 @@ public:
}
WipeTowerWriter2& switch_filament_monitoring(bool enable) {
m_gcode += flush_planner_queue_command(m_gcode_flavor);
m_gcode += std::string("M591 ") + (enable ? "R" : "S0") + "\n";
flush_planner_queue();
m_gcode += enable ? "M591 R\n" : "M591 S0\n";
return *this;
}
@@ -626,7 +626,7 @@ public:
// Set extruder temperature, don't wait by default.
WipeTowerWriter2& set_extruder_temp(int temperature, bool wait = false)
{
m_gcode += flush_planner_queue_command(m_gcode_flavor);
flush_planner_queue();
m_gcode += "M" + std::to_string(wait ? 109 : 104) + " S" + std::to_string(temperature) + "\n";
return *this;
}