Cooling: add per-printer non-zero fan PWM floor and fix N=0 fan ramp override (#13715)

* Cooling: add per-printer non-zero fan PWM floor and fix N=0 ramp override
* updated parameter naming
This commit is contained in:
Ioannis Giannakas
2026-05-19 09:40:53 +01:00
committed by GitHub
parent 7fc1e109c5
commit 3370e224b2
9 changed files with 61 additions and 18 deletions

View File

@@ -1092,9 +1092,13 @@ std::string GCodeWriter::unlift()
return gcode;
}
std::string GCodeWriter::set_fan(const GCodeFlavor gcode_flavor, unsigned int speed)
std::string GCodeWriter::set_fan(const GCodeFlavor gcode_flavor, unsigned int speed, unsigned int part_cooling_fan_min_pwm)
{
std::ostringstream gcode;
// ORCA: clamp non-zero fan commands up to the configured PWM floor so fans that can't spool at low duty
// cycles still start reliably. Zero (fan off) is preserved exactly so disable-fan commands are never altered.
if (speed > 0 && part_cooling_fan_min_pwm > 0 && speed < part_cooling_fan_min_pwm)
speed = part_cooling_fan_min_pwm;
if (speed == 0) {
switch (gcode_flavor) {
case gcfTeacup:
@@ -1129,7 +1133,9 @@ std::string GCodeWriter::set_fan(const GCodeFlavor gcode_flavor, unsigned int sp
std::string GCodeWriter::set_fan(unsigned int speed) const
{
//BBS
return GCodeWriter::set_fan(this->config.gcode_flavor, speed);
// ORCA: pick up the per-printer PWM floor from the active config.
return GCodeWriter::set_fan(this->config.gcode_flavor, speed,
static_cast<unsigned int>(std::max(0, this->config.part_cooling_fan_min_pwm.value)));
}
//BBS: set additional fan speed for BBS machine only