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

    Is it possible to run macros inside the " " of M911?

    Scheduled Pinned Locked Moved Solved
    Gcode meta commands
    2
    3
    177
    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.
    • Nagoya-Kougeiundefined
      Nagoya-Kougei
      last edited by

      I'm using M911 to monitor the voltage of the PSU and perform a shutdown when necessary.
      M911

      My Duet is duet mini 5 + ,DSF Ver3.4.5

      I would like to execute the RasPi shutdown command along with this process.
      Does anyone know how to get the Raspberry Pi's shutdown to work with this code?

      Note: I plan to connect a battery to the Raspberry Pi for short-term UPS purposes using a supercapacitor, allowing it to maintain power for about one minute.
      This is the power supply board.

      I added [M999 B-1 P"OFF"] that can be used with the DuetPi plug-in in the M991 code generated by RRF Configurator.
      DuetPi Management Plugin

      M911 S19.8 R22.0 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000 M999 B-1 P"OFF""
      

      However, when I restart the system, I receive an error in config.g.

      I also attempted to create a shutdown macro by including "M999 B-1 P"OFF"" as a separate command, but that didn't work either.

      If this can be executed, I think that it can shut down automatically and safely.
      Can anyone help me?

      dc42undefined 1 Reply Last reply Reply Quote 0
      • dc42undefined
        dc42 administrators @Nagoya-Kougei
        last edited by dc42

        @Nagoya-Kougei if you want to include a double-quote character inside a string parameter, you have to duplicate it. So your command should be:

        M911 S19.8 R22.0 P"M913 X0 Y0 G91 M83 G1 Z3 E-5 F1000 M999 B-1 P""OFF"""
        

        In general we don't recommend calling macros within the M911 command string because of the time it may take to read the SD card. However, in your case it may well be OK because you are providing the Pi with backup power for a little while.

        Duet WiFi hardware designer and firmware engineer
        Please do not ask me for Duet support via PM or email, use the forum
        http://www.escher3d.com, https://miscsolutions.wordpress.com

        Nagoya-Kougeiundefined 1 Reply Last reply Reply Quote 1
        • Nagoya-Kougeiundefined
          Nagoya-Kougei @dc42
          last edited by

          @dc42 Thank you for teaching me how to write Gcode.

          It worked fine and the shutdown was performed!

          1 Reply Last reply Reply Quote 0
          • dc42undefined dc42 marked this topic as a question
          • dc42undefined dc42 has marked this topic as solved
          • First post
            Last post
          Unless otherwise noted, all forum content is licensed under CC-BY-SA