Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corner bed leveling 3 point leveling #20733

Merged

Conversation

RFBomb
Copy link
Contributor

@RFBomb RFBomb commented Jan 10, 2021

Description

Benefits

I recently purchased the Gulf Coast 3-Point bed leveling kit, and realized that Marlin didn't have a way to take advtantage of it. The problem was that Marlin defaults to Front Left, Front RIght, Rear Right, Rear Left. The adjustment knobs for this kit are in the Front Left, Rear Left, and the Center Right.

This update will allow users to define the probing order, and will also allow enabling 3-point leveling if they want it. If they enable 3-point leveling, then the Corner_Bed_leveling will only perform the first 2 corners, then it determines the opposite edge and moves there. This edge will respect whatever offsets would normally be used for the standard 4-corner probe. (So right edge will use rb.x + y_center)

Configurations

configuration.h edits:

  • Enable #define LEVEL_BED_CORNERS
  • Enable #define LEVEL_CORNERS_3_POINTS if you want to try out the 3-point leveling
  • mess with LEVEL_CORNERS_LEVELING_ORDER if you want to change the order. A description comment explaining it is provided.
  • Note that I didn't currently error check, so if they put a number less than 0 or greater than 4 into the array, it will likely ignore that corner altogether.

Picture!

As you can see, some additional text has been added to the 'Probing' screen so that there is feedback to the user as to the last probe measurement, as well as the # of points probed within tolerance.

ACCC7C32-B168-4F9D-AA91-88FF819E8020

Related Issues

[After testing, my concerns here are gone. I had only written them out prior to learning how this code actually functions.]

RFBomb added 4 commits January 9, 2021 23:19
This added 3-point leveling to the Corner Bed Leveling LCD menu option. This also adds the ability to customize the probing order if you want to change that up as well.
@RFBomb
Copy link
Contributor Author

RFBomb commented Jan 10, 2021

removed original comment that was here since it didn't really add anything, and because I resolved my questions.

Current iteration has been tested by myself with the 3-point leveling, 4 point leveling, with and without probe, with and without center_too as well. Everything appears to be functioning pretty good.

My code for displaying I did have some issues with though. I based the logic off the BABYSTEP_DISPLAY_TOTAL lcd drawing stuff inside of \Marlin\src\lcd\menu\menu_tune.cpp (Lines 67 - 80 ). But I couldn't get my stuff to display on my ender3's stock display until I inverted the in_view bool. Its working great for me right now, but I don't know how this might affect other displays.

I was able to change the probing screen so that it will now show the last Z measurement, as well as the the # of good points found. This way if it is constantly resetting, the user has some feedback. (It had entered an infinite loop for me once due to an uneven bed, and there was no feedback when it reset the count)
@thinkyhead
Copy link
Member

Have you tried ASSISTED_TRAMMING_MENU_ITEM? It supports three points and is helpful about the adjustment. The only thing is that it only reports to the host and not to the display. That would be a good thing to extend and unify in the implementation of an LCD-based wizard, since it already handles important details like homing beforehand, setting the correct workspace plane, disabling extruder duplication, and so on.

@RFBomb
Copy link
Contributor Author

RFBomb commented Jan 11, 2021

Similar to wmariz mentioned in github.com//pull/20241, I felt like the corner bed leveling was a bit more intuitive, especially with the LCD feedback since my printer was not hooked up to a host at the time.

That, and when it is hooked up to a host (octoprint), the only way I have to read the response would be walking across the room. So it would be walk, adjust, walk, read, repeat. And that is just obnoxious, whereas corner bed leveling currently puts the feedback directly onto the screen and gets it close enough. Since I have an LCD, I would rather have the feedback directly on the LCD. Thats why I chose to modify the corner bed leveling instead with the 3-point leveling.

Adding in the ability to decide the leveling order was required to get 3-point leveling to work, but I think that other users might find it useful for the 4-point leveling. And it didn't add much to the compile size compared to the previous hardcoded method of picking corners.

