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.25k stars 19.23k forks source link

strange auto level behaviour... #1769

Closed MoonshineSG closed 9 years ago

MoonshineSG commented 9 years ago

Using the latest codes (as of posting), I have some strange behaviour:

  1. When issuing code M401 the probe deploys without raising Z. M402 (retract) first moves the Z up with 15 then retracts the probe. Shouldn't be the other way, or raise/ensure Z is high enough for both M401 and M402?
  2. After performing a auto leveling (G29 P3 V3 T) the Z is left at an odd difference of around 7.2mm and it basically prints "in the air" ...
  3. During G29 the probe raises more that pre-setup 5 (Z_RAISE_BETWEEN_PROBINGS) between the different points during probing...

Can anyone explain/help? Before doing the latest updates, I was able to print at fairly ok quality, but with very troublesome manual leveling of the bed, so I setup a servo arm to do auto leveling.

Configuration.h: http://pastebin.com/is1bQAcn

lrpirlet commented 9 years ago

ooops It looks like I have a compile error in the added instructions...

In file included from Marlin_main.cpp:30:0:
Marlin_main.cpp: In function 'void stow_z_probe()':
Marlin_main.cpp:1333:59: error: 'Z_RAISE_AFTER_PROBINGS' was not declared in this scope
             SERIAL_ECHOPAIR("Raise Z (after) by ", (float)Z_RAISE_AFTER_PROBINGS);
                                                           ^
Marlin.h:91:71: note: in definition of macro 'SERIAL_ECHOPAIR'
 #define SERIAL_ECHOPAIR(name,value) do{ serial_echopair_P(PSTR(name),(value)); }while(0)
                                                                       ^
Marlin_main.cpp:1335:144: error: 'Z_RAISE_AFTER_PROBINGS' was not declared in this scope
             print_xyz("> SERVO_ENDSTOPS > do_blocking_move_to", current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_AFTER_PROBINGS);
                                                                                                                                                ^
Error compiling.

So, I modified the code to read...
          #ifdef DEBUG_LEVELING
// (float)Z_RAISE_AFTER_PROBINGS gives compile error... so commented next line and modified 1336-1338
//          SERIAL_ECHOPAIR("Raise Z (after) by ", (float)Z_RAISE_AFTER_PROBINGS);
            SERIAL_EOL;
//          print_xyz("> SERVO_ENDSTOPS > do_blocking_move_to", current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + Z_RAISE_AFTER_PROBINGS);
            print_xyz("> SERVO_ENDSTOPS > do_blocking_move_to !WRONG VALUE! ", current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
            print_xyz(">LRP LRP pls add 8, value for Z_RAISE_AFTER_PROBINGS", current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
          #endif
Wurstnase commented 9 years ago

add a #define Z_RAISE_AFTER_PROBINGS 10 or any other length in your config.h

lrpirlet commented 9 years ago

Thanks... My configuration.h reads:

  #define Z_RAISE_BEFORE_PROBING 8   
  #define Z_RAISE_BETWEEN_PROBINGS 3  
  #define Z_RAISE_AFTER_PROBING 8   

I will try 8.5 because I see (float) Z_RAISE_AFTER_PROBINGS

Pure (non) educated guess here :-) it now reads #define Z_RAISE_AFTER_PROBING 8.5 and it fails to compile giving:

Arduino: 1.6.2 (Windows 7), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from Marlin.h:22:0,

                 from Marlin_main.cpp:30:

Configuration.h:514:33: error: floating constant in preprocessor expression

   #define Z_RAISE_AFTER_PROBING 8.5    //How much the extruder will be raised after the last probing point.

                                 ^

Marlin_main.cpp:1330:13: note: in expansion of macro 'Z_RAISE_AFTER_PROBING'

         #if Z_RAISE_AFTER_PROBING > 0

             ^

Error compiling.

Should I try replacing float by int and restore configuration.h?...

I'll try anyway. ( lot of crash Learning here for me) lol

lrpirlet commented 9 years ago

OK, It does not work.

SO I removed one line and changed the offending line to read:

          #ifdef DEBUG_LEVELING
//            SERIAL_ECHOPAIR("Raise Z (after) by ", (float)Z_RAISE_AFTER_PROBINGS);
//            SERIAL_EOL;
            print_xyz("> SERVO_ENDSTOPS > do_blocking_move_to !LRP WRONG VALUE! see next line", current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
            print_xyz("I print  current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]", current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
            print_xyz(" + Z_RAISE_AFTER_PROBINGS value is 8.. so add 8 to current position... Thanks :-)", current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]);
          #endif

It now compiles...BUT SOME MANUAL ADDITION WILL BE NEEDED... lol

result: G28 followed by m114 then G1 Z0 ... the final distance between bed and head is 4mm I hope that helps...

++++++++++++++repetier log++++++++++

start
echo: External Reset
Marlin1.0.3 dev
echo: Last Updated: Default Setting35:59 | Author: LRP tuned
Compiled: Apr 10 2015
echo: Free Memory: 2123  PlannerBufferBytes: 1232
echo:Hardcoded Default Settings Loaded
echo:Steps per unit:
echo:  M92 X80.00 Y80.00 Z4000.00 E406.00
echo:Maximum feedrates (mm/s):
echo:  M203 X200.00 Y200.00 Z1.00 E45.00
echo:Maximum Acceleration (mm/J?Recho:  M201 X1000 Y1000 Z50 E5000
echo:Accelerations: P=printing, R=retract and T=travel
echo:  M204 P1500.00 R2000.00 T1500.00
echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s),  Z=maximum Z j??(mm/s),  E=maximum E jerk (mm/s)
echo:  M205 S0.00 T0.00 B20000 X20.00 Z0.40 E5.00
echo:Home offset (mm):
echo:  M206 X0.00 Y0.00 Z0.00
echo:PID settings:
echo:  M301 P22.41 I1.56 D80.41
echo:Filament settings: Disabled
echo:Z-Probe Offset (mm):
echo:  M851 Z-2.33
N1 M110 *2
N1 M110 *2
N2 M115 *4
N4 M111 S6 *67
N5 T0 *31
N6 M20 *55
N7 M80 *60
echo:SD init fail
echo:Unknown command: ""

FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:https://github.com/MarlinFirmware/Marlin PROTOCOL_VERSION:1.0 MACHINE_TYPE:Pi3 3D LabteK EXTRUDER_COUNT:1 UUID:00000000-0000-0000-0000-000000000000
N9 M220 S100 *72
N10 M221 S100 *113
N11 M111 S6 *119
N12 T0 *41
ok
ok
echo:Active Extruder: 0
ok
Begin file list
End file list
ok
echo:Active Extruder: 0
ok

N18 G28 *10
gcode_G28 >>>
  home_axis with axis=0
  home_axis > current_position: (0.00, 0.00, 0.00)
  > homeX: (0.00, 0.00, 0.00)
  N24 M114 *49
  home_axis with axis=1
  home_axis > current_position: (0.00, 0.00, 0.00)
  > homeY: (0.00, 0.00, 0.00)
  > Z_SAFE_HOMING >>>
  Raise Z (before homing) by 6.00
  > home_all_axis > current_position: (0.00, 0.00, 0.00)
  > home_all_axis > destination: (114.00, 104.00, 6.00)
  deploy_z_probe > current_position: (114.00, 104.00, 0.00)
  home_axis with axis=2
  home_axis > current_position: (114.00, 104.00, 0.00)
  home_axis > SERVO_ENDSTOPS > Stow with write()
  home_axis(Z_AXIS) > SERVO_LEVELING > stow_z_probe
  stow_z_probe > current_position: (114.00, 104.00, 0.00)
  > SERVO_ENDSTOPS > do_blocking_move_to !LRP WRONG VALUE! see next line: (114.00, 104.00, 0.00)
  I print  current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]: (114.00, 104.00, 0.00)
  + Z_RAISE_AFTER_PROBINGS value is 8.. so add 8 to current position... Thanks :-): (114.00, 104.00, 0.00)
  do_blocking_move_to: (114.00, 104.00, 8.00)
  > home_all_axis > final: (114.00, 104.00, 8.00)
  <<< Z_SAFE_HOMING
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
<<< gcode_G28
ok
N28 G1 Z0 *120
X:114.00 Y:104.00 Z:10.33 E:0.00 Count X: 114.00 Y:104.00 Z:10.33
ok
ok
lrpirlet commented 9 years ago

And G29 gives well something funny (Under the bed) while the head is 11.76 mm away from the bed after a G1 Z0...( that measure is FAR from precise, I feel like I have in between 11 and 12 mm)

++++++++++++repetier log +++++++++++++

N19 G28 X0 Y0 *10
gcode_G28 >>>

  home_axis with axis=0
  home_axis > current_position: (0.00, 0.00, 0.00)
  > homeX: (0.00, 0.00, 0.00)
  home_axis with axis=1
  home_axis > current_position: (0.00, 0.00, 0.00)
  > homeY: (0.00, 0.00, 0.00)
  > Set X: (0.00, 0.00, 0.00)
  > Set Y: (0.00, 0.00, 0.00)
  > Z_SAFE_HOMING >>>
  <<< Z_SAFE_HOMING
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)

<<< gcode_G28

N29 G29 P2 T V4 *125
gcode_G29 >>>

  G29 Auto Bed Leveling
  enable_endstops(true)
  Raise Z (before) by 8.00
  probe_pt >>>
  > ProbeAction:1
  > current_position: (0.00, 0.00, 0.00)
  > do_blocking_move_to: (0.00, 0.00, 8.00)
  do_blocking_move_to: (0.00, 0.00, 8.00)
  > do_blocking_move_to: (34.00, 29.00, 8.00)
  do_blocking_move_to: (34.00, 29.00, 8.00)
  > ProbeDeploy
  deploy_z_probe > current_position: (34.00, 29.00, 8.00)
  run_z_probe > current_position: (34.00, 29.00, -9.84)
  Bed X: 15.000 Y: 20.000 Z: -9.842
  <<< probe_pt

  Raise Z (between) by 3.00
  probe_pt >>>
  > ProbeAction:0
  > current_position: (34.00, 29.00, -9.84)
  > do_blocking_move_to: (34.00, 29.00, -6.84)
  do_blocking_move_to: (34.00, 29.00, -6.84)
  > do_blocking_move_to: (189.00, 29.00, -6.84)
  do_blocking_move_to: (189.00, 29.00, -6.84)
  run_z_probe > current_position: (189.00, 29.00, -9.70)
  Raise Z (between) by 3.00
  > ProbeStay > do_blocking_move_to: (189.00, 29.00, -6.70)
  do_blocking_move_to: (189.00, 29.00, -6.70)
  Bed X: 170.000 Y: 20.000 Z: -9.698
  <<< probe_pt

  Raise Z (between) by 3.00
  probe_pt >>>
  > ProbeAction:0
  > current_position: (189.00, 29.00, -6.70)
  > do_blocking_move_to: (189.00, 29.00, -3.70)
  do_blocking_move_to: (189.00, 29.00, -3.70)
  > do_blocking_move_to: (34.00, 179.00, -3.70)
  do_blocking_move_to: (34.00, 179.00, -3.70)
  run_z_probe > current_position: (34.00, 179.00, -9.83)
  Raise Z (between) by 3.00
  > ProbeStay > do_blocking_move_to: (34.00, 179.00, -6.83)
  do_blocking_move_to: (34.00, 179.00, -6.83)
  Bed X: 15.000 Y: 170.000 Z: -9.829
  <<< probe_pt

  Raise Z (between) by 3.00
  probe_pt >>>
  > ProbeAction:2
  > current_position: (34.00, 179.00, -6.83)
  > do_blocking_move_to: (34.00, 179.00, -3.83)
  do_blocking_move_to: (34.00, 179.00, -3.83)
  > do_blocking_move_to: (189.00, 179.00, -3.83)
  do_blocking_move_to: (189.00, 179.00, -3.83)
  run_z_probe > current_position: (189.00, 179.00, -9.68)
  > ProbeStow
  stow_z_probe > current_position: (189.00, 179.00, -9.68)
  > SERVO_ENDSTOPS > do_blocking_move_to !LRP WRONG VALUE! see next line: (189.00, 179.00, -9.68)
  I print  current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]: (189.00, 179.00, -9.68)
  + Z_RAISE_AFTER_PROBINGS value is 8.. so add 8 to current position... Thanks :-): (189.00, 179.00, -9.68)
  do_blocking_move_to: (189.00, 179.00, -1.68)
  Bed X: 170.000 Y: 170.000 Z: -9.676
  <<< probe_pt

  > probing complete > current_position: (189.00, 179.00, -1.68)
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
  Eqn coefficients: a: 0.00096126 b: 0.00011833 d: -9.86153221
  Mean of sampled points: -9.76137542

  Bed Height Topography:
  +-----------+
  |...Back....|
  |Left..Right|
  |...Front...|
  +-----------+
  -0.06787 +0.08563
  -0.08112 +0.06338
  planeNormal x: -0.000961 y: -0.000118 z: 1.000000
  set_bed_level_equation_lsq > current_position: (189.00, 179.00, -1.88)

  Bed Level Correction Matrix:
  +1.000000 +0.000000 +0.000961
  -0.000000 +1.000000 +0.000118
  -0.000961 -0.000118 +1.000000

