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

Analog input? Or adjust variable by input?

Scheduled Pinned Locked Moved
Using Duet Controllers
3
8
346
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
    tenaja
    last edited by tenaja 16 Mar 2021, 18:36

    I am running a board in production that will only be operating the same part repeatedly. This will be run by production workers with no technical capability. I cannot have them editing the gcode for any reason.

    I need a way to compensate for material variation; there are two separate lines that could need compensation. Is there an analog input I can use to modify one axis travel in a specific location? For instance, a way to a line such as "G1 X1 Y1" get modified to e.g. "G1 X1 Y1.01" if there is a 10% variation? (I understand the gcode will NOT get edited, but I need to have that type of impact on one axis.)

    Thanks!

    1 Reply Last reply Reply Quote 0
    • undefined
      Phaedrux Moderator
      last edited by 16 Mar 2021, 19:16

      Not sure how that would be possible, but I'll bring it to attention.

      Z-Bot CoreXY Build | Thingiverse Profile

      undefined 1 Reply Last reply 16 Mar 2021, 20:34 Reply Quote 0
      • undefined
        tenaja
        last edited by 16 Mar 2021, 20:10

        Thanks. I know I could use a sp3t switch to select one of three programs to run, but then there are three separate gcode files to maintain and validate. It would be a lot easier if a single program could be adjustable. Even conditional variable assignment (if input 1, val = 1, if input 2, val = 1.01, etc), or conditional execution...

        Thanks again.

        1 Reply Last reply Reply Quote 0
        • undefined
          tenaja @Phaedrux
          last edited by 16 Mar 2021, 20:34

          @Phaedrux Has anybody used some of this page?
          https://duet3d.dozuki.com/Wiki/Gcode#Section_Conditional_execution_loops_and_other_command_words

          Perhaps a conditional execution will allow jumping and/or selecting gcode lines?

          undefined 1 Reply Last reply 16 Mar 2021, 21:03 Reply Quote 0
          • undefined
            OwenD @tenaja
            last edited by OwenD 16 Mar 2021, 21:03

            @tenaja
            The following pre-supposed your running RRF v3.3b2 or later
            You could use conditional code to process certain travel moves depending on an input
            It would require you to post process your original gcode to add the required lines.
            If and elif would be a lot of extra lines but would react to alterations mid print.

            You could for example create a variable at the start of the print for the amount of X & Y variation
            Then modify every movement to use this compensation.
            This would only allow you to select the compensation amount prior to printing unless you use a global variable which is updated by daemon.g

            The below code is an u tested example and may have syntax errors as I'm on my phone.

            so your config.g might have

            global xVariation=0
            global yVariation=0

            In daemon.g you might have

            if sensors.inputs[3].value=1
            set global.xVariation=0.01
            set global.yVariation=0.01
            elif sensors.inputs[4].value=1
            set global.xVariation=-0.01
            set global.yVariation=-0.01

            In your print gcode you'd modify all your moves

            G1 X25 Y12.3

            To

            G1 X{25 + global.xVariation} Y{12.3 + global.yVariation}

            Edit:
            On further thought you'd probably use triggers for the inputs to set the variables rather than daemon.g

            undefined 1 Reply Last reply 16 Mar 2021, 21:14 Reply Quote 1
            • undefined
              OwenD @OwenD
              last edited by 16 Mar 2021, 21:14

              Of course if those moves also contain extruder moves then you should recalculate the required extrusion value as well.

              undefined 2 Replies Last reply 17 Mar 2021, 12:57 Reply Quote 0
              • undefined
                tenaja @OwenD
                last edited by 17 Mar 2021, 12:57

                @OwenD Thanks, I might check that out. Since it is a production machine, I may wait for the final release. The code is hand-written, and there are no extruder moves, so this is exactly what I was looking for.

                Is there no "EndIf", or do the blocks use indentation like Python?

                Thanks again!

                1 Reply Last reply Reply Quote 0
                • undefined
                  tenaja @OwenD
                  last edited by 19 Mar 2021, 19:25

                  @OwenD, how do I reference the E0Stop and E1Stop inputs in this, instead of "sensors.inputs[x]?

                  if sensors.inputs[3].value=1
                  set global.xVariation=0.01
                  set global.yVariation=0.01
                  elif sensors.inputs[4].value=1
                  set global.xVariation=-0.01
                  set global.yVariation=-0.01
                  1 Reply Last reply Reply Quote 0
                  1 out of 8
                  • First post
                    1/8
                    Last post
                  Unless otherwise noted, all forum content is licensed under CC-BY-SA