M28, writing file with comments possible?
-
UPDATE: BLUF, M28 "0:/macros/test" will create the file 'test' in the directory 'macros' but any lines beginning with comments ';' will be ignored. M559 can replace the command M28 and allows the comment lines to be written to the file, but the command differs in that it requires a 'P' before the file name such as: M559 P"0:/macros/test"
If using the M559 command, ensure you use the P - else your config.g in /sys/ will be overwritten.In using the M28 command, I just realized that my expected comments in the file to be written are ignored - example follows.
Using the following:
M28 "0:/macros/test" ; Begin writing to SD card file ; 0:/macros/Heat Nozzle ; Heat nozzle to set temp M291 R"Filament Handling" P"Heating nozzle for PETg, please wait." S0 T5 T0 ; Activate Hotend M109 S230 ; set temp to 230c and wait M29 ; Stop writing to SD card
Results in this file:
M291 R"Filament Handling" P"Heating nozzle for PETg, please wait." S0 T5 T0 ; Activate Hotend M109 S230 ; set temp to 230c and wait
Is it possible to retain the comments, to get the following result?
; 0:/macros/Heat Nozzle ; Heat nozzle to set temp M291 R"Filament Handling" P"Heating nozzle for PETg, please wait." S0 T5 T0 ; Activate Hotend M109 S230 ; set temp to 230c and wait
Thanks,
Kolbi -
Look at M559 instead? (i posted to a recent thread on the topic with a caveat, and its only usable over usb, if you need it self contained then no-go)
-
@bearer said in M28, writing file with comments possible?:
Look at M559 instead?
Most definitely a no-go...
When executing the following:
M559 "0:/macros/test" ; Begin writing to SD card file ; 0:/macros/Heat Nozzle ; Heat nozzle to set temp M291 R"Filament Handling" P"Heating nozzle for PETg, please wait." S0 T5 T0 ; Activate Hotend M109 S230 ; set temp to 230c and wait M29 ; Stop writing to SD card
It resulted in:
M98 P"0:/macros/Maintenance/test"
Writing to file: config.g
And - it most definitely overwrote my config.g...always have a backup
-
@Kolbi said in M28, writing file with comments possible?:
Most definitely a no-go...
probably, not sure if its reliant on a stream like usb or telnet, but there does seem to be an issue where it only works with a known filesize (if you dig up the other tread from not too long ago).
but given that the parser is meant to ignore anything after a ; you'd need to find a way to escape the ;
woraround may be to use echo or M118 to telnet, uart or usb which if not in use will have no effect other than being human readable in the file?
-
@Kolbi said in M28, writing file with comments possible?:
And - it most definitely overwrote my config.g
thats expected, as config.g is the default filename if not specified with the P"filename" parameter.
-
Ah!!!!! The 'P' - I forgot the 'P'
It works! Used the following:
M559 P"0:/macros/test" ; Begin writing to SD card file ; 0:/macros/Heat Nozzle ; Heat nozzle to set temp M291 R"Filament Handling" P"Heating nozzle for PETg, please wait." S0 T5 T0 ; Activate Hotend M109 S230 ; set temp to 230c and wait M29 ; Stop writing to SD card
And it made the file:
; 0:/macros/Heat Nozzle ; Heat nozzle to set temp M291 R"Filament Handling" P"Heating nozzle for PETg, please wait." S0 T5 T0 ; Activate Hotend M109 S230 ; set temp to 230c and wait
-
thats interesting, seemed to not work with M29 from USB.
which version of RRF you on?
-
@bearer Running 3.1.1
RepRapFirmware for Duet 2 WiFi/Ethernet version 3.1.1 running on Duet WiFi 1.02 or laterBut also, I'm not running from USB. Running a macro, to make another macro.
-
Top post edited with BLUF.