<<< gcode_G29

ok
N91 M114 *63
X:189.00 Y:179.00 Z:-1.90 E:0.00 Count X: 189.00 Y:179.00 Z:-1.70
ok
N125 G1 Z0 *68
ok
thinkyhead commented 9 years ago

I fixed the misspelling in the branch: Z_RAISE_AFTER_PROBINGS >> Z_RAISE_AFTER_PROBING – with no S on the end.

maverikou commented 9 years ago

What I don't understand is why probing fails after a random amount of points?

Ran my delta 5 times on latest code, probing failed in different places each time and then the planner did not know exactly where it was - probe stowing completely missed the target.

Wurstnase commented 9 years ago

Could this something have to do with interrupt protected blocks?

lrpirlet commented 9 years ago

@thinkyhead, Thanks, maybe I should invest in some glasses...

I ran another test and learn some more... I do become more and more persuaded that the problem is in G28, NOT in G29. I strongly suspect the "Z Safe Homing" feature

++++++++++ repetier log AND comment embedded ++++++++ I made a G28... The head was about 4 mm above the bed (a cardboard that can be punched and give me time to react to kill the printer) I lowered the head close to the bed and made sure that the Z switch wired in parallel to the probe was triggered at 1 mm hight I made sure to issue then G92 Z0

I then issued G28 X0 Y0

N1333 G28 X0 Y0 *0
gcode_G28 >>>
  home_axis with axis=0
  home_axis > current_position: (0.00, 0.00, 1.80)
  > homeX: (0.00, 0.00, 1.80)
  home_axis with axis=1
  home_axis > current_position: (0.00, 0.00, 1.80)
  > homeY: (0.00, 0.00, 1.80)
  > Set X: (0.00, 0.00, 1.80)
  > Set Y: (0.00, 0.00, 1.80)
  > Z_SAFE_HOMING >>>
  <<< Z_SAFE_HOMING
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
<<< gcode_G28
ok

The head is still 1 mm away from the bed, I issue G29... At the end of G29, the head is still at 1 mm So I conclude that G28 ends up 4 mm to high.

I think I will disable Z_SAFE_Homing tomorow and report... ( time to cover the bed with a cardboard and try with a finger on the kill button)

N1346 G29 P2 T V4 *118
gcode_G29 >>>
  G29 Auto Bed Leveling
  enable_endstops(true)
  Raise Z (before) by 8.00
  probe_pt >>>
    > ProbeAction:1
    > current_position: (0.00, 0.00, 1.80)
    > do_blocking_move_to: (0.00, 0.00, 8.00)
    do_blocking_move_to: (0.00, 0.00, 8.00)
    > do_blocking_move_to: (34.00, 29.00, 8.00)
    do_blocking_move_to: (34.00, 29.00, 8.00)
    > ProbeDeploy
    deploy_z_probe > current_position: (34.00, 29.00, 8.00)
    run_z_probe > current_position: (34.00, 29.00, 2.67)
    Bed X: 15.000 Y: 20.000 Z: 2.670
  <<< probe_pt
  Raise Z (between) by 3.00
  probe_pt >>>
    > ProbeAction:0
    > current_position: (34.00, 29.00, 2.67)
    > do_blocking_move_to: (34.00, 29.00, 5.67)
    do_blocking_move_to: (34.00, 29.00, 5.67)
    > do_blocking_move_to: (189.00, 29.00, 5.67)
    do_blocking_move_to: (189.00, 29.00, 5.67)
    run_z_probe > current_position: (189.00, 29.00, 2.66)
    Raise Z (between) by 3.00
    > ProbeStay > do_blocking_move_to: (189.00, 29.00, 5.66)
    do_blocking_move_to: (189.00, 29.00, 5.66)
    Bed X: 170.000 Y: 20.000 Z: 2.661
  <<< probe_pt
  Raise Z (between) by 3.00
  probe_pt >>>
    > ProbeAction:0
    > current_position: (189.00, 29.00, 5.66)
    > do_blocking_move_to: (189.00, 29.00, 8.66)
    do_blocking_move_to: (189.00, 29.00, 8.66)
    > do_blocking_move_to: (34.00, 179.00, 8.66)
    do_blocking_move_to: (34.00, 179.00, 8.66)
    run_z_probe > current_position: (34.00, 179.00, 2.67)
    Raise Z (between) by 3.00
    > ProbeStay > do_blocking_move_to: (34.00, 179.00, 5.67)
    do_blocking_move_to: (34.00, 179.00, 5.67)
    Bed X: 15.000 Y: 170.000 Z: 2.665
  <<< probe_pt
  Raise Z (between) by 3.00
  probe_pt >>>
    > ProbeAction:2
    > current_position: (34.00, 179.00, 5.67)
    > do_blocking_move_to: (34.00, 179.00, 8.67)
    do_blocking_move_to: (34.00, 179.00, 8.67)
    > do_blocking_move_to: (189.00, 179.00, 8.67)
    do_blocking_move_to: (189.00, 179.00, 8.67)
    run_z_probe > current_position: (189.00, 179.00, 2.49)
    > ProbeStow
    stow_z_probe > current_position: (189.00, 179.00, 2.49)
    Raise Z (after) by 8.00
    > SERVO_ENDSTOPS > do_blocking_move_to: (189.00, 179.00, 10.49)
    do_blocking_move_to: (189.00, 179.00, 10.49)
    Bed X: 170.000 Y: 170.000 Z: 2.493
  <<< probe_pt
  > probing complete > current_position: (189.00, 179.00, 10.49)
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
  Eqn coefficients: a: -0.00058226 b: -0.00057333 d: 2.73070001
  Mean of sampled points: 2.62237501

  Bed Height Topography:
  +-----------+
  |...Back....|
  |Left..Right|
  |...Front...|
  +-----------+
  +0.04288 -0.12888
  +0.04737 +0.03863
  planeNormal x: 0.000582 y: 0.000573 z: 1.000000
  set_bed_level_equation_lsq > current_position: (188.99, 178.99, 10.71)

  Bed Level Correction Matrix:
  +1.000000 +0.000000 -0.000582
  -0.000000 +1.000000 -0.000573
  +0.000582 +0.000573 +1.000000
<<< gcode_G29
ok
N1367 M114 *52
X:188.99 Y:178.99 Z:10.72 E:0.00 Count X: 189.00 Y:179.00 Z:10.51
ok
N1393 M114 *63
X:188.99 Y:178.99 Z:10.72 E:0.00 Count X: 189.00 Y:179.00 Z:10.51
ok
N1400 G1 Z0 *119
ok

The head is about 1 mm away from the bed

thinkyhead commented 9 years ago

https://github.com/thinkyhead/Marlin/archive/debug_G29.zip

I've updated the debug branch, adding logging at the point where zprobe_zoffset is added to the Z axis position. I'm wondering if zprobe_zoffset should be instead applied at a more central point – either in homeaxis or axis_is_at_home instead of only in G28 as it is now.

I noticed that on robots with a Z max endstop, the Z bed probe might have still been deploying as home starts. I will have to double-check on that. Clearly, the probe should not be deployed when homing to a Z max endstop.

thinkyhead commented 9 years ago

One thing that jumps out is that home_offset[Z_AXIS] is being added to the G28 Z argument value, so if you do G28 Z1 then current_position[Z_AXIS] would be 1 + home_offset[Z_AXIS]. I also noticed that if you do G28 Z0 then current_position[Z_AXIS] is simply not set. I think both of these behaviors are wrong. In general, the home_offset has been confusing, and we recently fixed the code so G92 doesn't add it on when you use it to set the current_position. So, this probably needs to be changed! The Z should be set literally to whatever value is included. It shouldn't even add the probe offset.

thinkyhead commented 9 years ago

Another question would be, what behavior do you see with Z_SAFE_HOMING enabled, with G28, G28 Z, G28 Z0, and G28 Z1… and then what happens when Z_SAFE_HOMING is disabled and those commands are run? It looks like Z_SAFE_HOMING code would be homing Z twice in some cases.

MoonshineSG commented 9 years ago

I did a test with the couple of days of code and it really seems that the problem is with the G28... After a G28 the nozzle is left way above Z0 but M114 reports that Z is 0...

lrpirlet commented 9 years ago

action plan

get https://github.com/thinkyhead/Marlin/archive/debug_G29.zip customize configuration.h keep Z_SAFE_HOMING G28 , M114 , G1 Z0, measure H-B... G28 Z , M114 , G1 Z0, measure H-B... I suspect will be sent as G28 Z0 by Repetier, G28 Z0 , M114 , G1 Z0, measure H-B... G28 Z1 , M114 , G1 Z0, measure H-B... ... remove Z_SAFE_HOMING G28 , M114 , G1 Z0, measure H-B... G28 Z , M114 , G1 Z0, measure H-B... I suspect will be sent as G28 Z0 by Repetier, if yes skip next step G28 Z0 , M114 , G1 Z0, measure H-B... G28 Z1 , M114 , G1 Z0, measure H-B...

some values from Configuration.h

#define X_PROBE_OFFSET_FROM_EXTRUDER -19 //-19.20 Probe on: -left  +right
#define Y_PROBE_OFFSET_FROM_EXTRUDER -9  //-9.40 Probe on: -front +behind
#define Z_PROBE_OFFSET_FROM_EXTRUDER -2.33  //-2.33 -below (always!)

#define Z_RAISE_BEFORE_HOMING 6
#define XY_TRAVEL_SPEED 6000
#define Z_RAISE_BEFORE_PROBING 8
#define Z_RAISE_BETWEEN_PROBINGS 3
#define Z_RAISE_AFTER_PROBING 8

from Configuration_adv.h

#define Z_HOME_BUMP_MM 2

I need to remember Z_HOME_BUMP_MM is multiplied by 2 in Marlin_main.cpp ... leading to 4mm

Line 894: XYZ_CONSTS_FROM_CONFIG(float, home_bump_mm, HOME_BUMP_MM);
Line 894: XYZ_CONSTS_FROM_CONFIG(float, home_bump_mm, HOME_BUMP_MM);
Line 1174:       zPosition += home_bump_mm(Z_AXIS);
Line 1182:       zPosition -= home_bump_mm(Z_AXIS) * 2;
Line 1611:     // Move away from the endstop by the axis HOME_BUMP_MM
Line 1612:     destination[axis] = -home_bump_mm(axis) * axis_home_dir;
Line 1620:     destination[axis] = 2 * home_bump_mm(axis) * axis_home_dir;

