MarlinFirmware / MarlinDocumentation

Marlin Firmware Documentation Project
https://marlinfw.org
GNU General Public License v3.0
369 stars 779 forks source link

Where to put documentation on how to use G26 to physically level the bed? #158

Closed ManuelMcLure closed 5 years ago

ManuelMcLure commented 6 years ago

I want to write a documentation section on how to use G26 to help physically level the bed by moving to each of the four corners and running a partial G26 (producing a 2x2 subgrid) at each corner, for example:

G26 D X0 Y0 R4 B65 H205 L0.2 O3
G26 D X220 Y0 R4 B65 H205 L0.2 O3
G26 D X220 Y220 R4 B65 H205 L0.2 O3
G26 D X0 Y220R4 B65 H205 L0.2 O3

My first thought was to add this to the UBL doc, but this really applies to any of the leveling methods that can enable G26_MESH_VALIDATION so I'm not sure where the best place to put it is. Any suggestions?

On a different note, I was thinking of possibly adding an option to G26 that would automate generating this pattern. I'm trying to figure out which letter would be the best for this option - it looks like E I M N T V W Z are still available. Do you think this would be a good addition to G26, and which letter would be the best? Unfortunately P for physical and C for corner are already used. Maybe T for tramming would work.

Roxy-3D commented 6 years ago

You can remove the U option (and its code) and use that for 'Unlevel Beds'.

ManuelMcLure commented 6 years ago

You can remove the U option (and its code) and use that for 'Unlevel Beds'.

That works. Now to get my head around the G26 code and see how to implement this.

Roxy-3D commented 6 years ago

And if you feel like it... You can change the 'circles' to use the G2 Arc command instead of being simulated with 12 line segments... That should make the 'circles' draw smoother, and it also will cut out a bunch of code (and the sin() cos() tables).

ManuelMcLure commented 6 years ago

I'm working on using the arc command (calling plan_arc()) and am seeing something that concerns me. It looks like plan_arc() is calling planner.buffer_line_kinematic() directly and unless I'm missing something planner.buffer_line_kinematic() does not apply any leveling unless PLANNER_LEVELING is set. PLANNER_LEVELING is defined as

#define UBL_SEGMENTED  (ENABLED(AUTO_BED_LEVELING_UBL) && (ENABLED(DELTA)))
#define ABL_PLANAR     (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_3POINT))
#define ABL_GRID       (ENABLED(AUTO_BED_LEVELING_LINEAR) || ENABLED(AUTO_BED_LEVELING_BILINEAR))
#define OLDSCHOOL_ABL  (ABL_PLANAR || ABL_GRID)
...
#define PLANNER_LEVELING      (OLDSCHOOL_ABL || ENABLED(MESH_BED_LEVELING) || UBL_SEGMENTED || ENABLED(SKEW_CORRECTION))

so as far as I can tell PLANNER_LEVELING is not set if using UBL on a cartesian printer and therefore it looks like leveling is not applied to arc moves. If I'm missing something please let me know.

Roxy-3D commented 6 years ago

Yikes! I think you are correct. It might be we should have a #if ENABLED() for the UBL non-segmented case to send it down the correct path.

THANK YOU for finding this!

ManuelMcLure commented 6 years ago

Do you want me to enter an issue for this? I'm somewhat leery of attempting to fix this myself since I'm just learning the code and I'm not sure exactly what the interactions are involved between different levels and at what level the fix needs to be in.

ManuelMcLure commented 6 years ago

It looks like bezier curves have the same issue.

Roxy-3D commented 6 years ago

Yes, please open an issue. (But in the Marlin/Firmware area... Otherwise it might not get the attention that it needs.)