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

    Only probe where the part will be printed

    Scheduled Pinned Locked Moved
    General Discussion
    8
    51
    3.6k
    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.
    • RatRig0331undefined
      RatRig0331 @OwenD
      last edited by

      @owend

      One down one to go I’m still getting the m557 error with the 50/100 spacing will this be normal a normal error from down sizing the bed mesh or is there a fix

      Error: M557: bad grid definition: Spacing too small

      ——-Error: in GCode file line 773: G1: expected '}'———- is now fixed

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

        @ratrig0331 the most probe points you can have on a duet 2 are 121 and on a duet 3 are 441

        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

        RatRig0331undefined 1 Reply Last reply Reply Quote 0
        • RatRig0331undefined
          RatRig0331 @jay_s_uk
          last edited by

          @jay_s_uk too many points isn’t the issue I think, it must be too few points? With the settings first told to me it wanted to do a 13x12 grid on a 100mmx100mm print 156 points total, than I changed the min max to 50/100 and it only probed the middle and 4 conners and gave the same error

          OwenDundefined dc42undefined 2 Replies Last reply Reply Quote 0
          • OwenDundefined
            OwenD @RatRig0331
            last edited by OwenD

            @ratrig0331

            I believe the problem you are having is that I didn't allow for a probe that was offset to the other side of the extruder to mine.

            Try these files.
            I think it should sort it out.

            ;setDefaultProbePoints.g - to be called from config.g after Z probe configuration section and any time defaults need to be reset.
            
            var SafeZone = 10 ; probing won't be done closer than this amount from bed edge - adjust as required
            var defaultProbeSpacing = 50 ; default mesh grid spacing in mm - adjust as required
            
            ; shouldn't need to edit after here
            var MinReachableX = max(0,sensors.probes[0].offsets[0]) + var.SafeZone
            var MaxReachabeX = move.axes[0].max - abs(sensors.probes[0].offsets[0]) - var.SafeZone
            var MinReachableY =  max(0,sensors.probes[0].offsets[1]) + var.SafeZone
            var MaxReachabeY = move.axes[1].max - abs(sensors.probes[0].offsets[1]) - var.SafeZone
            
            M557 X{var.MinReachableX,var.MaxReachabeX} Y{var.MinReachableY,var.MaxReachabeY} S{var.defaultProbeSpacing}; define mesh grid
            ;echo "M557 X"^{var.MinReachableX}^","^{var.MaxReachabeX}, "Y"^{var.MinReachableY}^","^{var.MaxReachabeY}, "S"^{var.defaultProbeSpacing}
            if !exists(global.minProbeX)
            	global minProbeX = move.compensation.probeGrid.mins[0]
            else
            	set global.minProbeX = move.compensation.probeGrid.mins[0]
            
            if !exists(global.minProbeY)
            	global minProbeY = move.compensation.probeGrid.mins[1]
            else
            	set global.minProbeY = move.compensation.probeGrid.mins[1]
            
            if !exists(global.maxProbeX)
            	global maxProbeX = move.compensation.probeGrid.maxs[0]
            else
            	set global.maxProbeX = move.compensation.probeGrid.maxs[0]
            
            if !exists(global.maxProbeY)
            	global maxProbeY = move.compensation.probeGrid.maxs[1]
            else
            	set global.maxProbeX = move.compensation.probeGrid.maxs[1]
            
            

            revised mesh.g

            ;0:/sys/mesh.g
            ; run when G29 with no paramters is called.
            ; if this file not found G29 S0 will run
            var SafeZone = 3 ; safety margin for probing near edge.
            var MinSpace = 20 ; put default minimum spacing
            var MaxSpace = 60 ; put default maximum spacing
            
            ; these values are place holders aand will be calculated later
            var m557MinX = 40;  ; put your default here
            var m557MaxX = 180;  ; put your default here
            var m557MinY = 20;  ; put your default here
            var m557MaxY = 180;  ; put your default here
            var ProbeCenterX = 90 ; will be updated to probe centre of print
            var ProbeCenterY = 90 ; will be updated to probe centre of print
            var ProbeNumX = 8 ; put default number of probe points
            var ProbeNumY = 8 ; put default number probe points.
            
            
            var MaxProbePoints = max(floor(move.axes[0].max / var.MaxSpace),floor(move.axes[1].max / var.MaxSpace)) ; maximum points in either axis
            
            ;echo "Maximum allowed probe points is " ^ var.MaxProbePoints ^ " using max space of " ^ var.MaxSpace
            
            
            if exists(global.minProbeX)
            	if global.minProbeX < max(0,sensors.probes[0].offsets[0]) + var.SafeZone
            		echo "minProbeX (" ^ global.minProbeX ^ ") unreachable - reset to " ^ (sensors.probes[0].offsets[0] + var.SafeZone)
            		set global.minProbeX = max(0,sensors.probes[0].offsets[0]) + var.SafeZone
            	set var.m557MinX = global.minProbeX
            
            if exists(global.maxProbeX)
            	if global.maxProbeX < (global.minProbeX + (var.MinSpace*2))
            		set global.maxProbeX = (global.minProbeX + (var.MinSpace*2))
            	if global.maxProbeX > (move.axes[0].max - abs(sensors.probes[0].offsets[0]) - var.SafeZone)
            		echo "maxProbeX (" ^ global.maxProbeX ^ ") unreachable - reset to " ^ (move.axes[0].max - sensors.probes[0].offsets[0] - var.SafeZone)
            		set global.maxProbeX = move.axes[0].max - abs(sensors.probes[0].offsets[0]) - var.SafeZone
            	set var.m557MaxX = global.maxProbeX
            
            if exists(global.minProbeY)
            	if global.minProbeY < max(0,sensors.probes[0].offsets[1]) + var.SafeZone
            		echo "minProbeY (" ^ global.minProbeY ^ ") unreachable - reset to " ^ (sensors.probes[0].offsets[1] + var.SafeZone)
            		set global.minProbeY = max(0,sensors.probes[0].offsets[1]) + var.SafeZone
            	set var.m557MinY = global.minProbeY
            
            
            if exists(global.maxProbeY)
            	if global.maxProbeY < (global.minProbeY + (var.MinSpace*2))
            		set global.maxProbeY = (global.minProbeY + (var.MinSpace*2))
            	if global.maxProbeY > (move.axes[1].max - abs(sensors.probes[0].offsets[1]) - var.SafeZone)
            		echo "maxProbeY (" ^ global.maxProbeY ^ ") unreachable - reset to " ^ (move.axes[1].max - sensors.probes[0].offsets[1] - var.SafeZone)
            		set global.maxProbeY = (move.axes[1].max - abs(sensors.probes[0].offsets[1]) - var.SafeZone)
            	set var.m557MaxY = global.maxProbeY
            
            echo "Probing grid - X" ^ var.m557MinX ^ ":" ^ var.m557MaxX ^ " Y" ^ var.m557MinY ^ ":" ^ var.m557MaxY
            
            var MinProbesX = floor((var.m557MaxX - var.m557MinX) / var.MaxSpace)
            ;echo "Min Probes X is " ^ var.MinProbesX
            
            var MaxProbesX = floor((var.m557MaxX - var.m557MinX) / var.MinSpace)
            ;echo "Max Probes X is " ^ var.MaxProbesX
            
            set var.ProbeNumX = min(var.MaxProbePoints,var.MaxProbesX)
            
            var MinProbesY = floor((var.m557MaxY - var.m557MinY) / var.MaxSpace)
            ;echo "Min Probes Y is " ^ var.MinProbesY
            
            var MaxProbesY = floor((var.m557MaxY - var.m557MinY) / var.MinSpace)
            ;echo "Max Probes Y is " ^ var.MaxProbesY
            
            set var.ProbeNumY = min(var.MaxProbePoints,var.MaxProbesY)
            
            ; sanity check probe points
            if var.ProbeNumX<2
            	set var.ProbeNumX=2
            if var.ProbeNumY<2
            	set var.ProbeNumY=2
            
            if var.ProbeNumX > var.MaxProbePoints
            	set var.ProbeNumX = var.MaxProbePoints
            
            if var.ProbeNumY > var.MaxProbePoints
            	set var.ProbeNumY = var.MaxProbePoints
            
            if (var.ProbeNumX * var.ProbeNumY) > 441
            	if var.ProbeNumX > 21
            		set var.ProbeNumX = 21
            		echo "Too many X points - reduced to 21"
            	if var.ProbeNumY > 21
            		set var.ProbeNumY = 21
            		echo "Too many Y points - reduced to 21"
            	
            echo "Probing " ^ var.ProbeNumX ^ " points in X direction & " ^ var.ProbeNumY ^ " points in Y direction"
            
            ;check state of heaters
            var bedState = heat.heaters[0].state
            var bedActiveTemp = heat.heaters[0].active
            var bedStandbyTemp = heat.heaters[0].standby
            var nozzleState = heat.heaters[1].state
            M140 P0 S-276 ; turn off bed heater
            M568 P0 A0 ; turn off nozzle heater
            
            ; do probing
            set var.ProbeCenterX = (global.maxProbeX - ((global.maxProbeX - global.minProbeX)/2)) ; calculate centre point of probe area
            set var.ProbeCenterY = (global.maxProbeY - ((global.maxProbeY - global.minProbeY)/2)) ; calculate centre point of probe area
            echo "Setting Z datum point at X" ^ var.ProbeCenterX ^ " Y" ^ var.ProbeCenterY
            ; set Z = 0 to centre of probe area
            G1 X{var.ProbeCenterX- sensors.probes[0].offsets[0]} Y{var.ProbeCenterY- sensors.probes[0].offsets[1]} Z{sensors.probes[0].diveHeight+2} F3600
            G30
            echo "Mesh probing"
            M557 X{var.m557MinX,var.m557MaxX} Y{var.m557MinY,var.m557MaxY} P{var.ProbeNumX,var.ProbeNumY}
            if result != 0
            	abort "ERROR: could not create mesh" 
            else
            	G29 S0
            	if result != 0
            		abort "ERROR: Mesh probing failed"
            	else
            		echo "Mesh probing successful.   Loading mesh.."
            
            ; set Z = 0 to centre of probe area
            echo "Reset Z datum in mesh centre"
            G1 X{var.ProbeCenterX - sensors.probes[0].offsets[0]} Y{var.ProbeCenterY - sensors.probes[0].offsets[1]} Z{sensors.probes[0].diveHeight+2} F3600
            G30
            
            ; turn the heaters back on if needed
            if var.bedState != "off"
            	M140 S{var.bedActiveTemp} R{var.bedStandbyTemp}
            	if var.bedState="active"
            		M144 P0 S1 ; put bed on active temp
            	else
            		M144 P0 S0 ; put bed on standby temp
            if var.nozzleState	!= "off"
            	if var.nozzleState = "active"
            		M568 P0 A2 ; set nozzle to active
            	else
            		M568 P0 A1 ; set nozzle to standby
            
            1 Reply Last reply Reply Quote 1
            • dc42undefined
              dc42 administrators @RatRig0331
              last edited by dc42

              @ratrig0331 the minimum spacing between points allowed is 0.1mm in each of X and Y. "Spacing too small" means you have tried to specify a smaller spacing than that.

              Duet WiFi hardware designer and firmware engineer
              Please do not ask me for Duet support via PM or email, use the forum
              http://www.escher3d.com, https://miscsolutions.wordpress.com

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

                @dc42 said in Only probe where the part will be printed:

                the minimum spacing between points allowed is 0.1mm in each of X and Y. "Spacing too small" means you have tried to specify a smaller spacing than that.

                In that case I'm at a bit of a loss how @RatRig0331 is getting that error using my code.
                It's early morning here (Australia) and I have to go to work, so I can't look at till I get home.
                @RatRig0331 Can you please un-comment all the lines in the mesh.g that show the calculations and post the output from the console.

                At the start I work out the maximum possible number of probes if a full bed was done using maxSpace.
                Later I use the object size to recalculate the number of probes also using maxSpacing.
                The lesser of these two numbers is used (or should be).

                There must be a fundamental flaw in my logic (at least with your bed size and probe configuration). 😕

                It also occurs to me that I haven't catered for deltas or printers where X0, Y0 is in the center of the bed.

                RatRig0331undefined 2 Replies Last reply Reply Quote 1
                • RatRig0331undefined
                  RatRig0331 @OwenD
                  last edited by

                  @owend

                  8/15/2022, 8:04:58 PM Error: M557: bad grid definition: Spacing too small
                  8/15/2022, 8:04:26 PM Reset Z datum in mesh centre
                  8/15/2022, 8:04:26 PM Mesh probing successful. Loading mesh..
                  8/15/2022, 8:04:26 PM 36 points probed, min error -0.141, max error 0.093, mean -0.020, deviation 0.066
                  Height map saved to file 0:/sys/heightmap.csv
                  8/15/2022, 8:01:59 PM Mesh probing
                  8/15/2022, 8:01:50 PM Setting Z datum point at X250.0000 Y250.0000
                  8/15/2022, 8:01:50 PM Probing 6 points in X direction & 6 points in Y direction
                  8/15/2022, 8:01:50 PM Probing grid - X183.907:316.093 Y188.907:311.093
                  8/15/2022, 8:01:32 PM Leadscrew adjustments made: -0.014 0.008 0.009, points used 3, (mean, deviation) before (0.001, 0.010) after (-0.000, 0.000)
                  8/15/2022, 8:01:12 PM Leadscrew adjustments made: 0.015 0.022 0.001, points used 3, (mean, deviation) before (0.014, 0.008) after (-0.000, 0.000)
                  8/15/2022, 8:00:52 PM Leadscrew adjustments made: 0.102 0.033 -0.002, points used 3, (mean, deviation) before (0.046, 0.040) after (0.000, 0.000)
                  8/15/2022, 8:00:32 PM Leadscrew adjustments made: 0.503 0.279 0.452, points used 3, (mean, deviation) before (0.404, 0.087) after (-0.000, 0.000)
                  8/15/2022, 7:58:35 PM M32 "0:/gcodes/First_Layer_Test_0.2mm_PLA_10mhhhhhhhhhhhhhh.gcode"
                  File 0:/gcodes/First_Layer_Test_0.2mm_PLA_10mhhhhhhhhhhhhhh.gcode selected for printing

                  1 Reply Last reply Reply Quote 0
                  • RatRig0331undefined
                    RatRig0331 @OwenD
                    last edited by

                    @owend

                    8/15/2022, 8:17:42 PM Error: M557: bad grid definition: Spacing too small
                    8/15/2022, 8:17:10 PM Reset Z datum in mesh centre
                    8/15/2022, 8:17:10 PM Mesh probing successful. Loading mesh..
                    8/15/2022, 8:17:10 PM 36 points probed, min error -0.105, max error 0.079, mean -0.005, deviation 0.044
                    Height map saved to file 0:/sys/heightmap.csv
                    8/15/2022, 8:14:43 PM Mesh probing
                    8/15/2022, 8:14:34 PM Setting Z datum point at X250.0000 Y250.0000
                    8/15/2022, 8:14:34 PM Probing 6 points in X direction & 6 points in Y direction
                    8/15/2022, 8:14:34 PM Max Probes Y is 6
                    8/15/2022, 8:14:34 PM Min Probes Y is 2
                    8/15/2022, 8:14:34 PM Max Probes X is 6
                    8/15/2022, 8:14:34 PM Min Probes X is 2
                    8/15/2022, 8:14:34 PM Probing grid - X183.907:316.093 Y188.907:311.093
                    8/15/2022, 8:14:34 PM Maximum allowed probe points is 8 using max space of 60
                    8/15/2022, 8:14:16 PM Leadscrew adjustments made: 0.002 0.008 0.006, points used 3, (mean, deviation) before (0.005, 0.002) after (0.000, 0.000)
                    8/15/2022, 8:13:56 PM Leadscrew adjustments made: 0.016 0.016 0.011, points used 3, (mean, deviation) before (0.015, 0.002) after (0.000, 0.000)
                    8/15/2022, 8:13:36 PM Leadscrew adjustments made: 0.168 0.055 0.022, points used 3, (mean, deviation) before (0.084, 0.057) after (-0.000, 0.000)
                    8/15/2022, 8:13:16 PM Leadscrew adjustments made: 0.413 0.322 0.388, points used 3, (mean, deviation) before (0.372, 0.035) after (0.000, 0.000)
                    8/15/2022, 8:12:01 PM M32 "0:/gcodes/First_Layer_Test_0.2mm_PLA_10mhhhhhhhhhhhhhh.gcode"
                    File 0:/gcodes/First_Layer_Test_0.2mm_PLA_10mhhhhhhhhhhhhhh.gcode selected for printing

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

                      @ratrig0331
                      The M557 that is causing the error seems to be well after all the stuff I did.
                      Check for an M557 somewhere else in your slicer start gcode

                      RatRig0331undefined 2 Replies Last reply Reply Quote 0
                      • RatRig0331undefined
                        RatRig0331 @OwenD
                        last edited by

                        @owend

                        your right sorry it was in my start code purge line for some reason thank you so much for your time and patients with me this is all still vary new to me

                        8/15/2022, 9:22:31 PM Reset Z datum in mesh centre
                        8/15/2022, 9:22:31 PM Mesh probing successful. Loading mesh..
                        8/15/2022, 9:22:31 PM 36 points probed, min error -0.174, max error 0.083, mean -0.012, deviation 0.067
                        Height map saved to file 0:/sys/heightmap.csv
                        8/15/2022, 9:20:04 PM Mesh probing
                        8/15/2022, 9:19:56 PM Setting Z datum point at X250.0000 Y250.0000
                        8/15/2022, 9:19:55 PM Probing 6 points in X direction & 6 points in Y direction
                        8/15/2022, 9:19:55 PM Max Probes Y is 6
                        8/15/2022, 9:19:55 PM Min Probes Y is 2
                        8/15/2022, 9:19:55 PM Max Probes X is 6
                        8/15/2022, 9:19:55 PM Min Probes X is 2
                        8/15/2022, 9:19:55 PM Probing grid - X183.907:316.093 Y188.907:311.093
                        8/15/2022, 9:19:55 PM Maximum allowed probe points is 8 using max space of 60
                        8/15/2022, 9:19:55 PM Leadscrew adjustments made: -0.003 0.011 0.016, points used 3, (mean, deviation) before (0.007, 0.007) after (-0.000, 0.000)
                        8/15/2022, 9:19:34 PM Leadscrew adjustments made: 0.006 -0.003 0.004, points used 3, (mean, deviation) before (0.002, 0.003) after (0.000, 0.000)
                        8/15/2022, 9:19:14 PM Leadscrew adjustments made: 0.046 0.021 0.031, points used 3, (mean, deviation) before (0.032, 0.009) after (-0.000, 0.000)
                        8/15/2022, 9:18:54 PM Leadscrew adjustments made: -0.011 0.368 0.277, points used 3, (mean, deviation) before (0.213, 0.149) after (-0.000, 0.000)

                        1 Reply Last reply Reply Quote 0
                        • RatRig0331undefined
                          RatRig0331 @OwenD
                          last edited by

                          @owend

                          sorry one more question so far every time the start code hits your lines the hotend and bed turn off during the mesh than back on after. i tryed moving some things around but it still turns off all heaters during the mesh. here is my full start code

                          BED_TEMP=[first_layer_bed_temperature]
                          G90 ; use absolute coordinates
                          M83 ; extruder relative mode
                          M140 S[first_layer_bed_temperature] ; set final bed temp
                          M104 S150 ; set temporary nozzle temp to prevent oozing during homing and auto bed leveling
                          G4 S10 ; allow partial nozzle warmup
                          G28 ; home all axis
                          G1 Z50 F240
                          G1 X50 Y50 F3000
                          M116 ; Wait for all temps to stabilise
                          G32; (TRIM BED)
                          G32; (TRIM BED)
                          G32; (TRIM BED)
                          G32; (TRIM BED)

                          ;;;;;;auto probe print area only;;;;;;

                          set global.minProbeX = {first_layer_print_min[0]}
                          set global.maxProbeX = {first_layer_print_max[0]}
                          set global.minProbeY = {first_layer_print_min[1]}
                          set global.maxProbeY = {first_layer_print_max[1]}
                          M561 ; clear any bed transform
                          M140 S[first_layer_bed_temperature] ; set final bed temp
                          M104 S150 ; set temporary nozzle temp to prevent oozing during homing and auto bed leveling
                          G4 S10 ; allow partial nozzle warmup
                          G29 ; do mesh for printed area
                          G29 S1 ; load small mesh
                          G01 X0 Y{"{move.axes[1].max}"} Z0.6 F1500 ; Move to back corner while heating
                          M568 P{current_extruder} R{"{heat.coldExtrudeTemperature+5}"} S{first_layer_temperature[current_extruder]} A2 ; (set standby and active temperatures for active tool. Standby is 5 degrees above cold extrude temp )
                          M116 ; Wait for all temps to stabilise

                          ;;;;final temp and purge line;;;;

                          M104 S{first_layer_temperature[initial_extruder]+extruder_temperature_offset[initial_extruder]} ; set final nozzle temp
                          M190 S[first_layer_bed_temperature] ; wait for bed temp to stabilize
                          M109 S{first_layer_temperature[initial_extruder]+extruder_temperature_offset[initial_extruder]} ; wait for nozzle temp to stabilize
                          G4 S10 ; allow partial nozzle warmup
                          G1 Z2.0 F3000; (MOVE Z AXIS UP LITTLE)
                          G1 X0.1 Y20 Z0.35 F5000.0; (MOVE TO PURDGE START)
                          G1 X0.1 Y200.0 Z0.35 F1500.0 E25; (DRAW FIRST LINE)
                          G1 X0.4 Y200.0 Z0.35 F5000.0; (MOVE TO THE SECOND LINE)
                          G1 X0.4 Y20.0 Z0.35 F1500.0 E30; (DRAW SECOND LINE)
                          G92 E0; (EXTRUDER RESET)

                          OwenDundefined 2 Replies Last reply Reply Quote 0
                          • OwenDundefined
                            OwenD @RatRig0331
                            last edited by

                            @ratrig0331
                            The turning off of the heaters is deliberate and is done in mesh.g
                            I find that the accuracy of my bltouch suffers if they are on when probing
                            I run a 240v bed.
                            I'll have a look later and add an option to not turn off heaters.

                            dc42undefined 1 Reply Last reply Reply Quote 0
                            • dc42undefined
                              dc42 administrators @OwenD
                              last edited by

                              @owend you can turn off heaters temporarily during probing by using the B1 parameter in your M558 command.

                              Duet WiFi hardware designer and firmware engineer
                              Please do not ask me for Duet support via PM or email, use the forum
                              http://www.escher3d.com, https://miscsolutions.wordpress.com

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

                                @dc42
                                Roger that..
                                That makes that section of code superfluous.
                                Does it turn off the bed heater as well?

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

                                  @ratrig0331 said in Only probe where the part will be printed:

                                  You can remove these lines in your slicer as you have set your temps elsewhere in your start code.

                                  M568 P{current_extruder} R{"{heat.coldExtrudeTemperature+5}"} S{first_layer_temperature[current_extruder]} A2 ; (set standby and active temperatures for active tool.  Standby is 5 degrees above cold extrude temp )
                                  M116 ; Wait for all temps to stabilise
                                  

                                  This version removes all the code related to heating from mesh.g

                                  ;0:/sys/mesh.g
                                  ; run when G29 with no paramters is called.
                                  ; if this file not found G29 S0 will run
                                  var SafeZone = 3 ; safety margin for probing near edge.
                                  var MinSpace = 20 ; put default minimum spacing
                                  var MaxSpace = 60 ; put default maximum spacing
                                  
                                  ; these values are place holders aand will be calculated later
                                  var m557MinX = 40;  ; put your default here
                                  var m557MaxX = 180;  ; put your default here
                                  var m557MinY = 20;  ; put your default here
                                  var m557MaxY = 180;  ; put your default here
                                  var ProbeCenterX = 90 ; will be updated to probe centre of print
                                  var ProbeCenterY = 90 ; will be updated to probe centre of print
                                  var ProbeNumX = 8 ; put default number of probe points
                                  var ProbeNumY = 8 ; put default number probe points.
                                  
                                  
                                  var MaxProbePoints = max(floor(move.axes[0].max / var.MaxSpace),floor(move.axes[1].max / var.MaxSpace)) ; maximum points in either axis
                                  
                                  ;echo "Maximum allowed probe points is " ^ var.MaxProbePoints ^ " using max space of " ^ var.MaxSpace
                                  
                                  
                                  if exists(global.minProbeX)
                                  	if global.minProbeX < max(0,sensors.probes[0].offsets[0]) + var.SafeZone
                                  		echo "minProbeX (" ^ global.minProbeX ^ ") unreachable - reset to " ^ (sensors.probes[0].offsets[0] + var.SafeZone)
                                  		set global.minProbeX = max(0,sensors.probes[0].offsets[0]) + var.SafeZone
                                  	set var.m557MinX = global.minProbeX
                                  
                                  if exists(global.maxProbeX)
                                  	if global.maxProbeX < (global.minProbeX + (var.MinSpace*2))
                                  		set global.maxProbeX = (global.minProbeX + (var.MinSpace*2))
                                  	if global.maxProbeX > (move.axes[0].max - abs(sensors.probes[0].offsets[0]) - var.SafeZone)
                                  		echo "maxProbeX (" ^ global.maxProbeX ^ ") unreachable - reset to " ^ (move.axes[0].max - sensors.probes[0].offsets[0] - var.SafeZone)
                                  		set global.maxProbeX = move.axes[0].max - abs(sensors.probes[0].offsets[0]) - var.SafeZone
                                  	set var.m557MaxX = global.maxProbeX
                                  
                                  if exists(global.minProbeY)
                                  	if global.minProbeY < max(0,sensors.probes[0].offsets[1]) + var.SafeZone
                                  		echo "minProbeY (" ^ global.minProbeY ^ ") unreachable - reset to " ^ (sensors.probes[0].offsets[1] + var.SafeZone)
                                  		set global.minProbeY = max(0,sensors.probes[0].offsets[1]) + var.SafeZone
                                  	set var.m557MinY = global.minProbeY
                                  
                                  
                                  if exists(global.maxProbeY)
                                  	if global.maxProbeY < (global.minProbeY + (var.MinSpace*2))
                                  		set global.maxProbeY = (global.minProbeY + (var.MinSpace*2))
                                  	if global.maxProbeY > (move.axes[1].max - abs(sensors.probes[0].offsets[1]) - var.SafeZone)
                                  		echo "maxProbeY (" ^ global.maxProbeY ^ ") unreachable - reset to " ^ (move.axes[1].max - sensors.probes[0].offsets[1] - var.SafeZone)
                                  		set global.maxProbeY = (move.axes[1].max - abs(sensors.probes[0].offsets[1]) - var.SafeZone)
                                  	set var.m557MaxY = global.maxProbeY
                                  
                                  echo "Probing grid - X" ^ var.m557MinX ^ ":" ^ var.m557MaxX ^ " Y" ^ var.m557MinY ^ ":" ^ var.m557MaxY
                                  
                                  var MinProbesX = floor((var.m557MaxX - var.m557MinX) / var.MaxSpace)
                                  ;echo "Min Probes X is " ^ var.MinProbesX
                                  
                                  var MaxProbesX = floor((var.m557MaxX - var.m557MinX) / var.MinSpace)
                                  ;echo "Max Probes X is " ^ var.MaxProbesX
                                  
                                  set var.ProbeNumX = min(var.MaxProbePoints,var.MaxProbesX)
                                  
                                  var MinProbesY = floor((var.m557MaxY - var.m557MinY) / var.MaxSpace)
                                  ;echo "Min Probes Y is " ^ var.MinProbesY
                                  
                                  var MaxProbesY = floor((var.m557MaxY - var.m557MinY) / var.MinSpace)
                                  ;echo "Max Probes Y is " ^ var.MaxProbesY
                                  
                                  set var.ProbeNumY = min(var.MaxProbePoints,var.MaxProbesY)
                                  
                                  ; sanity check probe points
                                  if var.ProbeNumX<2
                                  	set var.ProbeNumX=2
                                  if var.ProbeNumY<2
                                  	set var.ProbeNumY=2
                                  
                                  if var.ProbeNumX > var.MaxProbePoints
                                  	set var.ProbeNumX = var.MaxProbePoints
                                  
                                  if var.ProbeNumY > var.MaxProbePoints
                                  	set var.ProbeNumY = var.MaxProbePoints
                                  
                                  if (var.ProbeNumX * var.ProbeNumY) > 441
                                  	if var.ProbeNumX > 21
                                  		set var.ProbeNumX = 21
                                  		echo "Too many X points - reduced to 21"
                                  	if var.ProbeNumY > 21
                                  		set var.ProbeNumY = 21
                                  		echo "Too many Y points - reduced to 21"
                                  	
                                  echo "Probing " ^ var.ProbeNumX ^ " points in X direction & " ^ var.ProbeNumY ^ " points in Y direction"
                                  
                                  
                                  ; do probing
                                  set var.ProbeCenterX = (global.maxProbeX - ((global.maxProbeX - global.minProbeX)/2)) ; calculate centre point of probe area
                                  set var.ProbeCenterY = (global.maxProbeY - ((global.maxProbeY - global.minProbeY)/2)) ; calculate centre point of probe area
                                  echo "Setting Z datum point at X" ^ var.ProbeCenterX ^ " Y" ^ var.ProbeCenterY
                                  ; set Z = 0 to centre of probe area
                                  G1 X{var.ProbeCenterX- sensors.probes[0].offsets[0]} Y{var.ProbeCenterY- sensors.probes[0].offsets[1]} Z{sensors.probes[0].diveHeight+2} F3600
                                  G30
                                  echo "Mesh probing"
                                  M557 X{var.m557MinX,var.m557MaxX} Y{var.m557MinY,var.m557MaxY} P{var.ProbeNumX,var.ProbeNumY}
                                  if result != 0
                                  	abort "ERROR: could not create mesh" 
                                  else
                                  	G29 S0
                                  	if result != 0
                                  		abort "ERROR: Mesh probing failed"
                                  	else
                                  		echo "Mesh probing successful.   Loading mesh.."
                                  
                                  ; set Z = 0 to centre of probe area
                                  echo "Reset Z datum in mesh centre"
                                  G1 X{var.ProbeCenterX - sensors.probes[0].offsets[0]} Y{var.ProbeCenterY - sensors.probes[0].offsets[1]} Z{sensors.probes[0].diveHeight+2} F3600
                                  G30
                                  
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • OwenDundefined
                                    OwenD
                                    last edited by OwenD

                                    @RatRig0331

                                    While I was thinking about how to make these macros "universal" to suit all sorts of configurations, it occurred to me that they had, over time, grown ever more complicated with little benefit.
                                    Bed sizes and the probe positions don't tend to change after all.

                                    I have therefore decided to simplify things.

                                    I still call "setDefaultProbePoints.g" from config.g and anywhere else I might want to set the mesh for the entire bed.
                                    Rather than me trying to calculate the area that can be probed, you just enter your M557 just as you would normally do in config.g

                                    ;setDefaultProbePoints.g
                                    M557 X10:470 Y10:470 P6 ; set values as you would normally do in config.g
                                    

                                    In superslicer, rather than call G29, I call mesh.g using M98, but pass the parameters for the min/max print values and the distance between probe points
                                    A=xMin of print area
                                    B=xMax of print area
                                    C=yMin of print area
                                    D=yMax of print area
                                    N=distance between probe points (equivalent to S parameter in M557)

                                    M98 P"0:/sys/mesh.g" A{first_layer_print_min[0]} B{first_layer_print_max[0]} C{first_layer_print_min[1]} D{first_layer_print_max[1]} N30 ; set N to your desired distance between points
                                    G29 S1 ; load small mesh
                                    

                                    In mesh.g I check if all those parameters have been passed.
                                    If they have, I do the small mesh.
                                    If they haven't I reload the defaults and probe the full bed.
                                    Therefore if you send G29 or select mesh probing in DWC it will do the entire bed even if you forget to reset the defaults.

                                    ;mesh.g
                                    M98 P"setDefaultProbePoints.g"
                                    if (exists(param.A) && exists(param.B) && exists(param.C) && exists(param.D) && exists(param.N))
                                    	M557 X{max(move.compensation.probeGrid.mins[0],param.A),min(move.compensation.probeGrid.maxs[0],param.B)} Y{max(move.compensation.probeGrid.mins[1],param.C),min(move.compensation.probeGrid.maxs[1] ,param.D)} S{param.N}
                                    	if result != 0
                                    		abort "Invalid M557 parameters"
                                    
                                    G29 S0
                                    

                                    If you wanted to set the number of probe points rather than the distance between them just change S{param.N} to P{param.N} in the M557 line in mesh.g

                                    1 Reply Last reply Reply Quote 2
                                    • oozeBotundefined
                                      oozeBot
                                      last edited by

                                      This might be useful: https://forum.duet3d.com/topic/29647/you-down-with-opp-oozebot-post-processor

                                      1 Reply Last reply Reply Quote 0
                                      • dc42undefined
                                        dc42 administrators @OwenD
                                        last edited by

                                        @owend said in Only probe where the part will be printed:

                                        @dc42
                                        Roger that..
                                        That makes that section of code superfluous.
                                        Does it turn off the bed heater as well?

                                        Yes, it turns all heaters off. In the past it's been the bed heater that causes most of the problems for Z probes, however I suspect that with Revo and similar hot ends the hot end heater might affect Z probes too because of the higher magnetic field they are likely to produce.

                                        Duet WiFi hardware designer and firmware engineer
                                        Please do not ask me for Duet support via PM or email, use the forum
                                        http://www.escher3d.com, https://miscsolutions.wordpress.com

                                        1 Reply Last reply Reply Quote 0
                                        • RatRig0331undefined
                                          RatRig0331 @OwenD
                                          last edited by

                                          @owend I’m getting some mix results with the bed mesh either works out great or works out horrible with driving my nozzle right into the bed I don’t know is doing a 3 point axis bed level is messing with the bed mesh or the last z offset probe touch

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

                                            @ratrig0331
                                            There's nothing in the code which can cause intermittent faults such as that you describe.
                                            The problem is either wiring related, electrical interference , or a faulty BlTouch.
                                            You can check if the BlTouch is in an error state or already deployed using the object model, but this only serves to allow you to cancel the process.
                                            You need to find the root cause.
                                            You need to provide details of what is happening exactly. What lights are on the BlTouch. What messages appear in DWC
                                            It's probably better to start a new thread.

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