I do agree that having it be unified would likely be better overall, maintenance-wise. But tramming would need to be able to work off an LCD for me to go to it. Prior to my modifications, corner bed leveling is also handling homing before hand, and disabling any leveling meshes (as far as I can tell), but disabling extruder duplication I do not believe is currently setup.

@thinkyhead
Copy link
Member

Note that with this added feature, there is currently no way to set the actual screw locations, if that was desired. But approximate locations should be good enough.

@RFBomb
Copy link
Contributor Author

RFBomb commented Jan 11, 2021

Yea, I had looked at assisted tramming, and having it calculate the number of turns recommended is a pretty nice feature. If someone were to create an option that it reports that to the screen, I might one day switch to that, but currently, getting it close enough is good enough for me.

With the additions that wmariz put through for using a probe, this already checks if it is within a specified tolerance. Coupled with my addition of displaying the last registered Z, it should provide a user with enough feedback to get it quite level. And if they are using a probe, they are likely also doing some sort of mesh as well, which will take care of it too.

@qwewer0
Copy link
Contributor

qwewer0 commented Jan 11, 2021

How about ASSISTED_TRAMMING_WIZARD? It only work with an LCD.

@thinkyhead
Copy link
Member

Right… that's what I was actually looking for. How does that compare with this extension of "old-school corner leveling"?

@RFBomb
Copy link
Contributor Author

RFBomb commented Jan 11, 2021 via email

@qwewer0
Copy link
Contributor

qwewer0 commented Jan 11, 2021

ASSISTED_TRAMMING_WIZARD will add a Tramming Wizard menu item under Motion. By selectin it, the printer will home, then show all the defined points (3-6) as a list on the screen, after selecting one of the point we can select Measure to measure that specific point, the result of which can be seen on the screen.

At the moment it only allows to measure one at a time and there is no way to do a full sweep like it is with G35.

@RFBomb
Copy link
Contributor Author

RFBomb commented Jan 12, 2021

