From 7de303112194a8e347093c488cec161a896e319c Mon Sep 17 00:00:00 2001 From: Kiss Lorand <50251547+kisslorand@users.noreply.github.com> Date: Sun, 26 Apr 2026 15:19:40 +0300 Subject: [PATCH] Fix fan stuck at wrong speed (#13336) Fix fan speed staying high When fan speed-up time is enabled, layers can inherit a higher fan speed than intended. If a layer ended with a role-driven fan change, the last applied fan speed was not properly tracked. As a result, the next layer could start with an incorrect fan state and keep the higher speed until another fan command overrode it. Ensure the emitted fan speed is always tracked correctly, including when flushing buffered commands at the end of a layer. --- src/libslic3r/GCode/FanMover.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/GCode/FanMover.cpp b/src/libslic3r/GCode/FanMover.cpp index 10ecfd8827..63e47f3f73 100644 --- a/src/libslic3r/GCode/FanMover.cpp +++ b/src/libslic3r/GCode/FanMover.cpp @@ -33,7 +33,11 @@ const std::string& FanMover::process_gcode(const std::string& gcode, bool flush) if (flush) { while (!m_buffer.empty()) { - m_process_output += m_buffer.front().raw + "\n"; + BufferData &front = m_buffer.front(); + m_process_output += front.raw + "\n"; + // Orca: Keep the emitted fan state in sync when flushing buffered fan commands. + if (front.fan_speed >= 0) + m_front_buffer_fan_speed = front.fan_speed; remove_from_buffer(m_buffer.begin()); } }