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

    Dockable Probe Configurator Macro

    Scheduled Pinned Locked Moved
    Gcode meta commands
    4
    20
    1.1k
    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.
    • jay_s_ukundefined
      jay_s_uk @mher
      last edited by

      @mher why not just use deployprobe.g and retractprobe.g thats called automatically when G30 is called or when M401 and M402 are used?

      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

      mherundefined 1 Reply Last reply Reply Quote 1
      • mherundefined
        mher @jay_s_uk
        last edited by

        @jay_s_uk
        The main reason for this was/is the fact that there are macro's which will call retract/deploy probe in while loops. Which would cause the probe to be docked and loaded multiple times which would take a lot of time while it only needs to be loaded/docked once before and after the while loop.

        Lets say running bed tramming which will call g30 in 3 spots in a while loop. That will take unnecessary long when it's in the retract/deploy commands while now it's just adding the new command above and below the while loop and it's done and a lot quicker.

        I have been printing myself for 2 weeks or so with this setup (before creating this script, which I really only created to help other people) without any issues and docking/loading works perfectly every time

        jay_s_ukundefined 1 Reply Last reply Reply Quote 0
        • jay_s_ukundefined
          jay_s_uk @mher
          last edited by

          @mher you should be able to call M401 manually before the first call of G30 and then it should remain undocked until you send a final M402

          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

          mherundefined 2 Replies Last reply Reply Quote 1
          • mherundefined
            mher @jay_s_uk
            last edited by

            @jay_s_uk I'll do some testing tonight and potentially change the script to output the results into the retract/deploy macros. Only thing I'm slightly worried about is that it'd be overwriting any settings someone already has in there. Then again that might be a good thing

            1 Reply Last reply Reply Quote 1
            • mherundefined
              mher @jay_s_uk
              last edited by

              @jay_s_uk as promised I looked into it and I've updated the script accordingly in the start post

              1 Reply Last reply Reply Quote 1
              • izemanundefined
                izeman @mher
                last edited by izeman

                @mher Thanks for this great macro. I tried it, and most of it worked for me, but I don't see what type of probe it expects.
                I configured the Klicky as z-probe switch connected to z-endstop.
                I can pick it up, detach, attach etc, but after the final test is always says:

                M292 The probe wasnt detached, please start again
                

                This is M558:

                m558
                Z Probe 0: type 5, input pin zstop, output pin nil, dive height 5.0mm, probe speeds 120,120mm/min, travel speed 6000mm/min, recovery time 0.00 sec, heaters normal, max taps 1, max diff 0.03
                
                OwenDundefined 1 Reply Last reply Reply Quote 0
                • OwenDundefined
                  OwenD @izeman
                  last edited by

                  @izeman
                  It looks to me like the two M564 commands are indented too far.
                  Try aligning them with the "abort" commands

                  izemanundefined 1 Reply Last reply Reply Quote 0
                  • izemanundefined
                    izeman @OwenD
                    last edited by

                    @OwenD said in Dockable Probe Configurator Macro:

                    @izeman
                    It looks to me like the two M564 commands are indented too far.
                    Try aligning them with the "abort" commands

                    There's several M564: Line #14,30,48,53,60,76,81. Which ones do you mean?

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

                      @izeman
                      All the ones in the if conditions which precede an abort command

                      if sensors.probes[0].value[0] = 1000
                          M291 P"Make sure the klicky probe is mounted on the toolhead" S3
                          if sensors.probes[0].value[0] = 1000
                      		M564 H1	; Don't allow movement without homing
                              abort "The probe doesn't seem to be attached, please attach before starting the configuration again"
                       
                      

                      Should be

                      if sensors.probes[0].value[0] = 1000
                          M291 P"Make sure the klicky probe is mounted on the toolhead" S3
                          if sensors.probes[0].value[0] = 1000
                      	M564 H1	; Don't allow movement without homing
                              abort "The probe doesn't seem to be attached, please attach before starting the configuration again"
                       
                      
                      izemanundefined 1 Reply Last reply Reply Quote 0
                      • izemanundefined
                        izeman @OwenD
                        last edited by izeman

                        @OwenD Thanks. It seems though that this was somehow auto-formated already. They all look like you said. Once you copy it here it changes the format?!

                        bdb3adc9-388c-4f40-930d-c32e6203c3c3-image.png

                        izemanundefined 1 Reply Last reply Reply Quote 0
                        • izemanundefined
                          izeman @izeman
                          last edited by izeman

                          Reconfigured the probe now - seems it was wrong somehow.

                          Now I get:

                          M292
                          Error: in file macro line 270 column 7: meta command: expected string expression
                          

                          ef05c268-54fe-414d-b1cb-4690fa7f590d-image.png

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

                            @izeman
                            The first warning is a it says.
                            Review Klicky.g with a text editor set to show spaces and tabs.
                            You can see tabs before the M564 and spaces everywhere else
                            tabls.png

                            The second error is in a much bigger file.
                            Either your print file, or maybe daemon.g
                            Shouldn't be many files longer than 270 lines.
                            It'll be something like an echo or other command that doesn't have a quoted string after it.

                            izemanundefined 1 Reply Last reply Reply Quote 0
                            • izemanundefined
                              izeman @OwenD
                              last edited by izeman

                              @OwenD I will check the file with another editor. Thanks!

                              But for the error in macro line 270: There is no daemon.g anywhere on the SD-card, and I'm not printing anything. I'm just calling the macro to generate deployprobe.g and retractprobe.g.
                              This must be some internal file that's called?!

                              Got all the tabs removed now, and RRF doesn't complain anymore. Now everything runs fine, and in the end it throws this error:

                              M292
                              Error: in file macro line 490 column 7: meta command: expected string expression
                              

                              Same error, different location ... If I knew where to search for it ...

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

                                @izeman
                                I'm guessing the version of RRF and/or DWC you're using is miscounting the line feeds or carriage returns that your editor is using.

                                I think the actual error is caused because there were spaces in the file between "echo >" and the filename

                                echo > {var.deployFile} "; The deploy command for Z when using a dockable probe" ; Let's create the probe loading code file for dockable probes
                                echo >> {var.deployFile} "if sensors.probes[0].value[0] != 0"
                                

                                Should be

                                echo >{var.deployFile} "; The deploy command for Z when using a dockable probe" ; Let's create the probe loading code file for dockable probes
                                echo >>{var.deployFile} "if sensors.probes[0].value[0] != 0"
                                

                                See the documentation here
                                There must be no spaces between the > or >> symbol and <filename>. The default folder for the file is /sys.

                                Try the attached file without editing it.
                                Rename it to whatever you wish
                                klicky_setup.g

                                izemanundefined 1 Reply Last reply Reply Quote 0
                                • izemanundefined
                                  izeman @OwenD
                                  last edited by

                                  @OwenD Thanks for your tremendous effort, but the problem still exists.

                                  d7c3d506-9ea5-4d1e-b81a-55ec55a0e569-image.png

                                  izemanundefined OwenDundefined 2 Replies Last reply Reply Quote 0
                                  • izemanundefined
                                    izeman @izeman
                                    last edited by

                                    I now just went to the code, and I guess I could see what it's meant to do, and basically it's not needed to be run as a macro. I can just determine the positions per hand, and then c&p the to be generated code (the last two blocks) into the .g files. I will try that.

                                    izemanundefined 1 Reply Last reply Reply Quote 0
                                    • izemanundefined
                                      izeman @izeman
                                      last edited by

                                      Just in case someone else is looking for a deployprobe.g and retractprobe.g for a klicky probe, and got the same issues as I got. Just use the tool to determine the values, or do it manually, and c&p it into those two files:

                                      ; The deploy command for Z when using a dockable probe" 
                                      ; Let's create the probe loading code file for dockable probes
                                      
                                      if sensors.probes[0].value[0] != 0
                                          var originX = {move.axes[0].userPosition} ; Store the X position before grabbing the probe.
                                          var originY = {move.axes[1].userPosition} ; Store the Y position before grabbing the probe.
                                          G1 X238.6 Y55 F999999 ; Move tool in front of dock
                                          G1 X238.6 Y25 F999999 ; Move tool in position where probe is mounted
                                          G1 X238.6 Y55 F999999 ; Move tool in front of dock
                                          if var.originX > 238.6 || var.originY > 55 ; Move the toolhead back to the position we came from
                                             G1 X{var.originX} Y{var.originY} F999999
                                          M400
                                      if sensors.probes[0].value[0] != 0
                                          abort ""Error probe not attached - aborting""
                                      
                                      ; The retract command for Z when using a dockable probe
                                      ; Let's create the docking code file for dockable probes
                                      
                                      if sensors.probes[0].value[0] != 1000
                                          G90
                                          G1 X238.6 Y55 F999999 ; Move tool in front of dock
                                          M400
                                          G1 X238.6 Y25 F999999 ; Move tool in position where probe is mounted
                                          G1 X188.6 Y25 F999999 ; Move tool to detach probe
                                          G1 X238.6 Y55 F999999 ; Move tool in front of dock
                                          M400
                                      if sensors.probes[0].value[0] != 1000
                                          abort ""Error probe not docked - aborting""
                                      
                                      1 Reply Last reply Reply Quote 0
                                      • OwenDundefined
                                        OwenD @izeman
                                        last edited by

                                        @izeman
                                        I'm afraid that error is my fault. (control character in string)
                                        In my haste, I did a search and replace to change all the spaces to tabs to fix the first error you were having.
                                        I did not notice that it also put tabs in the echo command (which must have only spaces)
                                        I do not have a klicky probe, so cannot fully test this, but I have tested everything except checking the probe status and it should now work as the OP intended.
                                        Amended file attached
                                        klicky_setup.g

                                        BTW, you also appear to have some errors in config.g
                                        You should run M98 P"config.g" and investigate

                                        izemanundefined 1 Reply Last reply Reply Quote 0
                                        • izemanundefined
                                          izeman @OwenD
                                          last edited by

                                          @OwenD WORKS GREAT now!! Thanks a lot!!!

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