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.
    • tenajaundefined
      tenaja
      last edited by tenaja

      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
      • Phaedruxundefined
        Phaedrux Moderator
        last edited by

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

        Z-Bot CoreXY Build | Thingiverse Profile

        tenajaundefined 1 Reply Last reply Reply Quote 0
        • tenajaundefined
          tenaja
          last edited by

          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
          • tenajaundefined
            tenaja @Phaedrux
            last edited by

            @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?

            OwenDundefined 1 Reply Last reply Reply Quote 0
            • OwenDundefined
              OwenD @tenaja
              last edited by OwenD

              @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

              OwenDundefined 1 Reply Last reply Reply Quote 1
              • OwenDundefined
                OwenD @OwenD
                last edited by

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

                tenajaundefined 2 Replies Last reply Reply Quote 0
                • tenajaundefined
                  tenaja @OwenD
                  last edited by

                  @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
                  • tenajaundefined
                    tenaja @OwenD
                    last edited by

                    @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
                    • First post
                      Last post
                    Unless otherwise noted, all forum content is licensed under CC-BY-SA