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.22k stars 19.22k forks source link

[BUG] Incorrect total count when probing for leveling #17770

Closed jan-gerard closed 4 years ago

jan-gerard commented 4 years ago

Bug Description

When probing less than the maximum number of points for bed leveling, (e.g. G29 P3, while I have defined #define GRID_MAX_POINTS_X 5), the display says still Probing Point 1/25, while it should say Probing Point 1/9.

My Configurations

#define MULTIPLE_PROBING 3
//#define EXTRA_PROBING    1
#define AUTO_BED_LEVELING_LINEAR
#define GRID_MAX_POINTS_X 5
#define GRID_MAX_POINTS_Y GRID_MAX_POINTS_X

Steps to Reproduce

  1. Set #define GRID_MAX_POINTS_X 5 in Configuration.h
  2. Compile and upload firmware.
  3. Level bed with G29 P2.

Expected behavior: Probing Point 1/4 ... Probing Point 2/4 ... Probing Point 3/4 ... Probing Point 4/4 ... done.

Actual behavior: Probing Point 1/25 ... Probing Point 2/25 ... Probing Point 3/25 ... Probing Point 4/25 ... done.

Additional Information

I think that line 702 in G29.cpp should be changed from ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), int(pt_index), int(GRID_MAX_POINTS)); to ui.status_printf_P(0, PSTR(S_FMT " %i/%i"), GET_TEXT(MSG_PROBING_MESH), int(pt_index), int(abl_points));

jan-gerard commented 4 years ago

...and line 700 into if (verbose_level) SERIAL_ECHOLNPAIR("Probing mesh point ", int(pt_index), "/", int(abl_points), ".");

jan-gerard commented 4 years ago

I tested this change, and now it works perfectly.

boelle commented 4 years ago

maybe submit a PR with the fix?

sjasonsmith commented 4 years ago

@jan-gerard can you attach your configuration files, as required by the issue template? Ideally these would be updated to work with the bugfix-2.0.x branch.

There isn't enough information in your description for somebody to easily reproduce this. For example, it does not indicate which bed leveling mechanism you are using. Providing your configuration files will ensure that anybody looking at this is configured exactly the same way you are.

thinkyhead commented 4 years ago

Thanks for the patch! It was a cinch to locate and to apply, and makes it in just under the wire for 2.0.6….

Masanetz commented 4 years ago

This patch seems to break compiling with AUTO_BED_LEVELING_BILINEAR, as abl_points nether declared nor has it a value... Maybe the comment in line 248 of G29.cpp is somewhat misleading:

elif ENABLED(PROBE_MANUALLY) // Bilinear

In file included from Marlin/src/gcode/bedlevel/abl/../../../inc/MarlinConfig.h:47:0, from Marlin/src/gcode/bedlevel/abl/G29.cpp:27: Marlin/src/gcode/bedlevel/abl/G29.cpp: In static member function 'static void GcodeSuite::G29()': Marlin/src/gcode/bedlevel/abl/G29.cpp:646:91: error: 'abl_points' was not declared in this scope if (verbose_level) SERIAL_ECHOLNPAIR("Probing mesh point ", int(pt_index), "/", abl_points, "."); ^ Marlin/src/gcode/bedlevel/abl/../../../inc/../core/serial.h:111:57: note: in definition of macro '_SEP_2'

define _SEP_2(PRE,V) serial_echopair_PGM(PSTR(PRE),V)

^ Marlin/src/gcode/bedlevel/abl/../../../inc/../core/serial.h:174:45: note: in expansion of macro '_SELP_3'

define _SELP_5(a,b,V...) do{ _SEP_2(a,b); _SELP_3(V); }while(0)

^~~ Marlin/src/gcode/bedlevel/abl/../../../inc/../core/serial.h:168:28: note: in expansion of macro '_SELP_5'

define __SELP_N(N,V...) SELP##N(V)

^~ Marlin/src/gcode/bedlevel/abl/../../../inc/../core/serial.h:169:28: note: in expansion of macro '__SELP_N'

define _SELP_N(N,V...) __SELP_N(N,V)

^~~~ Marlin/src/gcode/bedlevel/abl/../../../inc/../core/serial.h:201:33: note: in expansion of macro '_SELP_N'

define SERIAL_ECHOLNPAIR(V...) _SELP_N(NUM_ARGS(V),V)

^~~ Marlin/src/gcode/bedlevel/abl/G29.cpp:646:30: note: in expansion of macro 'SERIAL_ECHOLNPAIR' if (verbose_level) SERIAL_ECHOLNPAIR("Probing mesh point ", int(pt_index), "/", abl_points, "."); ^~~~~ Marlin/src/gcode/bedlevel/abl/G29.cpp:646:91: note: suggested alternative: 'abc_pos_t' if (verbose_level) SERIAL_ECHOLNPAIR("Probing mesh point ", int(pt_index), "/", abl_points, "."); ^ Marlin/src/gcode/bedlevel/abl/../../../inc/../core/serial.h:111:57: note: in definition of macro '_SEP_2'

define _SEP_2(PRE,V) serial_echopair_PGM(PSTR(PRE),V)

^ Marlin/src/gcode/bedlevel/abl/../../../inc/../core/serial.h:174:45: note: in expansion of macro '_SELP_3'

define _SELP_5(a,b,V...) do{ _SEP_2(a,b); _SELP_3(V); }while(0)

^~~ Marlin/src/gcode/bedlevel/abl/../../../inc/../core/serial.h:168:28: note: in expansion of macro '_SELP_5'

define __SELP_N(N,V...) SELP##N(V)

^~ Marlin/src/gcode/bedlevel/abl/../../../inc/../core/serial.h:169:28: note: in expansion of macro '__SELP_N'

define _SELP_N(N,V...) __SELP_N(N,V)

^~~~ Marlin/src/gcode/bedlevel/abl/../../../inc/../core/serial.h:201:33: note: in expansion of macro '_SELP_N'

define SERIAL_ECHOLNPAIR(V...) _SELP_N(NUM_ARGS(V),V)

^~~ Marlin/src/gcode/bedlevel/abl/G29.cpp:646:30: note: in expansion of macro 'SERIAL_ECHOLNPAIR' if (verbose_level) SERIAL_ECHOLNPAIR("Probing mesh point ", int(pt_index), "/", abl_points, "."); ^~~~~ *** [.pio/build/chitu_v5_gpio_init/src/src/gcode/bedlevel/abl/G29.cpp.o] Error 1

sjasonsmith commented 4 years ago

Re-opening, since the "fix" for this broke builds.

GhostlyCrowd commented 4 years ago

Curious, i just did a fresh pull on latest bugfix enabled ABL Biliniar, and the bare minimum to get it to not throw errors (Z safe home and bltouch) on mega2060 and it compiles fine.

What platforms are failing and whats the confing files can you post them?

qwewer0 commented 4 years ago

On the latest bugfix, it throws error for me and for -MoneyMike- too.

'abl_points' was not declared in this scope

Edit: SKR Mini E3 v1.2 and v2.0

GhostlyCrowd commented 4 years ago

On the latest bugfix, it throws error for me and for -MoneyMike- too.

'abl_points' was not declared in this scope

Edit: SKR Mini E3 v1.2 and v2.0

What are you using to compile VS code or Arduino IDE?

qwewer0 commented 4 years ago

I use VSCode

sjasonsmith commented 4 years ago

@jan-gerard I believe this issue has been fixed. Can you re-test using bugfix-2.0.x and verify whether any issue remains?

qwewer0 commented 4 years ago

@sjasonsmith It has been fixed for me.

github-actions[bot] commented 4 years 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.