Duet3D Logo

    Duet3D

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Documentation
    • Order

    Conditional commands in macro

    Gcode meta commands
    4
    10
    108
    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.
    • Madtraxx
      Madtraxx last edited by

      Hi all,
      I'm trying to get a conditional move command into a tool change macro, as with X being over 195 it will crash the lever into the actual tool change tab (ultimaker 3 style).

      For this I have the following command, yet whatever I try I cannot seems to get it right (as I keep getting a "Bad command" message

      29cebd5a-94a7-4e9a-8ef7-f0a0e66c8982-image.png

      1 Reply Last reply Reply Quote 0
      • jay_s_uk
        jay_s_uk last edited by jay_s_uk

        Put it in {} brackets.
        so

        if {move.axes[0].machinePosition > 195}
        

        and then carry on as you were

        Owns various duet boards and is the main wiki maintainer for the Teamgloomy LPC/STM32 port of RRF. Assume I'm running whatever the latest beta/stable build is

        1 Reply Last reply Reply Quote 0
        • Madtraxx
          Madtraxx last edited by

          I tried, yet I still get the error and lines 2 and 3 are executed even when X<195

          1 Reply Last reply Reply Quote 0
          • dc42
            dc42 administrators last edited by

            You don't need to use { } in that command. What version of RRF are you using?

            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

            1 Reply Last reply Reply Quote 0
            • T3P3Tony
              T3P3Tony administrators last edited by

              @Madtraxx

              what happens when you send:

              echo move.axes[0].machinePosition
              

              You can also add that to the command to check things are working as expected:

              if move.axes[0].machinePosition > 195.0
                  echo move.axes[0].machinePosition
                  G90
                  G0 X196 Y175
              G90
              ....
              

              Also if you are still having issues please post the macro text here (not an image)

              www.duet3d.com

              1 Reply Last reply Reply Quote 0
              • Madtraxx
                Madtraxx last edited by Madtraxx

                Currently I am using RepRapFirmware for Duet 2 WiFi/Ethernet 2.03 (2019-06-13b2). Beginner's mistake here i guess to assume I used 3.2.2 (but it was only the Duet WEb Control 3.2.2)...

                @T3P3Tony sending that command trhough the console gives me back the same "Bad command" message.

                T3P3Tony 1 Reply Last reply Reply Quote 0
                • T3P3Tony
                  T3P3Tony administrators @Madtraxx last edited by

                  @Madtraxx yes, you need to upgrade to RRF3 to use conditional gcode

                  www.duet3d.com

                  1 Reply Last reply Reply Quote 0
                  • Madtraxx
                    Madtraxx last edited by

                    I changed to DFF v3 and changed the needed config lines to make my printer operational again.
                    Running "echo move.axes[0].machinePosition" in the console I still get the following:
                    346be706-c76e-486a-b3d4-245f3b6bb43a-image.png

                    Also changing the macro to the code that @T3P3Tony mentioned also didn't seem to work.

                    T3P3Tony 1 Reply Last reply Reply Quote 0
                    • T3P3Tony
                      T3P3Tony administrators @Madtraxx last edited by

                      @Madtraxx is that 3.2? I ask because normally the upgrade is 2.5.1 ->3.0 ->3.1.1 or later as long as you are on 3.1.1 or later that command should work

                      I know i said RRF3 before I should have said RRF3.x (at least 3.1.1)

                      www.duet3d.com

                      1 Reply Last reply Reply Quote 0
                      • Madtraxx
                        Madtraxx last edited by

                        Flashing the correct firmware this time (>3.3.1) has resolved the issue. Thanks for all the information!

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