Just tried out Assisted_Tramming, and I have some feedback for it, as I noticed some issues:

  • You scroll down to select your desired probing point, after which is gives you the option to either measure or select done. If you want to allow it to do a full sweep, what I would add to that scroll menu is an option for 'Next Position', at which point it will select the next option in the list. I would put the 'Next Position' ABOVE the 'Done' command if this is the solution you go for.

  • Alternate option here would be to run the entire routine, then simply print out the name of each option with 'CW 1F 25M' or other measurements onto a scrollable submenu page.

  • The LCD menu quits prematurely 100% of the time for me, across multiple compiles. Steps to reproduce:
    - Probe any selected point as many times as you want via the LCD
    - Click 'DONE' on first point.
    - Select any second point.
    - Select 'MEASURE'
    - Printer will probe selected location, move to the ASSISTED_TRAMMING_WAIT_POSITION, then abruptly return to the main screen. Sometimes there will be a screen refresh updating the Last Value on the screen, sometimes not. But always returns to the main screen.

  • The "Last Value" does not consistently update on the LCD when triggered from the lcd menu.
    - It will report some value (unsure where that initial measurement is taken from.)
    - Option 1 always shows 0.00. Never updates this value no matter how much you move the knob. (Are all adjustments in relation to the first probing point If so, shouldn't this always be bed center?)
    - Options 2+ appear to show the last measured value. This holds true between multiple menu attempts and multiple power cycles. Unsure where this initial value is coming from, maybe my last UBL mesh? (If its from the mesh, shouldn't it be ignored, since the whole point of this is to level the bed prior to building a mesh?)
    - Options 2+ DOES update the Last Value on the screen properly. It will update it every measurement you do. But I don't understand how its getting the number. For example, it had showed -1.12 after the first measurement. So I moved it CCW to raise the bed. The next measurement showed -1.70. That is confusing, since I raised the bed and the number got lower. I would expect that a negative number means its X distance below 0, so it needs to raise up.

  • The G35 issued via pronterface appeared to work fairly well.

Here are my probe offsets. Note that I had added in the defines for X and Y in order to allow some math in various locations in my custom config, such as below

#define ProbeOffset_X -55.0 //Being used for determining the MESH_MAX_XY values in Configuration_adv.h
#define ProbeOffset_Y -12.0
#define NOZZLE_TO_PROBE_OFFSET { ProbeOffset_X, ProbeOffset_Y, -1.75 }

Here is my Assisted_Tramming setup:


#define ASSISTED_TRAMMING
#if ENABLED(ASSISTED_TRAMMING)

  // Define positions for probing points, use the hotend as reference not the sensor.
  #define TramX_Max  X_BED_SIZE - abs(ProbeOffset_X) -5
  #define TramY_Max  Y_BED_SIZE - abs(ProbeOffset_Y) -15
  #define TRAMMING_POINT_XY { {  15, 15 }, { 15,  TramY_Max }, { TramX_Max , Y_CENTER }}

  // Define position names for probe points.
  #define TRAMMING_POINT_NAME_1 "Front-Left"
  #define TRAMMING_POINT_NAME_2 "Back-Left"
  #define TRAMMING_POINT_NAME_3 "Center-Right"
//  #define TRAMMING_POINT_NAME_4 "Back-Left"

  #define RESTORE_LEVELING_AFTER_G35    // Enable to restore leveling setup after operation
  #define REPORT_TRAMMING_MM          // Report Z deviation (mm) for each point relative to the first

  #define ASSISTED_TRAMMING_WIZARD    // Make the menu item open a Tramming Wizard sub-menu
  #define ASSISTED_TRAMMING_WAIT_POSITION { X_CENTER, Y_BED_SIZE, 15 } // Move the nozzle out of the way for adjustment

  /**
   * Screw thread:
   *   M3: 30 = Clockwise, 31 = Counter-Clockwise
   *   M4: 40 = Clockwise, 41 = Counter-Clockwise
   *   M5: 50 = Clockwise, 51 = Counter-Clockwise
   */
  #define TRAMMING_SCREW_THREAD 30

#endif

Result from the G35 command reported to PronterFace:

Turn Back-Left CCW by 2 turns and 37 minutes (1.31mm)
Turn Center-Right CCW by 1 turns and 31 minutes (0.76mm)

Due to the issues with the LCD menu, I think the corner bed leveling is currently a better option, but this has a lot of potential shoudl those be resolved and clarified. Issuing a G35 command if you have a host, this works fantastic though.

edit: Also, I tested with the latest bugfix.

thinkyhead and others added 5 commits January 11, 2021 19:43
- Corrected the IF statements that result in choosing the front center / rear center 3rd points.
-Added several defines options(commented out) for quick testing compiling.
- Reworded configuration.h tooltip since having 3/4 points defined ignored the 3rd point altogether and instead used only the first 2 points to calculate 3-point leveling.
thinkyhead added a commit to MarlinFirmware/Configurations that referenced this pull request Jan 16, 2021
@thinkyhead
Copy link
Member

Thanks for the Assisted Tramming review. We'll have to get those issues fixed asap. Meanwhile, this PR is looking about ready….

@thinkyhead thinkyhead merged commit 43a91e5 into MarlinFirmware:bugfix-2.0.x Jan 16, 2021
kpishere pushed a commit to kpishere/Marlin that referenced this pull request Feb 19, 2021
zillarob pushed a commit to zillarob/Marlin that referenced this pull request Feb 25, 2021
W4tel-BiDi pushed a commit to W4tel-BiDi/Marlin that referenced this pull request Apr 5, 2021
thinkyhead pushed a commit to thinkyhead/Marlin that referenced this pull request Apr 29, 2021
@RFBomb RFBomb deleted the CornerBedLeveling_3-Point-Leveling branch April 10, 2022 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants