MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.24k stars 19.22k forks source link

[BUG] G26 with SEGMENT_LEVELED_MOVES disabled with UBL has out of bound moves. #26816

Closed ellensp closed 7 months ago

ellensp commented 8 months ago

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

G26 with SEGMENT_LEVELED_MOVES disabled using UBL results in very long out of bounds moves in X and Y This issue happens on real hardware and simulated

Eg a 200x200 bed, X and Y moves to around 5000mm!

bad move

Bug Timeline

Unknown

Expected behavior

G26 should print a test pattern on the bed

Actual behavior

G26 Starts to print the test pattern then X and Y pull a buzz light year, (to infinity and beyond)

Steps to Reproduce

  1. Build provided minimal configuration files for the Simulator
  2. Send a G28
  3. Send a G26
  4. Watch as the simulated G26 draws 3 circles and two lines, then X and Y move to 5000mm

Version of Marlin Firmware

Bugfix-2.1.x

Printer model

Simulated

Electronics

Simulatoed

LCD/Controller

REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER

Other add-ons

FIX_MOUNTED_PROBE

Bed Leveling

UBL Bilinear mesh

Additional information & file uploads

Configuration.zip May be related to

  • https://github.com/MarlinFirmware/Marlin/issues/26718
  • ellensp commented 7 months ago

    After digging around the code for a few days adding copious debugging statements Iv found the bug.

    In Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp

    while (cnt) {

    This loop never finishes and causes variable to roll over

    the variable cnt is of type xy_uint8_t, ie is has a x and a y component

    If I change it to

    while (cnt.x || cnt.y) {

    The while loop completes and G26 finishes as expected and the out of bounds move is eradicated.

    I found this was modified in https://github.com/MarlinFirmware/Marlin/pull/15204/files#diff-7324a55a5383deb69d8d9506f87fe29a9046235946fcf89373d774af6144d1e7

    github-actions[bot] commented 5 months ago

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.