How do you get out of a macro loop without a M112 ?
-
How do you get out of a macro loop without a M112 ?
O.K , now for the story , I have a set of fans under the heated bed which is designed to cool the heated bed down faster.
What I do now is manually turn on the fans , but sometimes forget to switch them off , so I want to make a cool.g macro which is a endless loop until the temperature drops below a limit .
PROBLEM , how do I kill that macro without a Emergency stop if I want to print again. -
[pseudo code] turn fans ON while heat.heaters[0].current > 40 G4 S5 ; just wait 5 sec before checking again turn fans OFF
-
@peter247 alternatively, make them thermostatically controlled in you cool down macro (so they turn on until your bed is below say 30deg), and turn them off in your start.g.
That way you don't need any conditional gcode, only to remap how they are controlled
-
@engikeneer So I want to make a thermostatically controlled like the hot-end fan and link it to the heater and not the hot-end ?
So if my heater is 0 and my fan is 2
end with - M106 P2 S1 H0 T30 and start with M106 P2 S0 H-1 ?
-
@o_lampe said in How do you get out of a macro loop without a M112 ?:
[pseudo code]
What is the pseudo code for ?
-
@peter247 to expand on what @engikeneer has said, the simplest option is to set that fan up to be thermostatically controlled when you stop printing, and when you start printing set the thermostatic temperature very high so that it never turns on.
If you do want to set up a macro with an endless loop that can be stopped, create a global variable that indicates whether the loop should continue, and test that variable within the loop. Then you can change the value of that variable from another GCode channel.
-
@peter247 said in How do you get out of a macro loop without a M112 ?:
@o_lampe said in How do you get out of a macro loop without a M112 ?:
[pseudo code]
What is the pseudo code for ?
To tell the (future) reader, this isn't 1:1 real meta command. "turn fan ON" is obviously pseudo code, but I'm also not sure about the other lines in every detail.
-
I think all you need is M99
Here you have a macro using variables, if someone doesn't want variables (to use with older firmware) just replace the values.To download: Cool_Bed.g
;[Macro Cool_Bed.g] ; Needs RRF3.3 or later because uses variables ; Change these variables to suit your printer var BedFan = 9 ; Fan number var ThresholdTemp = 50 ; ºC var CheckEvery = 1 ; Seconds if heat.heaters[0].current > {var.ThresholdTemp} M108 ; Cancel Heating (just in case), Breaks out of an M109 or M190 M140 S0 ; Turn off bed heater (*) M106 P{var.BedFan} S1.0 ; Turn on BedFan while true G4 S{var.CheckEvery} ; Wait 1 sec, to check temperature every second if heat.heaters[0].current <= {var.ThresholdTemp} M106 P{var.BedFan} S0.0 ; Turn off BedFan M99 ; Return from Macro/Subprogram ;END if ;END while ;END if
"*" in line 11, is there anything analogous to M568 A0 for tools but for the bed??