Files
OrcaSlicer/tests/fff_print/test_wipe_tower.cpp
SoftFever 4e1caa39eb Flush the wipe tower planner queue with M400 on Klipper
The wipe tower emitted G4 S0 to make the firmware finish its queued moves
before commands that must not take effect early. Klipper's G4 reads only the
P parameter, so that flush never happened there and a temperature change could
land seconds ahead of the moves it was meant to follow. Klipper now gets M400
instead, through one helper shared by both wipe tower implementations.

No change to any other firmware flavor's output, so no shipped profile or saved
project is affected.
2026-08-05 17:15:35 +08:00

28 lines
1.2 KiB
C++

#include <catch2/catch_all.hpp>
#include <string>
#include "libslic3r/GCode/WipeTower.hpp"
#include "libslic3r/PrintConfig.hpp"
using namespace Slic3r;
// The wipe tower flushes the firmware's motion queue before a command or custom-G-code
// boundary that must not be reached early (an extruder-position reset, entering custom
// G-code). Klipper acts on those the moment it parses them, and its G4 reads only P, so the
// zero dwell every other flavor uses is not a flush there.
TEST_CASE("Klipper flushes the wipe tower planner queue with M400", "[WipeTower]")
{
CHECK(std::string(flush_planner_queue_command(gcfKlipper)) == "M400\n");
}
TEST_CASE("Other flavors flush the wipe tower planner queue with a zero dwell", "[WipeTower]")
{
const GCodeFlavor flavor = GENERATE(gcfMarlinLegacy, gcfRepRapFirmware, gcfRepetier,
gcfMarlinFirmware, gcfRepRapSprinter, gcfTeacup,
gcfMakerWare, gcfSailfish, gcfMach3, gcfMachinekit,
gcfSmoothie, gcfNoExtrusion);
INFO("gcode flavor enum value: " << int(flavor));
CHECK(std::string(flush_planner_queue_command(flavor)) == "G4 S0\n");
}