notes...

Copied over Configuration.h

add origin in G29 topology map display so I can read it without thinking where is the front located..

ooops Compile error

Arduino: 1.6.2 (Windows 7), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from cardreader.cpp:6:0:language.h:78:4: error: #error CUSTOM_MENDEL_NAME deprecated - use CUSTOM_MACHINE_NAME   #error 

CUSTOM_MENDEL_NAME deprecated - use CUSTOM_MACHINE_NAME    ^Error compiling.

Edited Configuration.h (I like Notepad++ with its ability to compare and search a whole directory... Free pub, honest... Nearly as good as grep :-) )

Now it compiles and upload...

Create a script into Repetier, at each M0 and at the bottom of the script, I will measure Hot-end to Bed distance... Script

G28
G1 Z0
M114
M0
G28 Z
G1 Z0
M114
M0
G28 Z0
G1 Z0
M114
M0
G28 Z1
G1 Z0
M114

++++++++++++ repetier logs +++++++++++

start
echo: External Reset
Marlin 103dev 12Mar2015
echo: Last Updated: Apr 12 2015 11:49:32 | Author: LRP tuned
Compiled: Apr 12 2015
echo: Free Memory: 2313  PlannerBufferBytes: 1232
echo:Hardcoded Default Settings Loaded
echo:Ste?per unit:
echo:  M92 X80.00 Y80.00 Z4000.00 E406.00
echo:Maximum feedrates (mm/s):
echo:  M203 X200.00 Y200.00 Z1.00 E45.00
echo:Maximum Acceleration (mm/s2):
echo:  M201 X1000 Y1000 Z50 E5000
echo:Accelerations: P=printing, R=retract and T=travel
echo:  M204 P1r????200um00 T1500.00
echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s),  Z=maximum Z jerk (mm/s),  E=maximum E jerk (mm/s)
echo:  M205 S0.00 T0.00 B20000 X20.00 Z0.40 E5.00
echo:Home offset (mm):
echo:  M206 X0.00 Y0.00 Z0.00
echo:PID settings:
echo:  M301 P22.41 I1.56 D80.41
echo:Filament settings: Disabled
echo:Z-Probe Offset (mm):
echo:  M851 Z-2.33
N1 M110 *2
N1 M110 *2
echo:SD init fail
echo:Unknown command: ""
ok
N2 M115 *4
ok
FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:https://github.com/MarlinFirmware/Marlin PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:1 UUID:00000000-0000-0000-0000-000000000000
ok
N4 M111 S6 *67
N5 T0 *31
ok
N6 M20 *55
echo:Active Extruder: 0
ok
Begin file list
End file list
ok
N7 M80 *60
N8 M220 S100 *73
ok
ok
N9 M221 S100 *73
N10 M111 S6 *118
ok
ok
N11 T0 *42
echo:Active Extruder: 0
ok
N15 G28 *7
gcode_G28 >>>
  axis_is_at_home 0 > (home_offset[axis]==0.00) > current_position: (0.00, 0.00, 0.00)
  home_axis with axis=0
  home_axis > current_position: (0.00, 0.00, 0.00)
  > homeX: (0.00, 0.00, 0.00)
  axis_is_at_home 1 > (home_offset[axis]==0.00) > current_position: (0.00, 0.00, 0.00)
  home_axis with axis=1
  home_axis > current_position: (0.00, 0.00, 0.00)
  > homeY: (0.00, 0.00, 0.00)
  > Z_SAFE_HOMING >>>
    Raise Z (before homing) by 6.00
    > home_all_axis > current_position: (0.00, 0.00, 0.00)
    > home_all_axis > destination: (114.00, 104.00, 6.00)
    deploy_z_probe > current_position: (114.00, 104.00, 0.00)
    axis_is_at_home 2 > (home_offset[axis]==0.00) > current_position: (114.00, 104.00, 0.00)
    home_axis with axis=2
    home_axis > current_position: (114.00, 104.00, 0.00)
    home_axis > SERVO_ENDSTOPS > Stow with write()
    home_axis(Z_AXIS) > SERVO_LEVELING > stow_z_probe
    stow_z_probe > current_position: (114.00, 104.00, 0.00)
    Raise Z (after) by 8.00
    > SERVO_ENDSTOPS > do_blocking_move_to: (114.00, 104.00, 8.00)
    do_blocking_move_to: (114.00, 104.00, 8.00)
    > home_all_axis > final: (114.00, 104.00, 8.00)
  <<< Z_SAFE_HOMING
  > (home_all_axis || homeZ) > Add zprobe_zoffset:2.33> current_position: (114.00, 104.00, 10.33)
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
<<< gcode_G28
ok
N16 G1 Z0 *117
ok
N17 M114 *49
X:114.00 Y:104.00 Z:0.00 E:0.00 Count X: 114.00 Y:104.00 Z:10.33
ok
N18 M0 *58

Distance is ~4 mm (I have a stack of paper 4mm high)

ok
N19 G28 Z0 *65
gcode_G28 >>>
  > Z_SAFE_HOMING >>>
    Raise Z (before homing) by 6.00
    > homeZ > current_position: (114.00, 104.00, 0.00)
    > homeZ > destination: (114.00, 104.00, 6.00)
    deploy_z_probe > current_position: (114.00, 104.00, 0.00)
    axis_is_at_home 2 > (home_offset[axis]==0.00) > current_position: (114.00, 104.00, 0.00)
    home_axis with axis=2
    home_axis > current_position: (114.00, 104.00, 0.00)
    home_axis > SERVO_ENDSTOPS > Stow with write()
    home_axis(Z_AXIS) > SERVO_LEVELING > stow_z_probe
    stow_z_probe > current_position: (114.00, 104.00, 0.00)
    Raise Z (after) by 8.00
    > SERVO_ENDSTOPS > do_blocking_move_to: (114.00, 104.00, 8.00)
    do_blocking_move_to: (114.00, 104.00, 8.00)
    > homeZ > final: (114.00, 104.00, 8.00)
  <<< Z_SAFE_HOMING
  > G28 Zn >>
  > Not setting Z value!> << G28 Zn
  > (home_all_axis || homeZ) > Add zprobe_zoffset:2.33> current_position: (114.00, 104.00, 10.33)
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
<<< gcode_G28
ok
N20 G1 Z0 *112
ok
N21 M114 *52
X:114.00 Y:104.00 Z:0.00 E:0.00 Count X: 114.00 Y:104.00 Z:10.33
ok
N22 M0 *51

Distance is ~4 mm

ok
N23 G28 Z0 *72
gcode_G28 >>>
  > Z_SAFE_HOMING >>>
    Raise Z (before homing) by 6.00
    > homeZ > current_position: (114.00, 104.00, 0.00)
    > homeZ > destination: (114.00, 104.00, 6.00)
    deploy_z_probe > current_position: (114.00, 104.00, 0.00)
    axis_is_at_home 2 > (home_offset[axis]==0.00) > current_position: (114.00, 104.00, 0.00)
    home_axis with axis=2
    home_axis > current_position: (114.00, 104.00, 0.00)
    home_axis > SERVO_ENDSTOPS > Stow with write()
    home_axis(Z_AXIS) > SERVO_LEVELING > stow_z_probe
    stow_z_probe > current_position: (114.00, 104.00, 0.00)
    Raise Z (after) by 8.00
    > SERVO_ENDSTOPS > do_blocking_move_to: (114.00, 104.00, 8.00)
    do_blocking_move_to: (114.00, 104.00, 8.00)
    > homeZ > final: (114.00, 104.00, 8.00)
  <<< Z_SAFE_HOMING
  > G28 Zn >>
  > Not setting Z value!> << G28 Zn
  > (home_all_axis || homeZ) > Add zprobe_zoffset:2.33> current_position: (114.00, 104.00, 10.33)
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
<<< gcode_G28
ok
N24 G1 Z0 *116
ok
N25 M114 *48
X:114.00 Y:104.00 Z:0.00 E:0.00 Count X: 114.00 Y:104.00 Z:10.33
ok
N26 M0 *55

Distance is ~4 mm

ok
N27 G28 Z1 *77
gcode_G28 >>>
  > Z_SAFE_HOMING >>>
    Raise Z (before homing) by 6.00
    > homeZ > current_position: (114.00, 104.00, 0.00)
    > homeZ > destination: (114.00, 104.00, 6.00)
    deploy_z_probe > current_position: (114.00, 104.00, 0.00)
    axis_is_at_home 2 > (home_offset[axis]==0.00) > current_position: (114.00, 104.00, 0.00)
    home_axis with axis=2
    home_axis > current_position: (114.00, 104.00, 0.00)
    home_axis > SERVO_ENDSTOPS > Stow with write()
    home_axis(Z_AXIS) > SERVO_LEVELING > stow_z_probe
    stow_z_probe > current_position: (114.00, 104.00, 0.00)
    Raise Z (after) by 8.00
    > SERVO_ENDSTOPS > do_blocking_move_to: (114.00, 104.00, 8.00)
    do_blocking_move_to: (114.00, 104.00, 8.00)
    > homeZ > final: (114.00, 104.00, 8.00)
  <<< Z_SAFE_HOMING
  > G28 Zn >>
    > (home_offset[Z_AXIS]==0.00) > current_position: (114.00, 104.00, 1.00)
  > << G28 Zn
  > (home_all_axis || homeZ) > Add zprobe_zoffset:2.33> current_position: (114.00, 104.00, 3.33)
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
<<< gcode_G28
ok
N28 G1 Z0 *120
ok
N29 M114 *60
X:114.00 Y:104.00 Z:0.00 E:0.00 Count X: 114.00 Y:104.00 Z:3.33
ok

Distance ~11.06 mm

++++++++++++++++++++++++++++++++++++

Absolutely NOT related to G28, after M0, the LCD shows "Mendel ready"... I would suggest "Machine ready" ;-)

Ok, next round with Z_SAFE_HOMING removed...

lrpirlet commented 9 years ago

I just commented in the Configuration.h

// #define Z_SAFE_HOMING

I did NOT touch any other lines...

The result is surprising... with the hot-end 50 MM away from Origin along axis X and axis Y, when I G28 for the first time, it goes up... then home X It goes up... then home Y It goes up.. then probe down.. then home Z.. then up.. then probe up

For the following G28, I see ONE up, but also there is no X nor Y move I am lost... Remark.... DO NOT believe M114 results... The ok comes back as soon as the command is accepted... M114 is issued as soon as the ok is received. I guess it gets executed right away instead of after the move is done.. A manual M114 issued after the move gives another result

+++++++++++ repetier log +++++++++

