Macro gets stuck in a while loop after update to RRF 3.4 rc1
-
After updating to RRF 3.4 rc1 my macros that are using while statements are getting stuck in a loop. Executing the macro results is a never-ending loop, blocking all other inputs, often freezing the web interface. Somewhere I read that the behavior of G4 has changed with the new release. But I was unable to find that information.
while true if heat.heaters[2].current > heat.heaters[2].active M118 S"Fan ON" M106 P0 S1 X0.5; turn on cooling fan G4 S1 ; wait a sec else M106 P0 S0 ;turn fan off M118 S"Fan OFF" endwhile
-Max
-
-
@maxgyver
Your code kind of makes sense if it's an enclosure fan and it's being monitored in daemon.g , but as a stand alone macro, it is doing exactly as you asked, which as others have pointed out stay in a loop.
It will also be very annoying getting all this M118 messages.You should add consider adding an AND "&&" statement to only run each section if the fan is already on or off respectively.
also
endwhile is not valid
You need to comment it out if you're using it as a placeholder -
@MaxGyver And when did you intend to leave the macro? As I read it, there is no exit ever …
-
@maxgyver You need to add M99 after the G4 and M118 to exit the macro, otherwise it runs forever.
-
@maxgyver
Your code kind of makes sense if it's an enclosure fan and it's being monitored in daemon.g , but as a stand alone macro, it is doing exactly as you asked, which as others have pointed out stay in a loop.
It will also be very annoying getting all this M118 messages.You should add consider adding an AND "&&" statement to only run each section if the fan is already on or off respectively.
also
endwhile is not valid
You need to comment it out if you're using it as a placeholder -
@owend said in Macro gets stuck in a while loop after update to RRF 3.4 rc1:
Your code kind of makes sense if it's an enclosure fan and it's being monitored in daemon.g , but as a stand alone macro, it is doing exactly as you asked, which as others have pointed out stay in a loop.
Yep, that is precisely what it is intended for. In daemon.g the code works now, since I exclusively used the loop in daemon.g I was not aware of the effect it has on “normal” macros.
Thank you!
-