Ramping up large fan
-
Hello, I wrote this short macro to try and slowly ramp up a large fan and although it works, the fan goes back to 0 RPM after the macro finishes and I don't understand why.
var fanSpeed = fans[1].requestedValue while var.fanSpeed < 1 ; while less than full speed set var.fanSpeed = var.fanSpeed + 0.01 ; update variables M106 P1 S{var.fanSpeed} ; set fan speed echo "fan at full speed"
Thank you.
-
@p8blr two things:
- You should put a G4 command within the while loop to control the rate at which the speed increases.
- I suspect that (perhaps because of floating point rounding error) the speed is overshooting 1.0 slightly. Speeds greater than 1.0 will be treated as a speed on a scale of 0 to 255. So you need to prevent this overshoot and set the speed to exactly 1.0 at the end..
-
@dc42 Thanks! This version of the code works:
var fanSpeed = fans[1].requestedValue while var.fanSpeed < 1 ; while less than full speed set var.fanSpeed = var.fanSpeed + 0.01 ; update variables if var.fanSpeed > 1 ; make sure variable never exceeds 1 set var.fanSpeed = 1 M106 P1 S{var.fanSpeed} ; set fan speed G4 S0.01 ; dc42 said to add this echo "fan at full speed"
-
@dc42 I would like this code to run thermostatically. If I add something to daemon.g to check sensors.analog[9].lastReading and run chamberFanOn.g (the above code) if fans[1].actualValue < 1, will that hold up the execution of other gcode because I'm using a while loop with a G4 wait?
-
@p8blr The FW will run other tasks during the G4 command. But i'm not sure how long the G4 delay should be for proper function.