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.14k stars 19.2k forks source link

3-points auto bed leveling issue - invalid conversion from 'int' to 'ProbeAction' #1629

Closed Maik93 closed 9 years ago

Maik93 commented 9 years ago

Hi, I've found out an issue while setting up Z probing in 3-points mode:

Marlin_main.cpp: In function 'void gcode_G29()': Marlin_main.cpp:2844: error: invalid conversion from 'int' to 'ProbeAction' Marlin_main.cpp:2844: error: initializing argument 4 of 'float probe_pt(float, float, float, ProbeAction, int)' Marlin_main.cpp:2845: error: invalid conversion from 'int' to 'ProbeAction' Marlin_main.cpp:2845: error: initializing argument 4 of 'float probe_pt(float, float, float, ProbeAction, int)' Marlin_main.cpp:2846: error: invalid conversion from 'int' to 'ProbeAction' Marlin_main.cpp:2846: error: initializing argument 4 of 'float probe_pt(float, float, float, ProbeAction, int)'

I've momentary bypassed it as follows: if (1){ //if(enhanced_g29) { z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, ProbeEngage, verbose_level); z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, Probeverbose_level); z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, ProbeRetverbose_level); } /_else { z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, verbose_level); z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level); z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verboselevel); }/

avluis commented 9 years ago

I can reproduce this if I have ENABLE_AUTO_BED_LEVELING defined and AUTO_BED_LEVELING_GRID disabled.

I do not have any grid points to add for manual probing points, so I used defaults - but it does demonstrate that the function void gcode_G29() needs to handle this if not using the grid method for ABL.

Arduino: 1.6.1 (Mac OS X), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

[non-error verbose redacted]

/var/folders/by/j72slykd6nlfsn8h922xbm2r0000gn/T/build9086982035705764180.tmp/Marlin_main.cpp:1988:8: error: #error "The given ABL_PROBE_PT_1_X can't be reached by the probe."

error "The given ABL_PROBE_PT_1_X can't be reached by the probe."

    ^

/var/folders/by/j72slykd6nlfsn8h922xbm2r0000gn/T/build9086982035705764180.tmp/Marlin_main.cpp: In function 'void gcode_G29()': /var/folders/by/j72slykd6nlfsn8h922xbm2r0000gn/T/build9086982035705764180.tmp/Marlin_main.cpp:2333:103: error: invalid conversion from 'int' to 'ProbeAction' [-fpermissive] z_at_pt_1 = probe_pt(ABL_PROBE_PT_1_X, ABL_PROBE_PT_1_Y, Z_RAISE_BEFORE_PROBING, verbose_level); ^ /var/folders/by/j72slykd6nlfsn8h922xbm2r0000gn/T/build9086982035705764180.tmp/Marlin_main.cpp:1369:14: error: initializing argument 4 of 'float probe_pt(float, float, float, ProbeAction, int)' [-fpermissive] static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageRetract, int verbose_level=1) { ^ /var/folders/by/j72slykd6nlfsn8h922xbm2r0000gn/T/build9086982035705764180.tmp/Marlin_main.cpp:2334:132: error: invalid conversion from 'int' to 'ProbeAction' [-fpermissive] z_at_pt_2 = probe_pt(ABL_PROBE_PT_2_X, ABL_PROBE_PT_2_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level); ^ /var/folders/by/j72slykd6nlfsn8h922xbm2r0000gn/T/build9086982035705764180.tmp/Marlin_main.cpp:1369:14: error: initializing argument 4 of 'float probe_pt(float, float, float, ProbeAction, int)' [-fpermissive] static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageRetract, int verbose_level=1) { ^ /var/folders/by/j72slykd6nlfsn8h922xbm2r0000gn/T/build9086982035705764180.tmp/Marlin_main.cpp:2335:132: error: invalid conversion from 'int' to 'ProbeAction' [-fpermissive] z_at_pt_3 = probe_pt(ABL_PROBE_PT_3_X, ABL_PROBE_PT_3_Y, current_position[Z_AXIS] + Z_RAISE_BETWEEN_PROBINGS, verbose_level); ^ /var/folders/by/j72slykd6nlfsn8h922xbm2r0000gn/T/build9086982035705764180.tmp/Marlin_main.cpp:1369:14: error: initializing argument 4 of 'float probe_pt(float, float, float, ProbeAction, int)' [-fpermissive] static float probe_pt(float x, float y, float z_before, ProbeAction retract_action=ProbeEngageRetract, int verbose_level=1) { ^ Error compiling.

Wurstnase commented 9 years ago

retract_action and verbose_level are optional parameters and should be named when used unordered. I have fixed it already, Just need to merge it.

boelle commented 9 years ago

looking forwared to the PR

plese mention this issue in the PR

Roxy-3D commented 9 years ago

Is there a reason to have the 3 point leveling? It would seem doing a grid with a 2 x 2 size is pretty close to the 3 point leveling but without all the problems (inaccuracies) in the unprobed corner? If the goal is to simplify the code and configuration of the code, it would seem the 3 point leveling should be pulled???

boelle commented 9 years ago

you only need 3 points as all what is done is correcting the plane

adding more points will just be a waste

Wurstnase commented 9 years ago

Grid leveling is the one point in Marlin which makes it unique.

And again, we dont life in a perfect world. So using least squares methode is much more accurate.

boelle commented 9 years ago

hmm... grid leveling or ore probe points does not matter

people tend to think that the more points the better, marlin does not compensate for a bend plate,

it only compensates for at "tilted" plate...... and for that 3 points will do it

Wurstnase commented 9 years ago

It doesn't compensate, but it minimized the error.

A 2D example for that.

blue: measured values green: something like 3point leveling red: least square methode

Least squares: y = 0.96_x + 1.16 2-Point: y = 0.9667_x + 1.1

mdkq

Wurstnase commented 9 years ago

Btw. this issue should be solved with #1630

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