start
echo: External Reset
Marlin 103dev 12Mar2015
echo: Last Updated: Apr 12 2015 15:22:04 | Author: LRP tuned
Compiled: Apr 12 2015
echo: Free Memory: 2413  PlannerBufferBytes: 1232
echo:Hardcoded Default Settings Loaded
echo:Steps per unit:
echo:  M92 X80.00 Y80.00 Z4000.00 E406.00
echo:Maximum feedrates (mm/s):
echo:  M203 X200.00 Y200.00 Z1.00 E45.00
???Maximum Acceleration (mm/s2):
echo:  M201 X1000 Y1000 Z50 E5000
echo:Accelerations: P=printing, R=retract and T=travel
echo:  M204 P1500.00 R2000.00 T1500.00
echo:Advanced variables: S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum R????(mm/s),  Z=maximum Z jerk (mm/s),  E=maximum E jerk (mm/s)
echo:  M205 S0.00 T0.00 B20000 X20.00 Z0.40 E5.00
echo:Home offset (mm):
echo:  M206 X0.00 Y0.00 Z0.00
echo:PID settings:
echo:  M301 P22.41 I1.56 D80.41
echo:Filament settings: Disabled
echo:Z-Probe Offset (mm):
echo:  M851 Z-2.33
N1 M110 *2
N1 M110 *2
echo:SD init fail
echo:Unknown command: ""
ok
N2 M115 *4
ok
FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:https://github.com/MarlinFirmware/Marlin PROTOCOL_VERSION:1.0 MACHINE_TYPE:Mendel EXTRUDER_COUNT:1 UUID:00000000-0000-0000-0000-000000000000
ok
N4 M111 S6 *67
ok
N5 T0 *31
N6 M20 *55
echo:Active Extruder: 0
ok
N7 M80 *60
Begin file list
End file list
ok
ok
N8 M220 S100 *73
N9 M221 S100 *73
ok
ok
N10 M111 S6 *118
ok
N11 T0 *42
echo:Active Extruder: 0
ok
N40 G28 *7
gcode_G28 >>>
  Raise Z (before homing) by 6.00
  > (home_all_axis || homeZ) > destination: (0.00, 0.00, 6.00)
  axis_is_at_home 0 > (home_offset[axis]==0.00) > current_position: (0.00, 0.00, 0.00)
  home_axis with axis=0
  home_axis > current_position: (0.00, 0.00, 0.00)
  > homeX: (0.00, 0.00, 0.00)
  axis_is_at_home 1 > (home_offset[axis]==0.00) > current_position: (0.00, 0.00, 0.00)
  home_axis with axis=1
  home_axis > current_position: (0.00, 0.00, 0.00)
  > homeY: (0.00, 0.00, 0.00)
  deploy_z_probe > current_position: (0.00, 0.00, 0.00)
  axis_is_at_home 2 > (home_offset[axis]==0.00) > current_position: (0.00, 0.00, 0.00)
  home_axis with axis=2
  home_axis > current_position: (0.00, 0.00, 0.00)
  home_axis > SERVO_ENDSTOPS > Stow with write()
  home_axis(Z_AXIS) > SERVO_LEVELING > stow_z_probe
  stow_z_probe > current_position: (0.00, 0.00, 0.00)
  Raise Z (after) by 8.00
  > SERVO_ENDSTOPS > do_blocking_move_to: (0.00, 0.00, 8.00)
  do_blocking_move_to: (0.00, 0.00, 8.00)
  > HOMEAXIS(Z) > current_position: (0.00, 0.00, 8.00)
  > (home_all_axis || homeZ) > Add zprobe_zoffset:2.33> current_position: (0.00, 0.00, 10.33)
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
<<< gcode_G28
ok
N41 G1 Z0 *119
ok
N42 M114 *49
X:0.00 Y:0.00 Z:0.00 E:0.00 Count X: 0.00 Y:0.00 Z:10.33
ok
N43 M0 *52

distance B-H ~2 mm

ok
N44 G28 Z0 *73
gcode_G28 >>>
  Raise Z (before homing) by 6.00
  > (home_all_axis || homeZ) > destination: (0.00, 0.00, 6.00)
  deploy_z_probe > current_position: (0.00, 0.00, 0.00)
  axis_is_at_home 2 > (home_offset[axis]==0.00) > current_position: (0.00, 0.00, 0.00)
  home_axis with axis=2
  home_axis > current_position: (0.00, 0.00, 0.00)
  home_axis > SERVO_ENDSTOPS > Stow with write()
  home_axis(Z_AXIS) > SERVO_LEVELING > stow_z_probe
  stow_z_probe > current_position: (0.00, 0.00, 0.00)
  Raise Z (after) by 8.00
  > SERVO_ENDSTOPS > do_blocking_move_to: (0.00, 0.00, 8.00)
  do_blocking_move_to: (0.00, 0.00, 8.00)
  > HOMEAXIS(Z) > current_position: (0.00, 0.00, 8.00)
  > G28 Zn >>
  > Not setting Z value!> << G28 Zn
  > (home_all_axis || homeZ) > Add zprobe_zoffset:2.33> current_position: (0.00, 0.00, 10.33)
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
<<< gcode_G28
ok
N45 G1 Z0 *115
ok
N46 M114 *53
X:0.00 Y:0.00 Z:0.00 E:0.00 Count X: 0.00 Y:0.00 Z:10.33
ok
N47 M0 *48

distance H-B ~2mm

ok
N48 G28 Z0 *69
gcode_G28 >>>
  Raise Z (before homing) by 6.00
  > (home_all_axis || homeZ) > destination: (0.00, 0.00, 6.00)
  deploy_z_probe > current_position: (0.00, 0.00, 0.00)
  axis_is_at_home 2 > (home_offset[axis]==0.00) > current_position: (0.00, 0.00, 0.00)
  home_axis with axis=2
  home_axis > current_position: (0.00, 0.00, 0.00)
  home_axis > SERVO_ENDSTOPS > Stow with write()
  home_axis(Z_AXIS) > SERVO_LEVELING > stow_z_probe
  stow_z_probe > current_position: (0.00, 0.00, 0.00)
  Raise Z (after) by 8.00
  > SERVO_ENDSTOPS > do_blocking_move_to: (0.00, 0.00, 8.00)
  do_blocking_move_to: (0.00, 0.00, 8.00)
  > HOMEAXIS(Z) > current_position: (0.00, 0.00, 8.00)
  > G28 Zn >>
  > Not setting Z value!> << G28 Zn
  > (home_all_axis || homeZ) > Add zprobe_zoffset:2.33> current_position: (0.00, 0.00, 10.33)
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
<<< gcode_G28
ok
N49 G1 Z0 *127
ok
N50 M114 *50
X:0.00 Y:0.00 Z:0.00 E:0.00 Count X: 0.00 Y:0.00 Z:10.33
ok
N51 M0 *55

distance H-B ~2 mm

ok
N52 G28 Z1 *79
gcode_G28 >>>
  Raise Z (before homing) by 6.00
  > (home_all_axis || homeZ) > destination: (0.00, 0.00, 6.00)
  deploy_z_probe > current_position: (0.00, 0.00, 0.00)
  axis_is_at_home 2 > (home_offset[axis]==0.00) > current_position: (0.00, 0.00, 0.00)
  home_axis with axis=2
  home_axis > current_position: (0.00, 0.00, 0.00)
  home_axis > SERVO_ENDSTOPS > Stow with write()
  home_axis(Z_AXIS) > SERVO_LEVELING > stow_z_probe
  stow_z_probe > current_position: (0.00, 0.00, 0.00)
  Raise Z (after) by 8.00
  > SERVO_ENDSTOPS > do_blocking_move_to: (0.00, 0.00, 8.00)
  do_blocking_move_to: (0.00, 0.00, 8.00)
  > HOMEAXIS(Z) > current_position: (0.00, 0.00, 8.00)
  > G28 Zn >>
  > (home_offset[Z_AXIS]==0.00) > current_position: (0.00, 0.00, 1.00)
  > << G28 Zn
  > (home_all_axis || homeZ) > Add zprobe_zoffset:2.33> current_position: (0.00, 0.00, 3.33)
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
<<< gcode_G28
ok
N53 G1 Z0 *116
ok
N54 M114 *54
X:0.00 Y:0.00 Z:0.00 E:0.00 Count X: 0.00 Y:0.00 Z:3.33
ok

Distance H-B ~8.2 mm

+++++++++++++++++

Sorry, maybe later... time to go.

thinkyhead commented 9 years ago

1896 addresses the last 2 things I mentioned.

thinkyhead commented 9 years ago

@lrpirlet With #1896 I've changed the default CUSTOM_MACHINE_NAME and MACHINE_NAME to "3D Printer" which is the most mainstream option. I considered "RepRap" but that is now something of a brand name.

lrpirlet commented 9 years ago

@thinkyhead. Thanks, much appreciated...

I think I got the formatting now :-)

I do NOT see in your debugging any print related to HOME_BUMP_MM... I have a strong feeling that HOME_BUMP_MM is involved in the bug... see below. PLS tell me if you need/want some more… Thanks to take care

some values... from configuration.h

  // Offsets to the probe relative to the extruder tip (Hotend - Probe)
  // X and Y offsets must be integers

#define X_PROBE_OFFSET_FROM_EXTRUDER -19    //-19.20 Probe on: -left  +right  
#define Y_PROBE_OFFSET_FROM_EXTRUDER -9     //-9.40 Probe on: -front +behind  
#define Z_PROBE_OFFSET_FROM_EXTRUDER -2.33  //-2.33 -below (always!)

#define Z_RAISE_BEFORE_HOMING 6         // (in mm) Raise Z before homing (G28) for Probe Clearance.
                                        // Be sure you have this distance over your Z_MAX_POS in case

#define XY_TRAVEL_SPEED 6000         // X and Y axis travel speed between probes, in mm/min

#define Z_RAISE_BEFORE_PROBING 7        //was 8 yesterday  
#define Z_RAISE_BETWEEN_PROBINGS 3   //was 3 yesterday
#define Z_RAISE_AFTER_PROBING 8           //Was 8 yesterday

from configuration_adv.h

#define Z_HOME_BUMP_MM 1   // LRP was 2 yesterday

Lines of code that relates to HOME_BUMP_MM

    Line 894: XYZ_CONSTS_FROM_CONFIG(float, home_bump_mm, HOME_BUMP_MM);
    Line 894: XYZ_CONSTS_FROM_CONFIG(float, home_bump_mm, HOME_BUMP_MM);
    Line 1174:       zPosition += home_bump_mm(Z_AXIS);
    Line 1182:       zPosition -= home_bump_mm(Z_AXIS) * 2;
    Line 1611:     // Move away from the endstop by the axis HOME_BUMP_MM
    Line 1612:     destination[axis] = -home_bump_mm(axis) * axis_home_dir;
    Line 1620:     destination[axis] = 2 * home_bump_mm(axis) * axis_home_dir;

notes...

I made sure to have different offset for each probing or bump distance... I enabled Z_SAFE_HOMING again

Value of Z_HOME_BUMP_MM was 2 ? leading ? to a distance at end of G28 Z0 of 4 yesterday Value of Z_HOME_BUMP_MM is 1 ?? leading ?? to a distance at end of G28 Z0 of 2 today There must be a relation here...

Create a script into Repetier, at each M0 and at the bottom of the script, I will measure Hot-end to Bed distance... Script

G28
G1 Z0
M0
M114
G28 Z0
G1 Z0
M0
M114
G28 Z1
G1 Z0
M0
M114
G29 V4 P2 T

++++++++++++ repetier logs +++++++++++

echo:Z-Probe Offset (mm):
echo:  M851 Z-2.33
ok
gcode_G28 >>>
  axis_is_at_home 0 > (home_offset[axis]==0.00) > current_position: (0.00, 0.00, 0.00)
  home_axis with axis=0
  home_axis > current_position: (0.00, 0.00, 0.00)
  > homeX: (0.00, 0.00, 0.00)
  axis_is_at_home 1 > (home_offset[axis]==0.00) > current_position: (0.00, 0.00, 0.00)
  home_axis with axis=1
  home_axis > current_position: (0.00, 0.00, 0.00)
  > homeY: (0.00, 0.00, 0.00)
  > Z_SAFE_HOMING >>>
    Raise Z (before homing) by 6.00
    > home_all_axis > current_position: (0.00, 0.00, 0.00)
    > home_all_axis > destination: (114.00, 104.00, 6.00)
    deploy_z_probe > current_position: (114.00, 104.00, 0.00)
    axis_is_at_home 2 > (home_offset[axis]==0.00) > current_position: (114.00, 104.00, 0.00)
    home_axis with axis=2
    home_axis > current_position: (114.00, 104.00, 0.00)
    home_axis > SERVO_ENDSTOPS > Stow with write()
    home_axis(Z_AXIS) > SERVO_LEVELING > stow_z_probe
    stow_z_probe > current_position: (114.00, 104.00, 0.00)
    Raise Z (after) by 8.00
    > SERVO_ENDSTOPS > do_blocking_move_to: (114.00, 104.00, 8.00)
    do_blocking_move_to: (114.00, 104.00, 8.00)
    > home_all_axis > final: (114.00, 104.00, 8.00)
  <<< Z_SAFE_HOMING
  > (home_all_axis || homeZ) > Add zprobe_zoffset:2.33> current_position: (114.00, 104.00, 10.33)
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
<<< gcode_G28
ok
N16 G1 Z0 *117
ok
N17 M0 *53

