The printing process with auto leveling

Hey there,

I have added a auto leveling sensor to my 3d printer.

I'm controlling my printer via an OctoPi.

All is doing well, I can do auto leveling, I see in the output of the leveling in Octoprint.
I can see it in the connection log.
But how flows the data from the auto leveling in the print process?

The GCode file is directly steering the printer, so there is no part of
software that is knowing from the data !?

(If the question is to low level, sorry for that. Every video and information what I can find in the web gives me the how do you setup, how to you install the sensor and and and but not the process...)

thanks in advance

I can't say that I'm an expert in this since I don't work on the Marlin firmware but I'm going to make an educated guess.

  • When you run something like a G29 the firmware takes the printer for a walk around the bed and either a probe or an IR sensor then makes measurements
  • The firmware holds these in a two-dimensional array
  • When the autolevel routine is finished the firmware stores this collections of points (which is often called a mesh in 3D lingo)
    • I would guess that the numbers stored are positive and negative offsets from what the firmware believes is the agreed-upon "zero" for the Z axis
  • Later, when the print job is running, standard gcode movement commands are then referenced against this mesh. I would imagine that interpolation is done so that any command then might be accurately adjusted anywhere within this collection of mesh points.
    • OctoPrint might send G1 X20.04 Y100.2 Z1.3
    • Marlin receives this and then calculates what the adjustment should be based upon the X/Y values and then adds the adjustment to that Z1.3 part of the command