M505 / M98 question
-
I'm trying to rationalise my various configurations that I switch between. I have a number of set ups for different hot ends - single input, dual input, 6 input "mixing", 6 input multi material etc. I can use M505 to change the .sys path which helps but I also have a number of "user" (as opposed to system) macros that have slight differences depending on the hot end in use. For example Pre and Post Print macros which are called from the sliced gcode. My slicer start gcode simply consists of one line, typically something like - M98 P"0:/macros/PrePrintPla.g"
So my question is, do I have to put that pre-print macro in the "macros" folder (which is common to all configurations) or can I have different copies of that macro and put them in the various .sys subfolders that I have created for each hot end configuration? If I change my slicer start gcode from M98 P"0:/macros/PrePrint to simply M98 P"0:/PrePrint will it pick up the macro from the .sys path defined by M505?
Having just read that again, it may not make sense. Assuming I have /sys/SixInput/PrePrint.g and sys/SingleInput/PrePrint.g, and config.g had the line M505 P"SixInput", if the slicer start gcode was M98 P"0:/PrePrint.g" would it pick up the correct macro from /sys/SixInput. If so, do I need the "O:/" or would simply M98 P"PrePrint.g" work?
-
@deckingman said in M505 / M98 question:
Having just read that again, it may not make sense. Assuming I have /sys/SixInput/PrePrint.g and sys/SingleInput/PrePrint.g, and config.g had the line M505 P"SixInput", if the slicer start gcode was M98 P"0:/PrePrint.g" would it pick up the correct macro from /sys/SixInput.
No, it will look for the macro file in the root directory.
If so, do I need the "O:/" or would simply M98 P"PrePrint.g" work?
Yes it should work without the "0:/".
-
@dc42 Hmmm...OK, but I'm still a tad confused. In the explanation for M505 it states quote........
"Example
M505 P"experimental" ; change config file path from /sys/ to /sys/experimental/
Following this command, files that would normally be fetched from /sys/ (for example, homing files and system macro files in RepRapFirmware) are fetched from the specified folder instead. Any such files that are already being executed will continue to run."....end of quote
This lead me to the assumption that M505 changes the path from /sys to /sys/experimental for any .g files. Are you saying that the path only changes for certain macros in /sys? It seems odd to me that M505 will change the path for config.g, homing files (including homea.g, homeb.g homeu.g etc) bed.g, cancel.g, pause.g, resurrect.g, resume.g, sleep.g, stop.g, tfree/pre/post(n).g, trigger(n) etc, but it will not change the path for any other macro that I might want to put in /sys. i.e.
The wiki goes on to state....quote
"This command can be used to allow multiple configurations to be maintained easily. In RepRapFirmware the file /sys/config.g can contain just these two lines:
M505 P"config1"
M98 P"config.g"The first line changes the config file folder to /sys/config1 and the second one executes file config.g in that folder. To select an alternative configuration, only the first line needs to be edited."....end of quote
So if I can have .......
M505 P"config1"
M98 P"config.g"why can't I have
M505 P"config1"
M98 P"PrerPrint.g"
..........?Let me re-phrase my question. I can have copies of config.g , homex.g, homey.g homeall.g, etc in different sub folders of /sys. These files all have the same names but each file has different commands within it. By using M505, I am able to change the path from /sys to a sub folder of /sys so that any of these files which are normally fetched from /sys are fetched from the specified folder instead. Is there a way that I can expand this capability for macros (.g files) that would not normally reside in /sys. I thought it would be simple enough to move such files into /sys but if that won't work is there another way?
Specifically, I use a macro called "PrePrint.g" and I call this from my slicer start gcode. But I have several copies of this "Pre-Print.g", each of which resides in a separate folder on my PC, and each one does different things depending on whether I'm using a single input hot end, a dual input hot end, or a 6 input hot end. What I have to do now is upload the correct version of "Pre-Print,g" to the Duet every time I change hot ends. Similarly with "PostPrint.g". So what I'd like to do is keep those copies on the SD card so that when I use M505 to change the path to use the correct config.g and homing files for a particular hot end, it will also change the path to those pre and post print macros.
-
OK, so I've answered my own question and have a working solution.
Short version - Sending M98 P"PrePrint" will fetch any file from whichever sub folder of .sys which has been selected using M505. So sending M505 P"6Input" will change the M98 path from sys/PrePrint to sys/6Input/PrePrint.
Longer version. I created 4 sub folders of sys so sys/6InputMixing, sys/6InputMultiMat, sys/2Input and sys/SingleInput. Then I copied the contents of sys into each of these sub folders. I edited each of the configuration and homing files to suit each hot end configuration and added an M291 to each file so that I get a message box stating which folder the file has been fetched from. I also made a file called "PrePrint.g" which has nothing but an M291 with a message stating the sys folder name. This was copied to each of the 4 sub folders of sys and edited so that the message reflects the name of the sub folder in which that particular instance of the file exists.
The config.g file which is in sys is as follows
; Configuration file for Duet Gen 3 ; ******CHOOSE .SYS PATH ****** M505 P"6InputMultiMat" ;M505 P"6InputMixing" ;M505 P"SingleInput" ;M505 P"2Input" M98 P"config.g"
By commenting out all but one of the M505 lines, and cycling power, I changed between all of the configuration folders. The I sent M98 P"PrePrint" and confirmed that the file was indeed being fetched from the correct sub folder of .sys.
So now all I have to do is move the proper Pre-Print Macros from the "macros" folder to the sys/subfolders, and change my slicer start code from M98 P"0:/macros/PrePrint.g" to M98 P"PrePrint.g" and it will fetch the correct PrePrint macro from whichever subfolder is selected by M505 to suit the machine configuration.