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

Custom G-Code command

Scheduled Pinned Locked Moved
Tuning and tweaking
4
7
917
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.
  • undefined
    AdrAs
    last edited by AdrAs 4 Aug 2020, 14:34 8 Apr 2020, 14:31

    I couldn't find anything using the search. Is it possible to create a custom gcode command for a g-code which doesn't exist yet?

    I'd like to create a M601 command which simply executes M226. Is that somehow possible?

    [Edit] Nevermind, I just created a M601.g file in the sys folder with the following code

    ; M601 is the command Prusa printers issue to pause print
    ; However in duet/reprap firmware that command doesn`t exist
    ; And therefore we can bind it to the actual reprap pause command which is M226
    M226
    
    1 Reply Last reply Reply Quote 1
    • undefined
      Phaedrux Moderator
      last edited by 8 Apr 2020, 21:08

      Glad you found the answer. In case anyone searches in the future:

      Note, in RepRapFirmware 2.03 and later, if you try to execute a G- or M-command that RRF does not implement, it will execute a system macro of that name if it exists. For example, if you send G40 then it will execute /sys/G40.g if it exists; and if you send M48 then it will execute /sys/M48.g if it exists.

      Z-Bot CoreXY Build | Thingiverse Profile

      undefined 1 Reply Last reply 24 Nov 2021, 18:18 Reply Quote 1
      • undefined
        herrtschaefer @Phaedrux
        last edited by 24 Nov 2021, 18:18

        @phaedrux Is it possible to call the original g code the macro is replacing from within the macro, or whill it recursively use the macro? I am trying to replace the M3 command with a custom one for one specific spindle,which needs special treatment but if i want to use other spindles i want to use M3 as intended.

        undefined 1 Reply Last reply 24 Nov 2021, 18:28 Reply Quote 0
        • undefined
          Phaedrux Moderator @herrtschaefer
          last edited by 24 Nov 2021, 18:28

          @herrtschaefer You cannot replace gcodes that already exist.

          Z-Bot CoreXY Build | Thingiverse Profile

          undefined 1 Reply Last reply 24 Nov 2021, 18:51 Reply Quote 0
          • undefined
            chrishamm administrators @Phaedrux
            last edited by 24 Nov 2021, 18:51

            @phaedrux said in Custom G-Code command:

            @herrtschaefer You cannot replace gcodes that already exist.

            That's possible using a third-party plugin in SBC mode, though.

            Duet software engineer

            undefined 1 Reply Last reply 24 Nov 2021, 19:50 Reply Quote 1
            • undefined
              Phaedrux Moderator @chrishamm
              last edited by 24 Nov 2021, 19:50

              @chrishamm I must have missed that. Thanks for the heads up. Which plugin is that by the way?

              Z-Bot CoreXY Build | Thingiverse Profile

              undefined 1 Reply Last reply 26 Nov 2021, 11:55 Reply Quote 1
              • undefined
                chrishamm administrators @Phaedrux
                last edited by 26 Nov 2021, 11:55

                @phaedrux I was referring to a custom one that you'd have to write first. I believe ExecOnMCode lets you replace any code with a custom command and DuetPi Management Plugin handles several standard codes before they are sent to RRF.

                Duet software engineer

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