Infinite loop?
-
@jay_s_uk in config.g is M98 P"VariableReset.g" and all variables are resetted to something i want in that VariableReset.g. LEDMode is "OFF" and for example, in tool change macro have set global.LEDMod = "ToolChange", when printing LEDMode = "Printing" etc
-
@k01571n3n can I suggest something like this?
; WorkLight (Bed static white, Frame static white, ToolHead static white) if {global.LEDMode == "WorkLight" && global.LEDModeLast != "WorkLight"} ; Enter loop M150 R255 U255 B255 S18 P255 F1 ; LED Bed = White M150 R255 U255 B255 S29 P255 F1 ; LED Frame = White M150 R255 U255 B255 S3 P255 ; LED ToolHead = White set global.LEDModeLast = "Worklight" ; Homing (Bed flashing yellow, Frame static white, ToolHead flashing yellow) if {global.LEDMode == "Homing" && global.LEDModeLast != "Homing"} ; Enter loop M150 R255 U255 S18 P255 F1 ; LED Bed = Yellow M150 R255 U255 B255 S29 P255 F1 ; LED Frame = White M150 R255 U255 S3 P255 ; LED ToolHead = Yellow G4 P1000 ; 1000ms time delay M150 R255 U255 S18 P0 F1 ; LED Bed = OFF M150 R255 U255 B255 S29 P255 F1 ; LED Frame = White M150 R255 U255 S3 P0 ; LED ToolHead = OFF G4 P1000 ; 1000ms time delay set global.LEDModeLast = "Homing" ; Printing (Bed static green, Frame static white, ToolHead static white) if {global.LEDMode == "Printing" && global.LEDModeLast != "Printing"} ; Enter loop M150 U255 S18 P255 F1 ; LED Bed = Green M150 R255 U255 B255 S29 P255 F1 ; LED Frame = White M150 R255 U255 B255 S3 P255 ; LED ToolHead = White set global.LEDModeLast = "Printing"
I know it won't loop the homing routine (can work on that next) but theres no point running the other two over and over. Let me know if it works
-
@jay_s_uk the reason for global.LEDModeLast is:
Printer is printing -> LEDMode = "Printing"
Toolchange comesToolchange macro set global.LEDMode = "ToolChange" tool change stuff set global.LEDMode = {global.LEDModeLast}
When LEDMode is changed to something from "Printing", it sets LEDModeLast = "Printing"
if global.LEDMode = "Printing" ; Enter loop M150 U255 S18 P255 F1 ; LED Bed = Green M150 R255 U255 B255 S29 P255 F1 ; LED Frame = White M150 R255 U255 B255 S3 P255 ; LED ToolHead = White set global.LEDModeLast = "Printing" <------ here
So when the toolchange is completed, LEDMode is back at "Printing" or whatever was the last state of LED, you got the point?
-
@k01571n3n yea, but at the end of your tpost, you can just change it back to printing.
-
@jay_s_uk yes i can but.. if im not printing, it will change it to wrong mode, thats why there is that last state in memory
-
@k01571n3n rather than using a variable, why not just check the printer state? that has different cases like idle, printing, toolchanging etc
-
@jay_s_uk but why wouldn’t you want to use variables? i dont get your point for that
-
@k01571n3n it is so easy to customise almost everything with variables
-
@k01571n3n look, it was a suggestion. i also said code that i thought would work compared to your code that doesn't. i'm sorry i couldn't help you
-
@jay_s_uk i understand but that's why i told you why ModeLast exists. and checking printer state is one option too