Duet3D Logo

    Duet3D

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

    Help with if then loop

    Gcode meta commands
    5
    7
    169
    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.
    • luckyflyer
      luckyflyer last edited by luckyflyer

      I'm converting my Z probe to a Klicky style microswitch. I'm waiting on parts to finish the dock/undock of the switch. I would like to be able to remove the magnetically held switch by hand until the parts come in. I would like to write a macro to check if the Z probe is 0 then loop back and check again. If the Z probe is greater than 0 then proceed. This sounds simple and I'm sure it is but I'm having trouble with it, running f/w 3.2. Could someone show me how to write this code, thanks.

      jay_s_uk zapta 2 Replies Last reply Reply Quote 0
      • jay_s_uk
        jay_s_uk @luckyflyer last edited by

        @luckyflyer there's no conditional gcode or object model until 3.3. I suggest you upgrade your firmware to 3.4 now it's stable and then come back

        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 1
        • luckyflyer
          luckyflyer last edited by

          @jay_s_uk I'll do that today.

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

            After you get your fw updated, check this doc page for details of programming capabilities in 3.4. The if statement is right in there.

            And if you are waiting for a user action, you might consider using an M291 that can pause code execution (blocking) until the user responds.

            oliof 1 Reply Last reply Reply Quote 0
            • oliof
              oliof @mikeabuilder last edited by

              @mikeabuilder seems like you forgot adding the link. Here it is: https://docs.duet3d.com/en/User_manual/Reference/Gcode_meta_commands

              <>Creality CR-20 IDEX Duet3 mini 5+<>RatRig V-Minion SKR RRF 1.1<>

              1 Reply Last reply Reply Quote 0
              • zapta
                zapta @luckyflyer last edited by zapta

                @luckyflyer, this is how I check that the Klicky was indeed picked up. The probe value changes between 0 and 1000. Not sure why I use > 250 and not > 750 but it may not matter.

                M400
                G4 P250   ; Wait 250ms
                if {sensors.probes[0].value[0]} > 250
                  echo "Error: Clickey not picked. Value: " ^ {sensors.probes[0].value[0]}
                  M112  ; Emergency stop.
                echo "Clicky pick done"
                
                1 Reply Last reply Reply Quote 0
                • luckyflyer
                  luckyflyer last edited by

                  Thanks all, I have 3.4 up and running. I'm now struggling with getting mjpeg-streamer working again. Final parts needed for docking the switch will be here Monday. I'm looking forward to having my printer back online.

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