Welcome! Log In Create A New Profile

Advanced

Programatically defining and setting a bed leveling mesh

Posted by odlumb1492 
Programatically defining and setting a bed leveling mesh
November 02, 2018 06:20AM
I am using the latest Marlin firmware (1.1.9). Bed leveling isn't working. I've wasted weeks trying to get it to work. So now I'm changing my tactic.

I have printed some parts which allow me to attach a digital micrometer to the effector of my printer. Additionally I have written a program which samples the bed plate at 81 points (of my own choosing). So now I have very precise XYZ data for 81 points (X & Y coordinates were selected by me, not the Marlin firmware). The experiment revealed some very interesting info, but that's not the point of this topic.

I can find GCODE which allows modifying the Z data of an existing mesh point. But I want to go beyond that and redefine the X & Y of the mesh points, essentially redefining a completely new 81 point mesh and loading it into the firmware programatically.

Question #1: Is this possible using only Marlin GCODE? I cannot find any way to do it.

Question #2: Assuming the answer to question #1 is NO, I'm willing to customize the Marlin firmware to get the job done. Personally, I find the firmware code to be almost incomprehensible - so little documentation, and such an arcane style of programming. Nevertheless, I have been successful in the past adding a few additional custom commands to the GCODE library. But after hours searching for the code which defines the X & Y coordinates of the bed leveling mesh, I am still clueless. Define the number of points? Easy, configuration.h. But where in the code are the actual X & Y coordinates of the mesh determined? I'm using BILINEAR.

Any help with this would be greatly appreciated. My goal is to create a GCODE command which accepts XYZ data (to be called 81 times in a loop) which completely replaces the existing mesh in the firmware, redefining all three axes for each point. Thanks in advance.
Re: Programatically defining and setting a bed leveling mesh
November 06, 2018 07:17PM
The mesh point locations are calculated by Marlin. They are based on the bed size, specified inset, and the number of points in the mesh. They are spaced equally from each other. You don't get to move the mesh point locations other than by shifting the bed size, number of points and inset.

Which bed leveling system are you using?

In general... You should probe the bed. And then print a G26 mesh validation pattern to see how well the mesh represents the topography of the bed. Have you done that?
Sorry, only registered users may post in this forum.

Click here to login