distance H-B 2mm

ok
N18 M114 *62
X:114.00 Y:104.00 Z:0.00 E:0.00 Count X: 114.00 Y:104.00 Z:0.00
ok
N19 G28 Z0 *65
gcode_G28 >>>
  > Z_SAFE_HOMING >>>
    Raise Z (before homing) by 6.00
    > homeZ > current_position: (114.00, 104.00, 0.00)
    > homeZ > destination: (114.00, 104.00, 6.00)
    deploy_z_probe > current_position: (114.00, 104.00, 0.00)
    axis_is_at_home 2 > (home_offset[axis]==0.00) > current_position: (114.00, 104.00, 0.00)
    home_axis with axis=2
    home_axis > current_position: (114.00, 104.00, 0.00)
    home_axis > SERVO_ENDSTOPS > Stow with write()
    home_axis(Z_AXIS) > SERVO_LEVELING > stow_z_probe
    stow_z_probe > current_position: (114.00, 104.00, 0.00)
    Raise Z (after) by 8.00
    > SERVO_ENDSTOPS > do_blocking_move_to: (114.00, 104.00, 8.00)
    do_blocking_move_to: (114.00, 104.00, 8.00)
    > homeZ > final: (114.00, 104.00, 8.00)
  <<< Z_SAFE_HOMING
  > G28 Zn >>
    > Not setting Z value!
  > << G28 Zn
  > (home_all_axis || homeZ) > Add zprobe_zoffset:2.33> current_position: (114.00, 104.00, 10.33)
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
<<< gcode_G28
ok
N20 G1 Z0 *112
ok
N21 M0 *48

Distance H-B 2mm

ok
N22 M114 *55
X:114.00 Y:104.00 Z:0.00 E:0.00 Count X: 114.00 Y:104.00 Z:0.00
ok
N23 G28 Z1 *73
gcode_G28 >>>
  > Z_SAFE_HOMING >>>
    Raise Z (before homing) by 6.00
    > homeZ > current_position: (114.00, 104.00, 0.00)
    > homeZ > destination: (114.00, 104.00, 6.00)
    deploy_z_probe > current_position: (114.00, 104.00, 0.00)
    axis_is_at_home 2 > (home_offset[axis]==0.00) > current_position: (114.00, 104.00, 0.00)
    home_axis with axis=2
    home_axis > current_position: (114.00, 104.00, 0.00)
    home_axis > SERVO_ENDSTOPS > Stow with write()
    home_axis(Z_AXIS) > SERVO_LEVELING > stow_z_probe
    stow_z_probe > current_position: (114.00, 104.00, 0.00)
    Raise Z (after) by 8.00
    > SERVO_ENDSTOPS > do_blocking_move_to: (114.00, 104.00, 8.00)
    do_blocking_move_to: (114.00, 104.00, 8.00)
    > homeZ > final: (114.00, 104.00, 8.00)
  <<< Z_SAFE_HOMING
  > G28 Zn >>
    > (home_offset[Z_AXIS]==0.00) > current_position: (114.00, 104.00, 1.00)
  > << G28 Zn
  > (home_all_axis || homeZ) > Add zprobe_zoffset:2.33> current_position: (114.00, 104.00, 3.33)
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
<<< gcode_G28
ok
N24 G1 Z0 *116
ok
N25 M0 *52

Distance H-B ~9.20 mm ?? I am NOT sure... Was ~11.06 mm yesterday in same config Was ~8.2mm yesterday.. with safe homing disabled...

ok
N26 M114 *51
X:114.00 Y:104.00 Z:0.00 E:0.00 Count X: 114.00 Y:104.00 Z:0.00
ok
N27 G29 V4 P2 T *115
gcode_G29 >>>
  G29 Auto Bed Leveling
  enable_endstops(true)
  z_before = (before) 7.00
  probe_pt >>>
    > ProbeAction:1
    > current_position: (114.00, 104.00, 0.00)
    Z Raise to z_before 7.00
    > do_blocking_move_to: (114.00, 104.00, 7.00)
    do_blocking_move_to: (114.00, 104.00, 7.00)
    > do_blocking_move_to XY: (34.00, 29.00, 7.00)
    do_blocking_move_to: (34.00, 29.00, 7.00)
    > ProbeDeploy
    deploy_z_probe > current_position: (34.00, 29.00, 7.00)
    run_z_probe > current_position: (34.00, 29.00, -6.62)
    Bed X: 15.000 Y: 20.000 Z: -6.618
  <<< probe_pt
  z_before = (between) 3.00
  probe_pt >>>
    > ProbeAction:0
    > current_position: (34.00, 29.00, -6.62)
    Z Raise to z_before -3.62
    > do_blocking_move_to: (34.00, 29.00, -3.62)
    do_blocking_move_to: (34.00, 29.00, -3.62)
    > do_blocking_move_to XY: (189.00, 29.00, -3.62)
    do_blocking_move_to: (189.00, 29.00, -3.62)
    run_z_probe > current_position: (189.00, 29.00, -6.63)
    Raise Z (between) by 3.00
    > ProbeStay > do_blocking_move_to: (189.00, 29.00, -3.63)
    do_blocking_move_to: (189.00, 29.00, -3.63)
    Bed X: 170.000 Y: 20.000 Z: -6.631
  <<< probe_pt
  z_before = (between) 3.00
  probe_pt >>>
    > ProbeAction:0
    > current_position: (189.00, 29.00, -3.63)
    Z Raise to z_before -0.63
    > do_blocking_move_to: (189.00, 29.00, -0.63)
    do_blocking_move_to: (189.00, 29.00, -0.63)
    > do_blocking_move_to XY: (34.00, 179.00, -0.63)
    do_blocking_move_to: (34.00, 179.00, -0.63)
    run_z_probe > current_position: (34.00, 179.00, -6.67)
    Raise Z (between) by 3.00
    > ProbeStay > do_blocking_move_to: (34.00, 179.00, -3.67)
    do_blocking_move_to: (34.00, 179.00, -3.67)
    Bed X: 15.000 Y: 170.000 Z: -6.670
  <<< probe_pt
  z_before = (between) 3.00
  probe_pt >>>
    > ProbeAction:2
    > current_position: (34.00, 179.00, -3.67)
    Z Raise to z_before -0.67
    > do_blocking_move_to: (34.00, 179.00, -0.67)
    do_blocking_move_to: (34.00, 179.00, -0.67)
    > do_blocking_move_to XY: (189.00, 179.00, -0.67)
    do_blocking_move_to: (189.00, 179.00, -0.67)
    run_z_probe > current_position: (189.00, 179.00, -6.95)
    > ProbeStow (stow_z_probe will do Z Raise)
    stow_z_probe > current_position: (189.00, 179.00, -6.95)
    Raise Z (after) by 8.00
    > SERVO_ENDSTOPS > do_blocking_move_to: (189.00, 179.00, 1.05)
    do_blocking_move_to: (189.00, 179.00, 1.05)
    Bed X: 170.000 Y: 170.000 Z: -6.949
  <<< probe_pt
  > probing complete > current_position: (189.00, 179.00, 1.05)
  ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
  Eqn coefficients: a: -0.00094194 b: -0.00123333 d: -6.51245355
  Mean of sampled points: -6.71674966

  Bed Height Topography:
  |+-----------+
  Y|...Back....|
  ^|Left..Right|
  y|...Front...|
  |O-----------+
  O---x-->--X---
  +0.04675 -0.23175
  +0.09925 +0.08575
  planeNormal x: 0.000942 y: 0.001233 z: 1.000000
  set_bed_level_equation_lsq > current_position: (189.00, 179.00, 1.45)

  Bed Level Correction Matrix:
  +1.000000 +0.000000 -0.000942
  -0.000001 +0.999999 -0.001233
  +0.000942 +0.001233 +0.999999
<<< gcode_G29
ok
N41 G1 Z0 *119
ok
N60 M114 *49
X:189.00 Y:179.00 Z:0.00 E:0.00 Count X: 189.00 Y:179.00 Z:-0.40
ok

Distance H-B ~ 2 mm

MoonshineSG commented 9 years ago

Any updates on this ?

thinkyhead commented 9 years ago

I am diving into this issue now, to see if I can clear up at least some of the points raised.

thinkyhead commented 9 years ago

@lrpirlet Here's one thing in G28 that seems to have a clear fix. You mention the distance to the bed after homing was ~2mm. And the Z offset of your probe is 2.33mm. Meanwhile, it looks like current_position[Z_AXIS] after homing (with a probe) is set to Z_MIN when it should be set to zprobe_zoffset. This means that after homing with a probe, the Z axis thinks it is 2.33mm lower than it really is. So I'm patching my debug branch now to see if that fixes some of the G28 issues.

https://github.com/thinkyhead/Marlin/archive/debug_G29.zip

thinkyhead commented 9 years ago

@MoonshineSG I have added code to my debug branch to raise the Z axis for M401 and M402 – only if needed. If the Z position is known and high enough, then the Z won't be raised.

MoonshineSG commented 9 years ago

That's great. Thats for my point 1. Unfortunately, I can't do testing until next Tuesday as I'm away... But do keep the fixes coming. It would be awesome if I can return to a (even if partially) working printer :P

(in case I never said it before, a million thanks for the great work!)

thinkyhead commented 9 years ago

1924

1925

Thanks for the props, @MoonshineSG. It's nice to know the work does not go unnoticed!

clefranc commented 9 years ago

@thinkyhead Well, I do have a probe on my delta, but I'm too lazy to install it properly. But I've noticed you've done some works on a supposedly auto levelling thing. :+1:

OK, I think it's now time to give it a try... you put so much time on it, thanks for the great work,

BTW I'm a good sponsor too.

lrpirlet commented 9 years ago

@thinkyhead Thanks. I will download that zip and give it a try... I will not be able to make any test tonight, I am running out of time (again ..)

I tried to compile it and got


Marlin_main.cpp: In function 'float probe_pt(float, float, float, ProbeAction, int)':
Marlin_main.cpp:1503:11: error: 'retract_action' was not declared in this scope
       if (retract_action == ProbeStay) {
           ^
Error compiling.
    #if Z_RAISE_BETWEEN_PROBINGS > 0
      if (retract_action == ProbeStay) {
        #ifdef DEBUG_LEVELING
          SERIAL_ECHOPAIR("Raise Z (between) by ", (float)Z_RAISE_BETWEEN_PROBINGS);

May I guess "probe_action" as in previous dev zip??

    #if Z_RAISE_BETWEEN_PROBINGS > 0
      if (probe_action == ProbeStay) {
        #ifdef DEBUG_LEVELING
          SERIAL_ECHOPAIR("Raise Z (between) by ", (float)Z_RAISE_BETWEEN_PROBINGS);
lrpirlet commented 9 years ago

@thinkyhead, I changed retract_action == ProbeStay to probe_action == ProbeStay and made some tests... Seems that I still see 4mm ( twice Z_HOME_BUMP_MM ?) so the problem is still theer... There is also a BIG diffrence between G28 and G28 X0 Y0 followed by G28 Z0

Thanks to take care

From configuration.h

  #define Y_PROBE_OFFSET_FROM_EXTRUDER -9  //-9.40 Probe on: -front +behind
  #define Z_PROBE_OFFSET_FROM_EXTRUDER -2.33  //-2.33 -below (always!)
  #define Z_RAISE_BEFORE_HOMING 6       // (in mm) Raise Z before homing (G28) for Probe Clearance.

  #define Z_RAISE_BEFORE_PROBING 7   //How much the extruder will be raised before traveling to the first probing point.
  #define Z_RAISE_BETWEEN_PROBINGS 3  //How much the extruder will be raised when traveling from between next probing points
  #define Z_RAISE_AFTER_PROBING 8    //How much the extruder will be raised after the last probing point.

From configuration_adv.h

#define X_HOME_BUMP_MM 5
#define Y_HOME_BUMP_MM 5
#define Z_HOME_BUMP_MM 2

++++++++++Repetier logs +++++++++++++

15:57:27.429 : start
15:57:27.429 : echo: External Reset
15:57:27.429 : Marlin 1.0.3dev16.04.15
15:57:27.429 : echo: Last Updated: Apr 17 2015 21:14:04 | Author: LRP Tuned
15:57:27.444 : Compiled: Apr 17 2015
15:57:27.444 : echo: Free Memory: 2311  PlannerBufferBytes: 1232
15:57:27.444 : echo:Hardcoded Default Settings Loaded
15:57:27.444 : echo:Steps per unit:
15:57:27.444 : echo:  M92 X80.00 Y80.00 Z4000?*?406.00
15:57:27.444 : echo:Maximum feedrates (mm/s):
15:57:27.444 : echo:  M203 X200.00 Y200.00 Z1.00 E45.00
15:57:27.444 : echo:Maximum Acceleration (mm/s2):
15:57:27.444 : echo:  M201 X1000 Y1000 Z50 E5000
15:57:27.444 : echo:Accelerations: P=printing, R=retract and T=travel
15:57:27.444 : echo:  M204 P1500.00 R2000.00 T1500.00
15:57:27.460 : echo:Advanced vari???? S=Min feedrate (mm/s), T=Min travel feedrate (mm/s), B=minimum segment time (ms), X=maximum XY jerk (mm/s),  Z=maximum Z jerk (mm/s),  E=maximum E jerk (mm/s)
15:57:27.460 : echo:  M205 S0.00 T0.00 B20000 X20.00 Z0.40 E5.00
15:57:27.460 : echo:Home offset (mm):
15:57:27.460 : echo:  M206 X0.00 Y0.00 Z0.00
15:57:27.460 : echo:PID settings:
15:57:27.460 : echo:  M301 P22.41 I1.56 D80.41
15:57:27.460 : echo:Filament settings: Disabled
15:57:27.460 : echo:Z-Probe Offset (mm):
15:57:27.460 : echo:  M851 Z-2.33
15:57:27.912 : N1 M110 *2
15:57:28.474 : N1 M110 *2
15:57:31.407 : echo:SD init fail
15:57:31.407 : echo:Unknown command: ""
15:57:31.407 : ok
15:57:31.407 : N2 M115 *4
15:57:31.500 : ok
15:57:31.500 : FIRMWARE_NAME:Marlin V1; Sprinter/grbl mashup for gen6 FIRMWARE_URL:https://github.com/MarlinFirmware/Marlin PROTOCOL_VERSION:1.0 MACHINE_TYPE:Pi3 3D LabteK EXTRUDER_COUNT:1 UUID:00000000-0000-0000-0000-000000000000
15:57:31.500 : ok
15:57:31.500 : N4 M111 S6 *67
15:57:31.500 : N5 T0 *31
15:57:31.500 : ok
15:57:31.500 : N6 M20 *55
15:57:31.516 : echo:Active Extruder: 0
15:57:31.516 : ok
15:57:31.516 : Begin file list
15:57:31.516 : N7 M80 *60
15:57:31.516 : End file list
15:57:31.516 : ok
15:57:31.516 : N8 M220 S100 *73
15:57:31.516 : ok
15:57:31.516 : ok
15:57:31.516 : N9 M221 S100 *73
15:57:31.516 : N10 M111 S6 *118
15:57:31.516 : ok
15:57:31.516 : ok
15:57:31.516 : N11 T0 *42
15:57:31.516 : echo:Active Extruder: 0
15:57:31.516 : ok

issued G28

15:57:47.958 : N20 G28 *1
15:57:47.958 : gcode_G28 >>>
15:57:51.780 : axis_is_at_home 0 > (home_offset[axis]==0.00) > current_position: (0.00, 0.00, 0.00)
15:57:51.780 : home_axis with axis=0
15:57:51.780 : home_axis > current_position: (0.00, 0.00, 0.00)
15:57:51.780 : > homeX: (0.00, 0.00, 0.00)
15:57:55.618 : axis_is_at_home 1 > (home_offset[axis]==0.00) > current_position: (0.00, 0.00, 0.00)
15:57:55.618 : home_axis with axis=1
15:57:55.618 : home_axis > current_position: (0.00, 0.00, 0.00)
15:57:55.618 : > homeY: (0.00, 0.00, 0.00)
15:57:55.618 : > Z_SAFE_HOMING >>>
15:57:55.618 : Raise Z (before homing) by 6.00
15:57:55.618 : > home_all_axis > current_position: (0.00, 0.00, 0.00)
15:57:55.618 : > home_all_axis > destination: (114.00, 104.00, 6.00)
15:58:01.671 : deploy_z_probe > current_position: (114.00, 104.00, 0.00)
15:58:23.932 : axis_is_at_home 2 > (home_offset[axis]==0.00) > current_position: (114.00, 104.00, 2.33)
15:58:23.932 : home_axis with axis=2
15:58:23.932 : home_axis > current_position: (114.00, 104.00, 2.33)
15:58:23.932 : home_axis > SERVO_ENDSTOPS > Stow with write()
15:58:23.932 : home_axis(Z_AXIS) > SERVO_LEVELING > stow_z_probe
15:58:23.948 : stow_z_probe > current_position: (114.00, 104.00, 2.33)
15:58:23.948 : Raise Z (after) by 8.00
15:58:23.948 : > SERVO_ENDSTOPS > do_blocking_move_to: (114.00, 104.00, 10.33)
15:58:23.948 : do_blocking_move_to: (114.00, 104.00, 10.33)
15:58:38.627 : <<< Z_SAFE_HOMING
15:58:38.627 : > (home_all_axis || homeZ) > final: (114.00, 104.00, 10.33)
15:58:38.627 : ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
15:58:38.627 : <<< gcode_G28
15:58:38.627 : ok

Head is very high, more than 15 mm, machine thinks H-B distance is 10;33

16:05:07.602 : N209 M114 *12
16:05:07.602 : X:114.00 Y:104.00 Z:10.33 E:0.00 Count X: 114.00 Y:104.00 Z:10.33
16:05:07.602 : ok
16:05:14.794 : N213 G1 Z0 *66
16:05:14.794 : ok
16:09:10.387 : N328 M114 *14
16:09:10.387 : X:114.00 Y:104.00 Z:0.00 E:0.00 Count X: 114.00 Y:104.00 Z:0.00
16:09:10.387 : ok

the machine thinks H-B distance is zero I now measure ~6.35 mm between Hotend and Bed... let's use M48 to get more accurate distance

16:09:25.253 : N336 M48 P4 *125
16:09:25.253 : M48 Z-Probe Repeatability test
16:09:32.289 : deploy_z_probe > current_position: (114.00, 104.00, 7.00)
16:09:32.585 : enable_endstops(true)
16:09:51.368 : run_z_probe > current_position: (114.00, 104.00, -4.00)
16:09:58.404 : do_blocking_move_to: (114.00, 104.00, 3.00)
16:09:58.404 : enable_endstops(true)
16:10:13.146 : run_z_probe > current_position: (114.00, 104.00, -4.00)
16:10:20.181 : do_blocking_move_to: (114.00, 104.00, 3.00)
16:10:20.181 : enable_endstops(true)
16:10:34.954 : run_z_probe > current_position: (114.00, 104.00, -4.02)
16:10:42.006 : do_blocking_move_to: (114.00, 104.00, 3.00)
16:10:42.006 : enable_endstops(true)
16:10:56.794 : run_z_probe > current_position: (114.00, 104.00, -4.01)
16:11:03.830 : do_blocking_move_to: (114.00, 104.00, 3.00)
16:11:03.830 : enable_endstops(true)
16:11:18.603 : run_z_probe > current_position: (114.00, 104.00, -4.01)
16:11:18.603 : run_z_probe > current_position: (114.00, 104.00, -4.01)
16:11:25.654 : stow_z_probe > current_position: (114.00, 104.00, -4.01)
16:11:25.654 : Raise Z (after) by 8.00
16:11:25.654 : > SERVO_ENDSTOPS > do_blocking_move_to: (114.00, 104.00, 3.99)
16:11:25.654 : do_blocking_move_to: (114.00, 104.00, 3.99)
16:11:27.963 : ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
16:11:27.963 : Mean: -4.012500
16:11:27.963 : Standard Deviation: 0.004483
16:11:27.963 : ok

This gives 4.0125 mm + 2.33 mm gives about the measured 6.35 mm Note that 2.33 mm is the Z_PROBE_OFFSET_FROM_EXTRUDER WHERE does that 4mm comes from??

BUT that is not the only oddity...

Now If I issue G28 X0 Y0 followed by G28 Z0, the machine refuses to do it... BUT the H-B distance is set to ZERO

16:27:52.812 : N813 M114 *13
16:27:52.812 : X:114.00 Y:104.00 Z:3.99 E:0.00 Count X: 114.00 Y:104.00 Z:3.99
16:27:52.812 : ok
16:28:08.895 : N822 G28 X0 Y0 *58
16:28:08.895 : gcode_G28 >>>
16:28:14.090 : axis_is_at_home 0 > (home_offset[axis]==0.00) > current_position: (0.00, 104.00, 3.99)
16:28:14.090 : home_axis with axis=0
16:28:14.090 : home_axis > current_position: (0.00, 104.00, 3.99)
16:28:14.090 : > homeX: (0.00, 104.00, 3.99)
16:28:18.880 : axis_is_at_home 1 > (home_offset[axis]==0.00) > current_position: (0.00, 0.00, 3.99)
16:28:18.880 : home_axis with axis=1
16:28:18.880 : home_axis > current_position: (0.00, 0.00, 3.99)
16:28:18.880 : > homeY: (0.00, 0.00, 3.99)
16:28:18.880 : > Set X: (0.00, 0.00, 3.99)
16:28:18.880 : > Set Y: (0.00, 0.00, 3.99)
16:28:18.880 : ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
16:28:18.880 : <<< gcode_G28
16:28:18.880 : ok
16:28:22.031 : N825 M114 *8
16:28:22.031 : X:0.00 Y:0.00 Z:3.99 E:0.00 Count X: 0.00 Y:0.00 Z:3.99
16:28:22.031 : ok
16:28:36.618 : N833 G28 Z0 *113
16:28:36.618 : gcode_G28 >>>
16:28:36.618 : > Z_SAFE_HOMING >>>
16:28:36.618 : echo:Z probe out. bed
16:28:36.618 : <<< Z_SAFE_HOMING
16:28:36.618 : > (home_all_axis || homeZ) > final: (0.00, 0.00, 3.99)
16:28:36.618 : Set Z: (0.00, 0.00, 0.00)
16:28:36.618 : ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
16:28:36.618 : <<< gcode_G28

no move at all but z gets reset to zero... let's get over bed and issue G28 Z0

16:28:36.618 : ok
16:29:01.905 : N846 G1 X80 Y80 F2000 *103
16:29:01.905 : ok
16:29:11.796 : N852 M114 *8
16:29:11.796 : X:80.00 Y:80.00 Z:0.00 E:0.00 Count X: 80.00 Y:80.00 Z:0.00
16:29:11.796 : ok
16:29:56.725 : N875 G28 Z0 *115
16:29:56.725 : gcode_G28 >>>
16:29:56.725 : > Z_SAFE_HOMING >>>
16:29:56.725 : Raise Z (before homing) by 6.00
16:29:56.725 : > homeZ > current_position: (80.00, 80.00, 0.00)
16:29:56.725 : > homeZ > destination: (80.00, 80.00, 6.00)
16:30:02.762 : deploy_z_probe > current_position: (80.00, 80.00, 0.00)
16:30:24.883 : axis_is_at_home 2 > (home_offset[axis]==0.00) > current_position: (80.00, 80.00, 2.33)
16:30:24.883 : home_axis with axis=2
16:30:24.883 : home_axis > current_position: (80.00, 80.00, 2.33)
16:30:24.883 : home_axis > SERVO_ENDSTOPS > Stow with write()
16:30:24.883 : home_axis(Z_AXIS) > SERVO_LEVELING > stow_z_probe
16:30:24.883 : stow_z_probe > current_position: (80.00, 80.00, 2.33)
16:30:24.883 : Raise Z (after) by 8.00
16:30:24.883 : > SERVO_ENDSTOPS > do_blocking_move_to: (80.00, 80.00, 10.33)
16:30:24.898 : do_blocking_move_to: (80.00, 80.00, 10.33)
16:30:39.578 : <<< Z_SAFE_HOMING
16:30:39.578 : > (home_all_axis || homeZ) > final: (80.00, 80.00, 10.33)
16:30:39.578 : Set Z: (80.00, 80.00, 0.00)
16:30:39.578 : ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
16:30:39.578 : <<< gcode_G28
16:30:39.578 : ok

Hot-end seems VERY high about 15 mm but here the printer thinks the H-B distance is ZERO... Could we have the code assume that the axis is ZERO when we add the offset... it looks like it sets the current position to the code_value()

    // Set the Z position, if included
    if (code_seen(axis_codes[Z_AXIS]) && code_has_value()) {
      current_position[Z_AXIS] = code_value();
      #ifdef DEBUG_LEVELING
        print_xyz("Set Z", current_position);
      #endif
16:35:14.934 : N1010 M114 *55
16:35:14.934 : X:80.00 Y:80.00 Z:0.00 E:0.00 Count X: 80.00 Y:80.00 Z:0.00
16:35:14.934 : ok
16:35:25.636 : N1016 G1 Z0 *116
16:35:25.636 : ok

I forgot to measure exactly the distance H-B along Z axis... So I reproduced the G28 X0 Y0 move to 80,80 and issued G28 Z0...

So lets get down 10.33 mm and set Z coordinates to Zero...

17:09:16.809 : ok
17:09:26.013 : N92 M114 *60
17:09:26.013 : X:80.00 Y:80.00 Z:0.00 E:0.00 Count X: 80.00 Y:80.00 Z:0.00
17:09:26.013 : ok
17:09:49.569 : N105 G1 Z-10.33 *116
17:09:49.569 : ok
17:10:03.812 : N112 M114 *5
17:10:03.812 : X:80.00 Y:80.00 Z:-10.33 E:0.00 Count X: 80.00 Y:80.00 Z:-10.33
17:10:03.812 : ok
17:10:15.044 : N119 G92 Z0 *113
17:10:15.044 : ok
17:10:19.708 : N122 M114 *6
17:10:19.708 : X:80.00 Y:80.00 Z:0.00 E:0.00 Count X: 80.00 Y:80.00 Z:0.00
17:10:19.708 : ok

Same height of about 6,35 mm

17:10:43.311 : N135 M48 P4 *124
17:10:43.311 : M48 Z-Probe Repeatability test
17:10:50.346 : deploy_z_probe > current_position: (80.00, 80.00, 7.00)
17:10:50.643 : enable_endstops(true)
17:11:09.441 : run_z_probe > current_position: (80.00, 80.00, -3.99)
17:11:16.476 : do_blocking_move_to: (80.00, 80.00, 3.01)
17:11:16.476 : enable_endstops(true)
17:11:31.328 : run_z_probe > current_position: (80.00, 80.00, -4.00)
17:11:38.379 : do_blocking_move_to: (80.00, 80.00, 3.01)
17:11:38.379 : enable_endstops(true)
17:11:53.153 : run_z_probe > current_position: (80.00, 80.00, -3.99)
17:12:00.189 : do_blocking_move_to: (80.00, 80.00, 3.01)
17:12:00.189 : enable_endstops(true)
17:12:14.946 : run_z_probe > current_position: (80.00, 80.00, -3.99)
17:12:21.982 : do_blocking_move_to: (80.00, 80.00, 3.01)
17:12:21.982 : enable_endstops(true)
17:12:36.786 : run_z_probe > current_position: (80.00, 80.00, -3.99)
17:12:43.822 : stow_z_probe > current_position: (80.00, 80.00, -3.99)
17:12:43.822 : Raise Z (after) by 8.00
17:12:43.822 : > SERVO_ENDSTOPS > do_blocking_move_to: (80.00, 80.00, 4.01)
17:12:43.822 : do_blocking_move_to: (80.00, 80.00, 4.01)
17:12:46.146 : ENDSTOPS_ONLY_FOR_HOMING enable_endstops(false)
17:12:46.146 : Mean: -3.990000
17:12:46.146 : Standard Deviation: 0.003245
17:12:46.146 : ok
docwelch commented 9 years ago

One interesting finding while looking at this problem today:

To summarize, if you manually home the Z axis and then auto level, it seems to work.

I do not see what is causing this to happen in the gcode_G28() function when I compare it to an older version of Marlin that seems to work correctly. Maybe this will help someone else figure out what is going on with this issue.

lrpirlet commented 9 years ago

​Hello

As I said many times, I do not know C and C++ at all. However. the g92 code uses the sync_plan_position() function to set without moving the value to an axis.

In the homeaxis() code, I can see that this sync_plan_position() function is invoked several time, BUT NOT just after this code, when the Z axis slowly goes down to trigger the switch on the extended probe...

    // Move slowly towards the endstop until triggered
    destination[axis] = 2 * home_bump_mm(axis) * axis_home_dir;
    line_to_destination();
    st_synchronize();

​We KNOW that the position of the Hotend is at that moment, ​Z_PROBE_OFFSET_FROM_EXTRUDER...

Note that I have been playing with several value for Z_HOME_BUMP_MM. This constant is defined in the Configuration_adv.h as #define Z_HOME_BUMP_MM 2.

I found out that the offset is consistently twice the value of Z_HOME_BUMP_MM... NO, I did not try to set the value of that to zero, I still wanted to slowly trigger the switch.

2015-04-20 4:50 GMT+02:00 docwelch notifications@github.com:

One interesting finding while looking at this problem today:

  • Send G28 to the printer.
  • Send G1 Z0 and the hotend is above the bed.
  • Now, move the head down to the bed (using Macpronterface) and M114 shows Z = -4.3 (pretty consistently on my printer).
  • Send G92 Z0. (M114 now shows the Z to be 0.00.)
  • Send G29 and the machine goes through the auto leveling process.
  • Move the printhead back to the center of the bed (G1 X268 Y134 in my case).
  • Send G1 Z0 and the printhead ends up right on the bed as it should.

To summarize, if you manually home the Z axis and then auto level, it seems to work.

I do not see what is causing this to happen in the gcode_G28() function when I compare it to an older version of Marlin that seems to work correctly. Maybe this will help someone else figure out what is going on with this issue.

— Reply to this email directly or view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/1769#issuecomment-94344117 .

Roxy-3D commented 9 years ago

What is the current state of these bugs? Is there a set of files with some progress made towards resolving the issues? If there is a common set of files with some of the issues fixed, I can jump in and help.

docwelch commented 9 years ago

I do not think there has been any further progress on this bug, unfortunately. I have done some searching for the source but just do not have enough time to trace everything. I am certain we would all appreciate your help in finding an answer for this. Other than the test files @thinkyhead created (https://github.com/thinkyhead/Marlin/archive/debug_G29.zip), I don't know of any other files. I did use his debug_leveling files but it did not make the source of the error any more clear for me - maybe it would be helpful for someone else, however. As you can see, there are quite a few bugs. This one, however, has rendered the current development version of Marlin unusable for me as it incorrectly sets the zero point of the Z-axis, even if you don't use auto leveling.

Roxy-3D commented 9 years ago

This one, however, has rendered the current development version of Marlin unusable for me as it incorrectly sets the zero point of the Z-axis, even if you don't use auto leveling.

Agreed! I think this is a very high priority set of bugs to get resolved. Until these Auto Bed Leveling bugs are put to bed, nobody can even use the development version to hunt down further bugs.

With a little more thought... Would it make sense to undo the changes from the 'stable' branch and just get the 'development' branch to where it works again? I'm wondering if it would make sense to back up and then go after the Auto Bed Level issues with more careful thought?

lrpirlet commented 9 years ago

@thinkyhead, I think I have found the issue... BUT IT IS NOT QUITE CORRECTED.... I am NOT fluent in C or C++ enough to apply the fix where it should... and to verify that my code does not blow up something else...

Here is what I did in the debug code provided by you around 18-apr In Marlin_main.cpp I added some code around line 1675...

I observed that after 2 * home_bump_mm (2 occurances in the marlin_main.cpp), there was no sync_plan_position() for the cartesian printer type only... at this point in the code, I knew that the offset should be the probe offset... I hope the define are not too restrictive but enough to prevent other printer type to execute it

    // Move slowly towards the endstop until triggered
    destination[axis] = 2 * home_bump_mm(axis) * axis_home_dir;
    line_to_destination();
    st_synchronize();

    //lrp
    current_position[axis] = 0;
    #if SERVO_LEVELING && !defined(Z_PROBE_SLED)
      if (axis == Z_AXIS) current_position[axis] = Z_PROBE_OFFSET_FROM_EXTRUDER * Z_HOME_DIR;// -2.33 * -1
        #ifdef DEBUG_LEVELING
          SERIAL_ECHOLNPGM("LRP home_axis(Z_AXIS) > SERVO_LEVELING > will sync_plan_position() 2.33 above bed...");
        #endif
    #endif  
    sync_plan_position();
    //lrp

    #ifdef Z_DUAL_ENDSTOPS
      if (axis == Z_AXIS) {

P.S. It was a nice experience... Your comments in the code did help me somewhat find my way.. Please do not hesitate to comment... In particular, is there a way to know where a function is used?? I searched through all the code but found that this is not quite eqsy... Is there a way to produce a map of some sort???

thinkyhead commented 9 years ago

@lrpirlet Thank you for this info! I will look at it some more tonight. My time to work on Marlin has been a bit limited lately, but I should be able to do more testing and post some updates this weekend!

thinkyhead commented 9 years ago

@lrpirlet I have committed your fix to https://github.com/thinkyhead/Marlin/archive/debug_G29.zip so feel free to give it a try and see that the order of movement, plus the values it spits out are correct. I'd like to see others try this fix also, so I will soon make a PR with this patch against the main branch.

thinkyhead commented 9 years ago

@lrpirlet Could you also try the solution that I proposed (days ago) to apply zprobe_zoffset in axis_is_at_home – which should fix all issues where calling axis_is_at_home(Z_AXIS) would give the wrong value if you had a servo probe. That PR, #1925 should eliminate the need to add the code in your fix above, but axis_is_at_home will need to be called at the right time, probably before the #ifdef Z_DUAL_ENDSTOPS and #ifdef DELTA blocks instead of afterward!

lrpirlet commented 9 years ago

@thinkyhead. I just got back home today 21:30, so I will test tomorow the solution that you proposed. I will apply zprobe_zoffset in axis_is_at_home... Since the development branch does include that PR #1925, I will then work from that base...

thinkyhead commented 9 years ago

@lrpirlet I look forward to hearing how it alters things… hopefully in a good way! :four_leaf_clover:

lrpirlet commented 9 years ago

The homeaxis function may be seen as follow. It is only invoked when the position of the Hot-End Tip is unknown. The sync_plan_position should be invoked at least 2 times. Once after endstop triggered at “high speed”, once after endstop triggered at “low speed”…

Let us concentrate on sync_plan_position only…

/**
 * Home an individual axis
 */

static void homeaxis(AxisEnum axis) {

code removed

    // Set the axis position as setup for the move
    current_position[axis] = 0;
    sync_plan_position();

    // Engage Servo endstop if enabled

code removed

    // Move towards the endstop until an endstop is triggered

code removed

    // Set the axis position as setup for the move
    current_position[axis] = 0;
    sync_plan_position();

    // Move away from the endstop by the axis HOME_BUMP_MM

code removed

    // Slow down the feedrate for the next move

code removed

    // Move slowly towards the endstop until triggered
    destination[axis] = 2 * home_bump_mm(axis) * axis_home_dir;

code removed

    #ifdef Z_DUAL_ENDSTOPS
      if (axis == Z_AXIS) {

code removed

        sync_plan_position();

code removed

    #endif

    #ifdef DELTA
      // retrace by the amount specified in endstop_adj
      if (endstop_adj[axis] * axis_home_dir < 0) {
        sync_plan_position();

code removed

      }
    #endif

    // Set the axis position to its home position (plus home offsets)
    axis_is_at_home(axis);

code removed

    // Retract Servo endstop if enabled

code removed

So we DO NOT ALWAYS sync_plan_position after endstop triggered at “low speed”…

FOR a cartesian printer like my prusa i3, I GUESS that it should not matter too much for X and Y axis. The precision needed is in the order of .2 mm.

For the Z axis, this is a different story: to get a good adhesion, to get a nice looking first layer, I need a precision of about .02 mm, I absolutely need a sync_plan_position after endstop triggered at “low speed”…


OK, let’s examine the axis_is_at_home function. It is called ONLY inside Marlin_main.cpp ( I use the development file, modified date is 25/04/2015 12:26).

The function itself is located Line 975

T0-T3 calls axis_is_at_home(X_AXIS); at line 4728, it is followed at line 4760 by sync_plan_position

G28 calls it twice for the X and for the Y axis… Line 1905-1907

        axis_is_at_home(X_AXIS);
        axis_is_at_home(Y_AXIS);
        sync_plan_position();

Homeaxis calls axis_is_at_home(axis); function at line 1594, it is NOT followed by sync_plan_position. We have already discussed that.

What I remark here is that the axis_is_at_home(Z_AXIS) is NEVER invoked. I see NO particular advantage or disadvantage to include the Z axis in the axis_is_at_home() function.

Now, when Homeaxis calls axis_is_at_home(axis); function, we KNOW that the Hot-End Tip is exactly at zprobe_zoffset from the bed. We need to change line 1038 so that we reflect that absolute value.

So, the modifications I do bring to the Marlin_main.cpp to make it work, for my Prusa I3 are:

Line 1037-1039

    #if defined(ENABLE_AUTO_BED_LEVELING) && Z_HOME_DIR < 0
      if (axis == Z_AXIS) current_position[Z_AXIS] = zprobe_zoffset;    //lrp if (axis == Z_AXIS) current_position[Z_AXIS] += zprobe_zoffset;
    #endif

Line 1593-1595

    // Set the axis position to its home position (plus home offsets)
    axis_is_at_home(axis); sync_plan_position();    //lrp this works for me all right, BUT DOES IS WORK FOR other printers??? does line 1596 still make sense? 

This is where it becomes too complicated for me… It certainly work great for MY printer. Does it work for others such as Delta or SCARA? We MAY still have some axis that were NOT set using the slow speed… (I am not sure to understand the “if” in the delta and in the Z_DUAL_ENDSTOPS).

What if someone sets a home_offset in the Z axis ( I do not), could we add this offset and read, in the axis_is_at_home something like

    #if defined(ENABLE_AUTO_BED_LEVELING) && Z_HOME_DIR < 0
      if (axis == Z_AXIS) current_position[Z_AXIS] = zprobe_zoffset + home_offset[axis];    
    #endif

Sorry… I am working at the edge of my understanding…

lrpirlet commented 9 years ago

@thinkyhead Sorry for that long previous message. I guess I needed to explain in order to understand.

I kept thinking about all my doubts... and I guess I made too many changes...

I have removed the changes I made in axis_is_at_home and reverted to the original. I kept the addition of sync_plan_position(); at line 1594. I get the same good results, that is: G28 ends with the display showing Z=10.3 mm.... that is Z_PROBE_OFFSET_FROM_EXTRUDER (-2.33) + Z_RAISE_AFTER_PROBING (8). I then issue G1 Z0 and that brings the Hot-End just above the bed at a sheet of paper height (same friction as when I did measure the Z_PROBE_OFFSET_FROM_EXTRUDER...)

So, the minimal modification needed is to introduce sync_plan_position(); after return from axis_is_at_home. Line 1593-1595

    // Set the axis position to its home position (plus home offsets)
    axis_is_at_home(axis); sync_plan_position();    //lrp this works for me all right, BUT DOES IS WORK FOR other printers??? does line 1596 still make sense? 

Now, do not ask me where and how I should introduce it so that it does not perturb other printers...

MoonshineSG commented 9 years ago

has the code to raise the Z axis for M401 and M402 when needed been added to the devel branch ? With the latest firmware I get the probe raising at each M401 and M402 regardless of Z position...

thinkyhead commented 9 years ago

_What I remark here is that the axis_is_at_home(ZAXIS) is NEVER invoked. @lrpirlet Actually axis_is_at_home(Z_AXIS) is invoked at the line 1593 you mentioned, whenever there's a homeaxis(Z_AXIS) or a HOMEAXIS(Z), so of course it helps to account for the probe distance in axis_is_at_home so the Z value won't need any additional correction afterward.

I think you are correct about the planner being out of sync. So that line is definitely going in! #1986

davbardi commented 9 years ago

I'm attempting to auto bed level with a servo mounted z probe on a home made COREXY printer (which still needs some tuning) and I'm getting the issue where the printer head is starting too high. I've noticed the more out of level the bed the higher the head error above the bed (I have glass plates and can create make the bed very unlevel by putting a pencil under one side). Auto levelling appears to be fundamentally working (apart from the level error) as I can clearly see the X-axis change as the head moves (very obvious with the pencil!). Another point I noticed is if PROBE_SERVO_DEACTIVATION_DELAY 300 is defined then (quite unexpectedly) the error gets much larger. The hotend is also lifting a lot more between each bed probe during the G29. Here the verbose responses from G29 V4 for the "pencil-lifted" bed. My probe offset is -2.16mm

This is with PROBE_SERVO_DEACTIVATION_DELAY not defined (giving a head height approx. 5.2mm too high):

 20:15:46.856 : +-----------+
 20:15:46.856 : |...Back....|
 20:15:46.856 : |Left..Right|
 20:15:46.856 : |...Front...|
 20:15:46.856 : +-----------+
 20:15:46.856 : +2.90938 +3.25938
 20:15:46.872 : -3.17812 -2.99062
 20:15:46.872 : planeNormal x: -0.002337 y: -0.041125 z: 1.000000
 20:15:46.872 : 
 20:15:46.872 : Bed Level Correction Matrix:
 20:15:46.872 : +0.999997 +0.000000 +0.002337
 20:15:46.872 : -0.000096 +0.999155 +0.041090
 20:15:46.872 : -0.002335 -0.041090 +0.999153

This is with PROBE_SERVO_DEACTIVATION_DELAY defined (giving a head height approx. 11.4mm too high):

 20:10:46.525 : +-----------+
 20:10:46.525 : |...Back....|
 20:10:46.525 : |Left..Right|
 20:10:46.525 : |...Front...|
 20:10:46.525 : +-----------+
 20:10:46.541 : +2.91250 +3.06250
 20:10:46.541 : -3.05000 -2.92500
 20:10:46.541 : planeNormal x: -0.001196 y: -0.039833 z: 1.000000
 20:10:46.541 : 
 20:10:46.541 : Bed Level Correction Matrix:
 20:10:46.541 : +0.999999 +0.000000 +0.001196
 20:10:46.541 : -0.000048 +0.999208 +0.039802
 20:10:46.541 : -0.001195 -0.039802 +0.999207

I've added in the sync_plan_position(); as mentioned by @lrpirlet - this does stop the extra error happening now when PROBE_SERVO_DEACTIVATION_DELAY is defined, but not the initial error.

I'm no coder, but hopefully these observations help towards finding the error.

Wurstnase commented 9 years ago

I've added the latest PR to my fork.

When I home with G28 my nozzle is approx. -0.25mm from my sensor. This looks ok. After a simple G29 P2 it's -0.8. This seems to be too much.

lrpirlet commented 9 years ago

Thanks, that was fun, even if I had not enough time to my taste… and a great C++ learning experience…

If/when I can reproduce a problem on my printer, I'll be glad to help… (not be in the two coming weeks however, I will be really too busy).

De : Scott Lahteine [mailto:notifications@github.com] Envoyé : mardi 28 avril 2015 05:56 À : MarlinFirmware/Marlin Cc : lrpirlet Objet : Re: [Marlin] strange auto level behaviour... (#1769)

What I remark here is that the axis_is_at_home(Z_AXIS) is NEVER invoked. @lrpirlet https://github.com/lrpirlet Actually axis_is_at_home(Z_AXIS) is invoked at the line 1593 you mentioned, whenever there's a homeaxis(Z_AXIS) or a HOMEAXIS(Z), so of course it helps to account for the probe distance in axis_is_at_home.

I think you are correct about the planner being out of sync. So that line is definitely going in! #1986 https://github.com/MarlinFirmware/Marlin/pull/1986

— Reply to this email directly or view it on GitHub https://github.com/MarlinFirmware/Marlin/issues/1769#issuecomment-96902457 . https://github.com/notifications/beacon/ALEmPY6wjkqlcu8ivFMG_D6c3bHdJi49ks5oDvxogaJpZM4D4Plk.gif

thinkyhead commented 9 years ago

@Wurstnase I feel we are getting closer, and there are only one or two illogical points to clear up.

For example, I notice that stow_z_probe always does a Z_RAISE_AFTER_PROBING move for servo probes. But, M402 does its own Z_RAISE_BEFORE_HOMING move before calling stow_z_probe – which I assume results in the probe being too high, if not out-of-sync with the position.

I believe G28 is working pretty well now, including for deltas, where the Z was being set incorrectly. That needed to be fixed first, to make sure we had a solid starting point for G29. So the last bits to clear up seem to be:

I am wondering how to interpret the Z_RAISE_... values going forward. It actually may be more convenient to rename them Z_CLEARANCE_... and make them the destination height for each action, instead of having them add to the current position (except when the current position is unknown). Then the moves could be made to happen only when the Z position was below that height (minus the zprobe_zoffset).

Wurstnase commented 9 years ago

Found something.

starting next point

Roxy-3D commented 9 years ago

I am wondering how to interpret the ZRAISE... values going forward. It actually may be more convenient to rename them ZCLEARANCE... and make them the destination height for each action, instead of having them add to the current position (except when the current position is unknown). Then the moves could be made to happen only when the Z position was below that height (minus the zprobe_zoffset).

This makes a certain amount of sense. The biggest argument for not doing it this way is the whole existing code base was done from the other perspective. And actually... The bulk of these Z_RAISE items were added incrementally to handle this and that type of problem. They were not really carefully thought out in advance.

thinkyhead commented 9 years ago

@Wurstnase Inside of probe_pt try commenting out the block that begins #if Z_RAISE_BETWEEN_PROBINGS > 0. I believe that doesn't belong there, since Z_RAISE_BETWEEN_PROBINGS is already being passed and acted-upon at the beginning of probe_pt.

MoonshineSG commented 9 years ago

has this been finalised ?