Can I use M505 in a "pre-print" macro?
-
Short version of the question as per title.
Longer version of the question.......I will shortly have 3 very different hot ends to swap between (one, two and six inputs). The printer configurations and macros are significantly different for each hot end so I plan to use 3 sets of sys files in 3 different sub folders and use M505 then M98 P"config.g" to switch between them.
What I also like to do is use pre and post print macros to do everything required, rather than using slicer generated start and end gcodes. The slicer start and end codes simply call the relevant macros. I'll be using different "pre-print" macros for each hot end in any case, so what I plan to do is put M505 P"ConfigWhichever" followed by M98 P"config.g", followed by a suitable G4 pause at the start of each pre-print macro. The idea being that all I have to do is select a file, hit print, and the pre-print macro will change the configuration as necessary, then go on to do all the stuff that it does now (the homing, heating, purging etc).
Any reason why that won't work?
-
I can't foresee any issues, but I haven't tested it myself.
-
Hi,
Seems like it should work.
How are you going to choose between configurations?
Thanks.
Frederick
-
@fcwilt said in Can I use M505 in a "pre-print" macro?:
Hi,
Seems like it should work.
How are you going to choose between configurations?
Thanks.
Frederick
If you check out M505 you'll see that the way to do it is to create separate folders for each configuration. Essentially, each of these folders contain everything that normally resides in /sys. So my 3 folders will be something like /sys/singleInput, /sys/dualInput and /sys/sixInput. Each folder will contain exactly the same file names, but the commands inside those individual files will vary depending on which hot end I want to use.
So sending M505 P"singleInput" will change the path from /sys to sys/singleInput. Then M98 P"config.g" will run the version of config.g that resides inside /sys/singleInput. Likewise any system macros such as homing files will run the version that resides inside the respective sub folder.
There will of course need to be a config.g file in the root of /sys so that the machine can boot when power is applied. But this config.g needs only have M505 P"OneOrOtherOfTheConfigFolders" followed by M98 P"config.g" to choose which will be the default configuration after power up.
Any calls to macros which reside inside the root macro folder will of course remain unchanged and can therefore be common to all configurations.
Edit. And I might create 3 macros called "SingleInput", "DualInput" and "SixInput" or some such. Each of those will just have an M505 followed by M98 P"config.g". That will give me a quick manual way to switch configs without having to remember any commands or path names.
Edit2. Maybe at some time in the future I'll do something with pogo pins or some such so that the configuration is automatically changed whenever a respective hot end is physically installed. That'd be cool...........hmmm...........
-
@deckingman said in Can I use M505 in a "pre-print" macro?:
Edit. And I might create 3 macros called "SingleInput", "DualInput" and "SixInput" or some such. Each of those will just have an M505 followed by M98 P"config.g". That will give me a quick manual way to switch configs without having to remember any commands or path names.
That was the question I was asking.
I've got three different "modes" that I need to change on occasion. I am using the NAME of three dummy fans as a variable to determine the mode. But naturally I have to have three macros to cycle through the different names for each mode.
Hopefully we will have real variables soon and the user interface controls to manipulate them.
Edit2. Maybe at some time in the future I'll do something with pogo pins or some such so that the configuration is automatically changed whenever a respective hot end is physically installed. That'd be cool...........hmmm...........
That sounds very slick - do that. BTW, what's a "pogo pin"?
Thanks.
Frederick
-
Using pogo pins or similar is a pretty common way of telling robots which welding jig is in place, so seems to me to be the perfect solution in your case.
A single macro can the be used to do the check, so you can run it in sys/config.g and at any tool change.
It would also tell you if no tool was picked up.@fcwilt something like this
https://a.aliexpress.com/_mqYZ397 -
@OwenD said in Can I use M505 in a "pre-print" macro?:
...............A single macro can the be used to do the check, so you can run it in sys/config.g and at any tool change.
It would also tell you if no tool was picked up................For info, I (will) have 3 hot ends but this isn't a tool changer in that sense. They all use one or more of the same 6 extruders so there is a lot of loading and unloading of filament, swapping Bowden tubes and wires etc. I have no plans to turn this printer into a tool changer - it'd likely be easier to start afresh and build another machine.
But, it'd still be good not to have to remember to change config files whenever I swap hot ends, so pogo pins or other type of switches wouldn't be too difficult to do.
Thinking about it, it could be done with two switches on the carriage and bosses on each hot end that would contact the switches. One hot end end would have to a boss which would make (or break) contact with (say) the left hand switch, another hot end would have a boss which would trigger the right hand switch, and the third would have two bosses which would trigger both switches (and none would indicate no hot end fitted). Might give that a bit more thought............