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

G-Code Loop

Scheduled Pinned Locked Moved Solved
Gcode meta commands
2
8
704
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
    R3D
    last edited by 1 Sept 2020, 19:34

    In the current object model, is there a way to loop a section of gcode to continue during the duration of the print? I have a prototype pellet fed extruder with a Duet 3 6HC and a 3HC expansion all up to date running 3.1.1 and my pelllets feed was being controlled by a capacitive sensor, which has gone bad on me. I have another coming but i would like to continue printing in the mean time. I figured there would be a way to implement a while loop in the prints gcode to activate my air solenoid with M42, wait a small amount of time, deactivate the solenoid, then wait another amount of time, then repeat that while the print is going.

    I am having trouble finding much information on the current object model and have little experience in this type of logic. Any help would be appreciated.

    Thanks,

    undefined 1 Reply Last reply 1 Sept 2020, 19:58 Reply Quote 0
    • undefined
      OwenD @R3D
      last edited by 1 Sept 2020, 19:58

      @R3D
      You should be able to do that by creating a daemon.g file

      You'll need to check if the state is printing, do your solenoid code then add a G4 for your dwell time.

      1 Reply Last reply Reply Quote 0
      • undefined
        R3D
        last edited by 1 Sept 2020, 20:00

        How does RRF handle the daemon.g file? does it only run it during prints?

        undefined 1 Reply Last reply 1 Sept 2020, 20:01 Reply Quote 0
        • undefined
          OwenD @R3D
          last edited by 1 Sept 2020, 20:01

          @R3D
          No it runs all the time so you have to check the state

          There's some more info here
          https://forum.duet3d.com/topic/14701/daemon-g-usage-cases/6

          1 Reply Last reply Reply Quote 0
          • undefined
            OwenD
            last edited by 1 Sept 2020, 20:08

            I'm not in front of a computer but something like

            if (state.status = "printing") && (layerheight > 0)
            M42 P5 S1
            G4 S10

            I can't remember the object model for the layer height but you may not care what layer it's on.
            Obviously I don't know what pin you want to control either.

            Be careful as if you make a mistake the daemon can't be stopped.
            You have to rename it to something else then delete it.

            1 Reply Last reply Reply Quote 1
            • undefined
              R3D
              last edited by 1 Sept 2020, 20:10

              Ok, that is some interesting stuff... daemon.g is available in 3.1.1 or would I have to go to RC11 as it states in the last post? and in your statement it has a simple if statement, i'm guessing the daemon.g is being constantly queried causing the if statement to act as a loop?

              undefined 1 Reply Last reply 1 Sept 2020, 20:13 Reply Quote 0
              • undefined
                OwenD @R3D
                last edited by 1 Sept 2020, 20:13

                @R3D
                Yes it is available in 3.1.1 but you must create it and place it in the system folder.

                And yes, the file is looped anyway so no need to create a loop in this instance.
                You must have the pause to suit your circumstances

                1 Reply Last reply Reply Quote 1
                • undefined
                  R3D
                  last edited by 1 Sept 2020, 20:15

                  Well this is definitely going to be a game changer for me, I will have to do some testing on one of my other test rigs to play around with this.

                  Thanks a million @OwenD, I am constantly amazed on how helpful the Duet Community is and i hope one day I know enough to be able to help others out as you have helped me.

                  🙂

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