Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    M28, writing file with comments possible?

    Scheduled Pinned Locked Moved
    General Discussion
    2
    9
    438
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Kolbiundefined
      Kolbi
      last edited by Kolbi

      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

      1 Reply Last reply Reply Quote 0
      • A Former User?
        A Former User
        last edited by A Former User

        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)

        Kolbiundefined 1 Reply Last reply Reply Quote 0
        • Kolbiundefined
          Kolbi @A Former User
          last edited by Kolbi

          @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☺

          A Former User? 2 Replies Last reply Reply Quote 0
          • A Former User?
            A Former User @Kolbi
            last edited by

            @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?

            1 Reply Last reply Reply Quote 0
            • A Former User?
              A Former User @Kolbi
              last edited by

              @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.

              1 Reply Last reply Reply Quote 0
              • Kolbiundefined
                Kolbi
                last edited by

                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
                
                1 Reply Last reply Reply Quote 0
                • A Former User?
                  A Former User
                  last edited by

                  thats interesting, seemed to not work with M29 from USB.

                  which version of RRF you on?

                  Kolbiundefined 1 Reply Last reply Reply Quote 0
                  • Kolbiundefined
                    Kolbi @A Former User
                    last edited by Kolbi

                    @bearer Running 3.1.1
                    RepRapFirmware for Duet 2 WiFi/Ethernet version 3.1.1 running on Duet WiFi 1.02 or later

                    But also, I'm not running from USB. Running a macro, to make another macro.

                    1 Reply Last reply Reply Quote 0
                    • Kolbiundefined
                      Kolbi
                      last edited by

                      Top post edited with BLUF.

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post
                      Unless otherwise noted, all forum content is licensed under CC-BY-SA