Fix role-based fan speeds being lost on layer change (#13390)

This commit is contained in:
Kiss Lorand
2026-05-03 00:24:09 +03:00
committed by GitHub
parent 0c415708d7
commit 0ee62a9662
2 changed files with 7 additions and 1 deletions

View File

@@ -2419,6 +2419,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
m_max_layer_z = 0.f;
m_last_width = 0.f;
m_is_role_based_fan_on.fill(false);
m_role_based_fan_marker_layer.fill(-1);
m_fan_mover.release();
@@ -6746,11 +6747,14 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
assert(m_enable_cooling_markers);
if (fan_on) {
if (!m_is_role_based_fan_on[role]) {
// Orca: CoolingBuffer consumes role fan markers per layer, so continuing
// role-based fan regions need a fresh START marker on each new layer.
if (!m_is_role_based_fan_on[role] || m_role_based_fan_marker_layer[role] != m_layer_index) {
gcode += ";";
gcode += marker_prefix;
gcode += "_FAN_START\n";
m_is_role_based_fan_on[role] = true;
m_role_based_fan_marker_layer[role] = m_layer_index;
}
} else {
if (m_is_role_based_fan_on[role]) {
@@ -6758,6 +6762,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, std::string description,
gcode += marker_prefix;
gcode += "_FAN_END\n";
m_is_role_based_fan_on[role] = false;
m_role_based_fan_marker_layer[role] = -1;
}
}
};

View File

@@ -559,6 +559,7 @@ private:
std::string _encode_label_ids_to_base64(std::vector<size_t> ids);
// ORCA: Add support for role based fan speed control
std::array<bool, ExtrusionRole::erCount> m_is_role_based_fan_on;
std::array<int, ExtrusionRole::erCount> m_role_based_fan_marker_layer;
// Markers for the Pressure Equalizer to recognize the extrusion type.
// The Pressure Equalizer removes the markers from the final G-code.
bool m_enable_extrusion_role_markers;