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.
This commit is contained in:
Kiss Lorand
2026-04-26 15:19:40 +03:00
committed by GitHub
parent bbd54c34a4
commit 7de3031121

View File

@@ -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());
}
}