G29 Mesh Level: Pass / Fail Tolerance
-
I think it would be very useful to add a parameter to the G29 command which allows a maximum threshold for either:
- Maximum deviations
- Mean error
- RMS error
Once you have characterized your bed, you could add some threshold above these deviations that you are comfortable with / seem realistic. If the G29 returns values that exceed these defined values, it would return a failed result and stop the printer.
I just had an odd case where I got a few errant points that are way out of my expected flatness. This caused the nozzle to drag badly on the bed. A G29 threshold could have prevented this.
-
@CCS86 i do the deviation check in the bed.g G32
;G32 Auto calibration routine for large bed M561 ; clear any bed transform ; If the printer hasn't been homed, home it if !move.axes[0].homed || !move.axes[1].homed || !move.axes[2].homed G28 M98 P"/macros/ProbePickUp" ; probe pick up ; Probe the bed and do auto calibration ;G1 X149.5 Y179.5 Z30 F6000 ; go to just above the first probe point ;G30 P0 X152.5 Y152.5 S-2 G28 Z ;echo sensors.probes[0].lastStopHeight , "REF center probe" while true if iterations = 5 abort "Too many auto calibration attempts" G30 P0 X5 Y5 Z-99999 ; probe starboard bow echo sensors.probes[0].lastStopHeight, "P0" if result != 0 continue G30 P1 X305 Y5 Z-99999 ; probe port bow echo sensors.probes[0].lastStopHeight, "P1" if result != 0 continue ;G30 P2 X305 Y276 Z-99999 ; probe port stern ; echo sensors.probes[0].lastStopHeight, "P2" ;if result != 0 ; continue G30 P2 X152.5 Y276 Z-99999 s3 ; probe port bow echo sensors.probes[0].lastStopHeight, "P3" if result != 0 continue if move.calibration.initial.deviation <= 0.02 break echo "Repeating calibration because deviation is too high (" ^ move.calibration.initial.deviation ^ "mm)" ; end loop echo "Auto calibration successful, deviation", move.calibration.final.deviation ^ "mm" M558 F200 ;G1 F6000 X152.5 Y152.5 ; probe to center bed echo" center probe" ;G30 P0 X152.5 Y152.5 S-2 ;single probe ;echo sensors.probes[0].lastStopHeight G28 Z M98 P"/macros/ProbeDropOff" ; probe drop off M558 F600 G1 Z30 F10000 ; get the head out of the way
and just use the mesh.g file G29 for fine tuning
-
@CCS86
I think that would be valid option, so +1 from me.
You can achieve it using the object model, after you load the mesh.
A macro like this should work.
You'd have to tune to suit what is correct for you, but you'd have to do that with a firmware option as well.;macro to check bed mesh deviation var abortNoMeshLoaded = true ; options true/false - choose whether to abort print if no mesh loaded, or just exit macro var RMSdeviationLimit = 0.05 ; or whatever you want (use positive values) var meanLimit = 0.003 ; or whatever you want (use positive values) if var.RMSdeviationLimit < 0 || var.meanLimit < 0 abort "RTFM - limits set must be positve numbers" if move.compensation.file = null if var.abortNoMeshLoaded = true abort "No mesh loaded. Print cancelled" else echo "No mesh loaded. Print will have no compensaton applied" M99 echo "checking validity of mesh: " ^ move.compensation.file echo "Mean limit =", var.meanLimit, "RMS limit =", var.RMSdeviationLimit var meshMean = move.compensation.meshDeviation.mean var meshRMS = move.compensation.meshDeviation.deviation echo "Mesh mean =", var.meshMean, "Mesh RMS =", var.meshRMS if abs(var.meshRMS) > var.RMSdeviationLimit ; absolute value used to account for negative values in mesh abort "Mesh RMS deviation limit exceeded. Print aborted" if abs(var.meshMean) > var.meanLimit ; absolute value used to account for negative values in mesh abort "Mesh mean deviation exceeded. Print aborted" echo "Mesh is within limits"
-
Thank you, both of you guys, for sharing your work. Much appreciated!
@OwenD that is a very efficient macro that does exactly what I was looking for. I need to work on my object model knowledge.
-
@OwenD It would be cool, if this check would happen before the old heightmap was overwritten.
Or if bed.g would create a backup of the current heightmap before probing.Forgive me if that is already happening, I don't know for sure what's the latest and greatest
-
@o_lampe said in G29 Mesh Level: Pass / Fail Tolerance:
@OwenD It would be cool, if this check would happen before the old heightmap was overwritten.
That could only be done in the firmware
Or if bed.g would create a backup of the current heightmap before probing.
You could do this by using M374
More likely in mesh.g than bed.gG29 S1 ; load heightmap M374 P"heightmap.bak" ; create backup ;do rest of probing
-
-
@o_lampe said in G29 Mesh Level: Pass / Fail Tolerance:
@OwenD It would be cool, if this check would happen before the old heightmap was overwritten.
Or if bed.g would create a backup of the current heightmap before probing.Forgive me if that is already happening, I don't know for sure what's the latest and greatest
I think this is a good reason to implement in the firmware vs the macro approach.
-
With flash space so tight on the older boards new features would have to be pretty unique. When something can be achieved with conditional gcode and a macro instead that's a pretty tough sell.
-
@Phaedrux The code to backup a file before editing is already implemented for config.g. It's probably not a big step to implement it for other files, too?
I've manually backup'd the heightmap a few times. Not a big deal either. -
@o_lampe I'll bring it up.