Duet3D Logo

    Duet3D

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

    Repeating G32 until level

    Gcode meta commands
    3
    6
    250
    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.
    • Nurgelrot
      Nurgelrot last edited by

      So I have and Mini5+/Ender 5 Plus and the Z axis gets tilted pretty easy (especially when I m working on the printer and moving it etc). So I have a bed.g file defined and the lead screws set in config.g and G32 is working. But I'd like the G32 command to repeat until the bed is level right now I have to re-run it manually until i get down to a reasonable level. How do I go about that?

      here is what I have now:
      bed.g

      ; Bed file for Ender 5 Plus with probe offset of -45 -7 (creality default)
      M561                                                       ; clear any bed transform
      G29 S2                                                     ; Clear bed height map
      ; Probe point
      M401                                                       ; Deploy probe - deployprobe.g
      G30 P0 X47 Y187 Z-9999                      ; Left
      G30 P1 X315 Y187 Z-9999 S2              ;Right
      M402                                                   ; Retract Probe - retractprobe.g
      

      config.g

      G31 P500 X-45 Y-7 Z1.69                             ; set Z probe trigger value, offset and trigger height
      M671 X-23:386 Y180:180 S3	                ; Define lead scew locations
      M557 X5:315 Y5:345 S30                             ; define mesh grid
      

      Like I said all this works fine I just want it keep running until both Z are within .00x

      Thank you.

      fcwilt 1 Reply Last reply Reply Quote 0
      • fcwilt
        fcwilt @Nurgelrot last edited by

        @nurgelrot

        Here is an example of a file I created for another member.

        The values are for his printer.

        There are some macro calls which have comments which say what they do.

        Feel free to ask questions.

        Frederick

        ; bed.g
        ; called to perform bed leveling procedure
        
        ; =========================
        ; G32 will invoke this file
        ; =========================
        
        M98 P"homeALL_verify.g" ; verify printer has been homed
        
        ; ==================================================================================================================================================================================
        ; M671: Define positions pf manual bed leveling screws or Z leadscrews
        
        ; Xnn:nn:nn... list of between 2 and 4 X coordinates of the leadscrews that drive the Z axis or the bed levelling screws
        ; Ynn:nn:nn... list of between 2 and 4 Y coordinates of the leadscrews that drive the Z axis or the bed levelling screws
        ; Snn          maximum correction allowed for each leadscrew in mm (optional, default 1.0)
        ; Pnnn         pitch of the bed levelling screws (not used when bed levelling using independently-driven leadscrews). Defaults to 0.5mm which is correct for M3 bed levelling screws
        ; Fnn          fudge factor, default 1.0
        ; ==================================================================================================================================================================================
        
        ; *****************************************************
        ; update the M671 command below with the correct values
        ; *****************************************************
        
        M671 X327:327 Y520:-95 S6 ; positions of Z lead screws
        
        ; --- perform bed leveling ---
        
        while true
          ; run leveling pass
        
          ; ===============================================================================================
          ; NOTE: when G30 is invoked with a P parameter the Z probe X and Y offsets are taken into account
          ; ===============================================================================================
        
          ; ***********************************************************************************************
          ; update the G30 comands below with the correct values
          ; ***********************************************************************************************
        
          ; =================================
          ; method 1 - probe near lead screws
          ; =================================
        
          G30 P0 X327 Y50  Z-99999    ; probe near lead screw #1
          G30 P1 X327 Y425 Z-99999 S2 ; probe near lead screw #2
        
          ; ====================================
          ; method 2 - probe near corners of bed MAY NOT BE POSSIBLE GIVEN THIS PRINTER STYLE
          ; ====================================
        
          ;G30 P0 X???  Y??? Z-99999    ; Left  Front
          ;G30 P1 X???  Y??? Z-99999    ; Left  Rear
          ;G30 P2 X???  Y??? Z-99999    ; Right Rear
          ;G30 P2 X???  Y??? Z-99999 S3 ; Right Front
        
          ; check results - exit loop if results are good
        
          if move.calibration.initial.deviation < 0.02
            break
        
          ; check pass limit - abort if pass limit reached
        
          if iterations = 5
            M291 P"Bed Leveling Aborted" R"Pass Limit Reached"
            abort "Bed Leveling Aborted - Pass Limit Reached"
        
        ; --- finish up ---
        
        ; --- set Z=0 datum which can be affected by leveling ---
        
        M98 P"probe_set_z.g"          ; set Z=0 datum
        

        Printers: A FT-5 with the 713 upgrade bits. A custom MarkForged style. A small Utilmaker style and a CoreXY from kits. Various hotends. Using Duets (2 and 3) running 3.4.1

        Nurgelrot o_lampe 4 Replies Last reply Reply Quote 2
        • Nurgelrot
          Nurgelrot @fcwilt last edited by Nurgelrot

          @fcwilt I think I get the gist of that I'll write mine up and see how it works out. Thank you.

          1 Reply Last reply Reply Quote 0
          • o_lampe
            o_lampe @fcwilt last edited by

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • Nurgelrot
              Nurgelrot @fcwilt last edited by

              @fcwilt Yep Thanks for the help Put my settings inside the loop like you have. Works perfectly.

              1 Reply Last reply Reply Quote 2
              • o_lampe
                o_lampe @fcwilt last edited by

                @fcwilt
                If there's a Meta-code repository, it would be nice to post it there. too.
                Maybe with variables for iteration-depth and deviation-target. Placed at the beginning of the file, they are easier to find for all of us.

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