Dev2: G30 always homes first

Hi,
I do homing for all three axis. Then I move to a position where I want to check my z-probe.
I enter G30 or G30 X35 Y100 (they give the same result)

I expect:
 - Servo turns
 - probe moves down to the bed and measures the trigger position.
 - servo turns back

Why I expect it:
https://www.reprap.org/wiki/G-code#G30:_Single_Z-Probe (I know, it is the description of REPRAP-firmware; I think it should be the same)

What I get:
 - Machine homes
 - Servo turns
 - machine moves the value given at "z-probe xaxis offset" (it does not move to the X35 Y100 position)
 - it moves down (because this position is not allowed I reset my machine)

My config:
#define Z_PROBE_TYPE Z_PROBE_TYPE_DEFAULT 
//#define Z_PROBE_TYPE Z_PROBE_TYPE_NONE
#define Z_PROBE_HEIGHT 3             // Distance bed-nozzle when trigger switches servo
#define Z_PROBE_BED_DISTANCE 5      // Optimal starting distance
#define Z_PROBE_SPEED 5              // Speed fo z testing
#define Z_PROBE_X_OFFSET 0           // x offset relative to extruder 0,0 offset
#define Z_PROBE_Y_OFFSET 26          // y offset relative to extruder 0,0 offset
#define Z_PROBE_COATING 0            // Coating thickness if not detected by probe
#define Z_PROBE_DELAY 0              // Extra delay before starting again. Only needed on electronic probes keeping state for a while
#define Z_PROBE_REPETITIONS 2        // How often should we probe, 1 is minimum
#define Z_PROBE_USE_MEDIAN 1         // 0 = use average, 1 = use middle value after ordering z
#define Z_PROBE_SWITCHING_DISTANCE 2 // Minimum distance required to safely untrigger probe - used for faster repeated measurement
#define Z_PROBE_BORDER 0             // Safety border to ensure position is allowed
#define Z_PROBE_PAUSE_HEATERS 0      // Pause all heaters when probing to reduce EMI artifacts
#define Z_PROBE_START_SCRIPT "M340 P0 S1200 R500"
#define Z_PROBE_FINISHED_SCRIPT "M340 P0 S1900 R500"
#define Z_PROBE_RUN_AFTER_EVERY_PROBE ""
and two lines which I don't understand
#define ZPROBE_HEIGHT_ROUTINE
#define ZPROBE_REF_HEIGHT 5.97
«1

Comments

  • No, our implementation differs from RepRapFirmware implementation. See main.cpp

    - G30 P<0..3> - Single z-probe at current position P = 1 first measurement, P = 2 Last measurement P = 0 or 3 first and last measurement
    - G30 H<height> R<offset> Make probe define new Z and z offset (R) at trigger point assuming z-probe measured an object of H height.

    So you need to run a G1 X Y Z pos first and then run G30.

    #define ZPROBE_HEIGHT_ROUTINE
    #define ZPROBE_REF_HEIGHT 5.97
    are not used at all. Just delete them. I think they are leftovers from V1 configuration.
  • Ok, I tried G30 P1. The description is the same as above. It homes, than moves the distance given in "z-probe xaxis offset" and moves down. But it is not performing a probe at the position where it is/was, so not at the current position.

    I do not fully understand what a P0..3 are doing.
    Is this correct?
    - With single probe a single position in x/y is meant.
    - This single probe can contain severeal measurements defined by Z_PROBE_REPETITIONS
    - P1 is the first of the repetitions and P2 the last, where the difference where the probe starts (P1 at the standard level) and P2 a measurement after travelling back the "Z_PROBE_SWITCHING_DISTANCE" distance?

    I did not know that I can find the command in the main.cpp, thanks for that hint!
  • P values are about activating/deactivating probe. Add 1 for activate and 2 for deactivate. 0 is don't change activation state. Omitting is 3 = activate, measure and deactivate.
    It is always measured and current position if allowed. I just uploaded a fix for allowed position computation. Close to borders math was wrong.

    It does Z_PROBE_REPETITIONS measurements at that position and in between it goes Z_PROBE_SWITCHING_DISTANCE up before retesting. Then it returns the median or average result depending on configuration.
  • I downloaded the complete files from github. Than I put back my config files, compile and run as above.

    It is still homing first.

    During compilation I do get plenty of warnings. Here are the first ones:
    In file included from src\Repetier.h:220,
                     from src\Configuration.cpp:29:
    src\Configuration.h:441: warning: "Z_PROBE_BORDER" redefined
      441 | #define Z_PROBE_BORDER 0             // Safety border to ensure position is allowed
          | 
    In file included from src\Repetier.h:220,
                     from src\Configuration.cpp:29:
    src\Configuration.h:73: note: this is the location of the previous definition
       73 | #define Z_PROBE_BORDER 2             // Safety border to ensure position is allowed
          | 
    In file included from src/Repetier.h:220,
                     from src\PrinterTypes\PrinterTypeCartesian.cpp:19:
    src/Configuration.h:441: warning: "Z_PROBE_BORDER" redefined
      441 | #define Z_PROBE_BORDER 0             // Safety border to ensure position is allowed


    I removed a doubled definition in the configuration.h. The doubled definition can be found in the git file, too.

    The behaviour is still the same.

  • Maybe we need to start earlier. G30 does not home at all
    What I get:
     - Machine homes
     - Servo turns
     - machine moves the value given at "z-probe xaxis offset" (it does not move to the X35 Y100 position)
     - it moves down (because this position is not allowed I reset my machine)

    I assumed you homed first and then you send G30. G30 does not move to any position - it probes where you are only the offset for z probe is added. You should make sure it is only called above the bed. Firmware just checks if it is inside allowed coordinates.

    If this is the probing for z min during regular home you need to provide a xy position where to do z home operation.
    #define FIXED_Z_HOME_POSITION 1
    #define ZHOME_X_POS 50
    #define ZHOME_Y_POS 50

    Then it will home over bed and not at wrong position.
  • edited October 2020
    Repetier said:

    I assumed you homed first and then you send G30. G30 does not move to any position - it probes where you are only the offset for z probe is added. You should make sure it is only called above the bed. Firmware just checks if it is inside allowed coordinates.

    If this is the probing for z min during regular home you need to provide a xy position where to do z home operation.
    #define FIXED_Z_HOME_POSITION 1
    #define ZHOME_X_POS 50
    #define ZHOME_Y_POS 50

    Then it will home over bed and not at wrong position.
    Yes, I home first and move to the position. It is exactly the problem, that it homes and then moves by the offset.
    Yes, I do expect it NOT to move in x/y. But instead it is performing a home x,y and then performing a z-probe.

    The position was over the bed. Anyway I do not expect it to perform a home x,y when it is not over the bed.

    In general:
    1. Homing works fine now.
    2. I want to get the bed levelling working.
       a) The first test it to check if the probe works by hitting it by hand. It works.
       b) Second step is to perform a G30 at a known position. This is what is not working. It homes first and moves to a wrong position, namely homeposition - offset
       c) Next step would be to define the distance bed / nozzle using G30 and manual tests.
       d) Last step would be to make G32 working.

    Vielleicht mal besser kurz auf deutsch, vielleicht ist meine Englisch einfach zu schlecht:

    Es ist exakt das Problem, dass ich eigentlich erwarte, dass mit G30 einfach ein einzelner Punkt mit der z-Sonde ausgemessen wird. Stattdessen wird ein Home durchgeführt und von dort aus um den offset verschoben gemessen.

    #define FIXED_Z_HOME_POSITION 0
    #define ZHOME_X_POS 140
    #define ZHOME_Y_POS 45

  • wenn x oder y nicht gehomed sind führt er ein homing von x und y durch.
    siehe hier:

    void ZProbeHandler::activate() {
        if (activated) {
            return;
        }
        // Ensure x and y positions are valid
        if (!Motion1::isAxisHomed(X_AXIS) || !Motion1::isAxisHomed(Y_AXIS)) {
            Motion1::homeAxes((Motion1::isAxisHomed(X_AXIS) ? 0 : 1) + (Motion1::isAxisHomed(Y_AXIS) ? 0 : 2));
        }
        float cPos[NUM_AXES];
        Motion1::copyCurrentOfficial(cPos);
        PrinterType::closestAllowedPositionWithNewXYOffset(cPos, offsetX, offsetY, Z_PROBE_BORDER);
        Motion1::moveByOfficial(cPos, Motion1::moveFeedrate[X_AXIS], false);
        GCode::executeFString(Com::tZProbeStartScript);
        Motion1::moveByOfficial(cPos, Motion1::moveFeedrate[X_AXIS], false);
        Motion1::setToolOffset(-offsetX, -offsetY, 0);
        activated = true;
    }

    dann verhält es sich so wie du beschrieben hast.
    Die Frage ist nur warum er bei Dir trotz homing x und/oder y als nicht gehomed sieht.
    falls Du ein Display drann hast müsste das ja an den koordinaten ersichtlich sein

  • Ok I see homing in G30 is a bad idea. It should just block the operation with an error message when xy is not homed. It makes no sense to home first which looses the position and then measure a point where we are not interested.
  • I would even not block the operation. Or at least give a parameter like "G30 S1" to allow an override of the blocking.

  • edited October 2020
    RAyWB said:

    Die Frage ist nur warum er bei Dir trotz homing x und/oder y als nicht gehomed sieht.
    falls Du ein Display drann hast müsste das ja an den koordinaten ersichtlich sein


    The display shows the right values, but switches every second to ????.?? for all three axis, which seems to be the hint, that the position might be not calibrated.

    Deleting the following lines makes it work as expected.
    // Ensure x and y positions are valid
        if (!Motion1::isAxisHomed(X_AXIS) || !Motion1::isAxisHomed(Y_AXIS)) {
            Motion1::homeAxes((Motion1::isAxisHomed(X_AXIS) ? 0 : 1) + (Motion1::isAxisHomed(Y_AXIS) ? 0 : 2));
        }

    The following warnings might be the problem of the homing. Maybe the cold extrusion protection triggers a "position not calibrated"?
    Here is the log file of the communication:
    Send:11:55:06.791: N28 G28
    Recv:11:55:06.791: Info:Autoleveling disabled
    Recv:11:55:06.791: X:235.00 Y:100.00 Z:149.000 E:0.0000
    Recv:11:55:23.231: Info:Autoleveling disabled
    Recv:11:55:23.232: X:-65.00 Y:400.00 Z:159.000 E:0.0000
    Recv:11:55:23.232: Warning:Cold extrusion prevented (2)
    Recv:11:55:23.232: SelectTool:0
    Recv:11:55:23.232: Warning:Move to illegal position prevented! Position should not be trusted any more!
    Recv:11:55:23.233: Warning:Cold extrusion prevented
    Recv:11:55:23.233: X:-65.00 Y:400.00 Z:160.000 E:0.0000
    Send:11:55:40.917: N29 G1 X35.00 F2400
    Recv:11:55:40.917: Warning:Cold extrusion prevented
    Send:11:55:41.703: N30 G1 X135.00 F2400
    Recv:11:55:41.703: Warning:Cold extrusion prevented
    Send:11:55:43.160: N31 G1 X235.00 F2400
    Recv:11:55:43.160: Warning:Cold extrusion prevented
    Send:11:55:44.182: N32 G1 Y300.00 F2400
    Recv:11:55:44.182: Warning:Cold extrusion prevented
    Send:11:55:44.669: N33 G1 Y200.00 F2400
    Recv:11:55:44.669: Warning:Cold extrusion prevented
    Send:11:56:00.981: N34 G30 P1
    Recv:11:56:00.981: Warning:Cold extrusion prevented (2)
    Recv:11:56:00.982: X:235.00 Y:200.00 Z:160.000 E:0.0000
    Recv:11:56:30.340: Warning:Cold extrusion prevented (3)
    Recv:11:56:47.202: X:235.00 Y:200.00 Z:160.000 E:0.0000
    Recv:11:56:47.202: Z-probe:149.073 X:235.00 Y:200.00
  • Yes,

    Recv:11:55:23.232: SelectTool:0
    Recv:11:55:23.232: Warning:Move to illegal position prevented! Position should not be trusted any more!
    
    is a problem. Selecting tool 0 causes a illegal position which invalides homing.
    Is this with a version from today since I fixed some position handling stuff yesterday. If it is I need to do some tests. After homing all tools must be selectable or homing would have failed.
    What are your tool offsets and homing directions?
  • The last changes were Fix closestPosition, fix servo off for STM32 boards. After that I downloaded from github.

    My Offsets are x:-108, y:-8
    Homing direction:
    x to negative
    y to positive
    z to positive
  • edited October 2020
    x offset -108mm ?

    which offset are you talking about?

    may be a sketch would be useful
  • edited October 2020
    Repetier said:
    Yes,

    Recv:11:55:23.232: SelectTool:0
    Recv:11:55:23.232: Warning:Move to illegal position prevented! Position should not be trusted any more!
    
    is a problem. Selecting tool 0 causes a illegal position which invalides homing.
    Is this with a version from today since I fixed some position handling stuff yesterday. If it is I need to do some tests. After homing all tools must be selectable or homing would have failed.
    What are your tool offsets and homing directions?
    Strange beahaviour:
    I downloaded a few moments ago the latest version from github.
    First try:
    - There is no warning after homing, in the display the position does not change every second to ????.??
    - G30 P1 works now as expected: It moves by the offset and makes a probe at the position of the nozzle. At the end it moves up, but does not undo the offset-movement.
    - G30 P3 does the probing and then brings the nozzle to the original position.
    --> Combination of G30 p1 and G30 P3 makes sense.
    - G32 S2 was succesfull, with correct positions and so on. Anyway it started its procedure with a homing, even though my printer was homed.

    Second try:
    - Warning after homing
    - Printer goes to wrong positions when trying to G32 S2. Need to stop machine due to risk of damage.
    --> It looks like it moves the nozzle to the first position, than

    Third try: disconnect all electronics, wat some seconds, try again:
    - result like in second try.

    Fourth try:
    - re-upload firmware (but not changing EEPROM)
    - result like second try

    Logfile:

    Send:21:48:50.953: N15 M117 192.168.137.1:3344
    Send:21:48:50.953: N16 M155 S1
    Send:21:48:50.953: N17 M415
    Recv:21:48:50.953: RESCUE_STATE: OFF
    Send:21:49:05.902: @getip
    Send:21:49:05.916: N18 M117 192.168.137.1:3344
    Send:21:49:21.382: N19 G28
    Recv:21:49:21.382: Info:Autoleveling disabled
    Recv:21:49:21.382: X:0.00 Y:0.00 Z:0.000 E:0.0000
    Recv:21:49:29.269: Info:Autoleveling enabled
    Recv:21:49:29.269: X:-64.91 Y:400.18 Z:158.832 E:0.0000
    Recv:21:49:29.347: SelectTool:0
    Recv:21:49:29.347: Warning:Move to illegal position prevented! Position should not be trusted any more!
    Recv:21:49:29.347: X:-65.00 Y:400.10 Z:160.458 E:0.0000
    Send:21:49:38.853: N20 G32 S2
    Recv:21:49:38.853: X:-65.09 Y:400.02 Z:160.625 E:0.0000
    Recv:21:49:38.853: Info:Autoleveling disabled
    Recv:21:49:38.853: X:-65.09 Y:400.02 Z:160.625 E:0.0000
    Recv:21:49:42.534: Info:Autoleveling disabled
    Recv:21:49:42.534: X:-65.00 Y:400.10 Z:159.000 E:0.0000
    Recv:21:49:42.624: SelectTool:0
    Recv:21:49:42.625: Warning:Move to illegal position prevented! Position should not be trusted any more!
    Recv:21:49:42.625: X:-65.00 Y:400.10 Z:160.458 E:0.0000
    Recv:21:49:49.498: Info:Autoleveling disabled
    Recv:21:49:49.498: X:15.00 Y:280.00 Z:20.000 E:0.0000
    Recv:21:49:56.087: Info:Autoleveling disabled
    Recv:21:49:56.087: X:-65.00 Y:400.10 Z:20.000 E:0.0000 (2)
    Mesg:21:49:58.992: Connection closed by os.


    I am totally confused, sorry.

    edit: I am using my old configuration.h , not the cleaned up version from github
  • First G30 P3 is what you want. That activates offset before probing and deactivates it afterwards.

    Please send
    M111 S7
    first and then try homing and post log. That will make the firmware output the position that it did not like. I think it is easier to follow when we see which "illegal move" gets prevented. Reported position is in transformed coordinates so offsets and rotation corrections are subtracted already. With some bad luck it is just a rounding error.

  • edited October 2020
    Sure, here it is with "endstop distance after moving" for all axis with positive value 10mm:

    Send:15:23:41.118: N48 G28
    Recv:15:23:41.118: Info:Autoleveling disabled
    Recv:15:23:41.118: X:-65.09 Y:399.92 Z:159.167 E:0.0000
    Recv:15:23:45.488: Info:Autoleveling enabled
    Recv:15:23:45.489: X:-64.91 Y:400.08 Z:158.833 E:0.0000
    Recv:15:23:45.566: SelectTool:0
    Recv:15:23:45.567: Warning:Move to illegal position prevented! Position should not be trusted any more!
    Recv:15:23:45.567: XT:-65.00 YT:400.00 ZT:161.00
    Recv:15:23:45.567: X:-65.00 Y:400.00 Z:159.000 E:0.0000
    Recv:15:23:45.567: Echo:N48 G28 

    here it is with "endstop distance after moving" for all axis with values 0mm

    Send:15:25:17.029: N52 G28
    Recv:15:25:17.029: Info:Autoleveling disabled
    Recv:15:25:17.029: X:-65.09 Y:399.92 Z:159.167 E:0.0000
    Recv:15:25:20.489: Info:Autoleveling enabled
    Recv:15:25:20.489: X:-64.91 Y:400.08 Z:158.833 E:0.0000
    Recv:15:25:20.656: SelectTool:0
    Recv:15:25:20.656: Warning:Move to illegal position prevented! Position should not be trusted any more!
    Recv:15:25:20.656: XT:-65.00 YT:400.00 ZT:161.00
    Recv:15:25:20.657: X:-65.00 Y:400.00 Z:159.000 E:0.0000
    Recv:15:25:20.657: Echo:N52 G28 


    here it is with "endstop distance after moving" for all axis with positive value 110mm (to be be larger than the offset of my probe)

    Send:15:26:30.889: N56 G28
    Recv:15:26:30.889: Info:Autoleveling disabled
    Recv:15:26:30.889: X:-65.09 Y:399.92 Z:159.167 E:0.0000
    Recv:15:26:41.534: Info:Autoleveling enabled
    Recv:15:26:41.534: X:-64.91 Y:400.08 Z:158.833 E:0.0000
    Recv:15:26:41.611: SelectTool:0
    Recv:15:26:41.611: Warning:Move to illegal position prevented! Position should not be trusted any more!
    Recv:15:26:41.611: XT:-65.00 YT:400.00 ZT:161.00
    Recv:15:26:41.612: X:-65.00 Y:400.00 Z:159.000 E:0.0000
    Recv:15:26:41.612: Echo:N56 G28 


    edit:

    my configuration_io.h : https://drive.google.com/file/d/1ojh8FUHkGysqlGV3lRRV2RvNh_cOHltA/view?usp=sharing
    my configuration.h: https://drive.google.com/file/d/1XqM3yM__EYSHn7kTJCIbPa9DbH9lV_4A/view?usp=sharing

    edit2:

  • Ok now it is clear why. You home z max and z max is 159. But you also have
    #define RAISE_Z_ON_TOOLCHANGE 2
    so when selecting tool it raises 2 mm to 161 which is higher then z max and is illegal.

    I have updated github and now limit z on toolchange to z max. Hope that solves it.
  • edited October 2020
    I downloaded the new version and replaced configuration.h and configuration_io.h by my old versions.

    --> problem is still existing
    Send:18:22:00.930: N24 G28
    Recv:18:22:00.930: Info:Autoleveling disabled
    Recv:18:22:00.930: X:-65.09 Y:399.92 Z:159.167 E:0.0000
    Recv:18:22:03.745: Info:Autoleveling enabled
    Recv:18:22:03.745: X:-64.91 Y:400.08 Z:158.833 E:0.0000
    Recv:18:22:03.855: SelectTool:0
    Recv:18:22:03.910: Warning:Move to illegal position prevented! Position should not be trusted any more!
    Recv:18:22:03.910: XT:-65.00 YT:400.00 ZT:159.17
    Recv:18:22:03.910: X:-65.00 Y:400.00 Z:159.000 E:0.0000
    Recv:18:22:03.910: Echo:N24 G28 

    changing  #define RAISE_Z_ON_TOOLCHANGE 0
    results in

    Send:18:24:20.054: N20 G28
    Recv:18:24:20.054: Info:Autoleveling disabled
    Recv:18:24:20.054: X:0.00 Y:0.00 Z:0.000 E:0.0000
    Recv:18:24:22.922: Info:Autoleveling enabled
    Recv:18:24:22.922: X:-64.91 Y:400.08 Z:158.833 E:0.0000
    Recv:18:24:23.031: SelectTool:0
    Recv:18:24:23.086: Warning:Move to illegal position prevented! Position should not be trusted any more!
    Recv:18:24:23.087: XT:-65.00 YT:400.00 ZT:159.17
    Recv:18:24:23.087: X:-65.00 Y:400.00 Z:159.000 E:0.0000
    Recv:18:24:23.087: Echo:N20 G28 
    edit: where I assume, that the 159.17 has something to do with a value from the auto bed level, maybe the one measured at the end of the G32? Where is it stored?
  • We are at least getting better. It has already removed the 2 extra millimeter. Now question is why 159.17 also in that case the official Z is what is taken not the transformed one. Reason is transformed changes depending on xy position due to rotation.

    Looking configuration I see
    #define ENDSTOP_Z_BACK_ON_HOME 0

    That should be a value higher then max. rotation of bed, so maybe 2mm when you are good leveled. And z max must then reduced by that value. Reason is otherwise moving xy at zmax could trigger z max end stop. On the other side I'm quite sure I added a safety margin when calculating the rotation so it should add the extra margin even with 0. But a small safety is never wrong here.

    Will check tomorrow more closely into the problem.
  • edited October 2020
    I assume, that ENDSTOP_Z_BACK_ON_HOME 2 is the same like setting in the EEPROM "z axis distance after homing =2". In addition to reducing z-axis max position by 2, so to 157 it gives the following:

    Send:20:07:46.379: N31 G28
    Recv:20:07:46.379: Info:Autoleveling disabled
    Recv:20:07:46.379: X:-65.09 Y:399.92 Z:149.167 E:0.0000
    Recv:20:07:49.576: Info:Autoleveling enabled
    Recv:20:07:49.576: X:-64.91 Y:400.08 Z:158.833 E:0.0000
    Recv:20:07:49.653: SelectTool:0
    Recv:20:07:49.653: Axis failed:1
    Recv:20:07:49.654: Warning:Move to illegal position prevented! Position should not be trusted any more!
    Recv:20:07:49.654: XT:-65.00 YT:400.00 ZT:157.17
    Recv:20:07:49.654: X:-65.00 Y:400.00 Z:157.000 E:0.0000
    Recv:20:07:49.654: Echo:N31 G28 
    Changing both by 10 gives:

    Send:20:09:20.187: N34 G28
    Recv:20:09:20.187: Info:Autoleveling disabled
    Recv:20:09:20.187: X:-65.09 Y:399.92 Z:157.167 E:0.0000
    Recv:20:09:23.773: Info:Autoleveling enabled
    Recv:20:09:23.773: X:-64.91 Y:400.08 Z:158.833 E:0.0000
    Recv:20:09:23.882: SelectTool:0
    Recv:20:09:23.882: Axis failed:1
    Recv:20:09:23.883: Warning:Move to illegal position prevented! Position should not be trusted any more!
    Recv:20:09:23.883: XT:-64.99 YT:400.01 ZT:149.17
    Recv:20:09:23.883: X:-65.00 Y:400.00 Z:149.000 E:0.0000
    Recv:20:09:23.883: Echo:N34 G28 
    The problem seems to be, that by homing to positive z values, the actual value is always the z-max-value. Than there might be some correction, which is always above that value. This problem would not appear, if i would level to z=0mm. Seems to be a speciality of homing to z-max.

    By the way: This problem did NOT exists in the 0.9x version using my rumba(no 32) board.

    edit: is that safety this one?
    #define Z_PROBE_BORDER 1             // Safety border to ensure position is allowed

    edit 2: Thanks for your intense help!!!
  • Could you try if the problem also exists if autolevel is disabled? Then I know I have to look into the z correction where I  think the problem now lies.

    Z_PROBE_BORDER is used to measure testable area on bed. Lets say you x is -65 ... 458 but bed is 0...400. Now if you have induction probe you can not probe at the edge x=0 - that gives different heights then with more metal below sensor. So Z_PROBE_BORDER reduces bed size by that distance to assure probe is far enough on bed.
  • edited October 2020
    I changed in EEPROM via repetier server the "auto level active" value from 1 to 0.
    Result:

    Send:11:11:58.600: N21 G28
    Recv:11:11:58.600: Info:Autoleveling disabled
    Recv:11:11:58.600: X:35.00 Y:0.00 Z:160.000 E:0.0000
    Recv:11:12:12.613: Info:Autoleveling disabled
    Recv:11:12:12.613: X:-65.00 Y:400.00 Z:159.000 E:0.0000
    Recv:11:12:12.776: SelectTool:0
    Recv:11:12:13.014: X:-65.00 Y:400.00 Z:160.000 E:0.0000

    Positions are not flashing ????.??.
    edit: I switched all the "distance after homing" to 0 to understand better where movements come from.
  • There is also a command to deactivate autolevel:
    - M320 S<0/1> - Activate auto level, S1 stores it in eeprom
    - M321 S<0/1> - Deactivate auto level, S1 stores it in eeprom

    So it is in deed coming from the transformation. So only question is where and why. I think I need to go down a bit after homing to the real 159mm for current xy position. Will check if that happens or not.
  • I thought I already did it, but only NOW I have set
    #define RAISE_Z_ON_TOOLCHANGE 0 (it was 2mm)
    So if in my upper post something was misleading, it is my fault. Sorry for that.

    In addition I changed
    #define ZHOME_HEIGHT 160 (it was 159)

    After the complete homing there is a small movement upards. Like it is moving downwards for x/y homing and then goes back.


    #define ZHOME_PRE_RAISE 0
    I do not any setting which says "move away from end stop when homing". Only the distances after homing, which all are set to 0 mm.





  • edited October 2020
    search for:

    #define ENDSTOP_X_BACK_ON_HOME 2
    #define ENDSTOP_Y_BACK_ON_HOME 2
    #define ENDSTOP_Z_BACK_ON_HOME 2

    these are the settings for moving back  from endstop after homing.
    guess you have set them to 0

    the back move when homing is this:(used during homing for retesting)

    #define ENDSTOP_X_BACK_MOVE 2
    #define ENDSTOP_Y_BACK_MOVE 2
    #define ENDSTOP_Z_BACK_MOVE 2

  • edited October 2020
    These are the values named in the EEPROM: via repetier server:
    * axis distance after homing 2

    with *={x,y,z}

    ENDTSOP_*_BACK_MOVE is in my opinion not what shows the last movement.

    In my setup it looks like this:
    - Homing z axis, with retesting. At the end it stays at the endstop, if ENDSTOP_Z_ON_HOME is set to 0.
    - Homing y axis, like above
    - Homing x axis, like above
    - a small movement in z-direction is done (but not in x and y)

    If the last movement comes from the mentioned values, it should move in all three directions?!
  • After homing Motion1::setAutolevelActive is called:
    void Motion1::setAutolevelActive(bool state, bool silent) {
    if (state != autolevelActive) {
    autolevelActive = state;
    updateRotMinMax();
    updatePositionsFromCurrentTransformed();
    }
    if (!silent) {
    if (autolevelActive) {
    Com::printInfoFLN(Com::tAutolevelEnabled);
    } else {
    Com::printInfoFLN(Com::tAutolevelDisabled);
    }
    }
    printCurrentPosition();
    }

    It takes the transformed coordinates and computes the official coordinates. For xy this is normally nearly the same value. For Z it depends on rotation and xy position. We always assume the coordinate system rotates around 0,0,0. No move so far. But at end of homeAxis you have this:

    // Reactivate corrections
    setAutolevelActive(isAL);
    Leveling::setDistortionEnabled(bcActive);

    if (axes & axisBits[Z_AXIS]) {
    totalBabystepZ = 0;
    Motion1::correctBumpOffset(); // activate bump offset, needs distorion enabled to have an effect!
    // Add z probe correctons
    int32_t motorPos[NUM_AXES];
    float oldPos[NUM_AXES];
    copyCurrentPrinter(oldPos);
    waitForEndOfMoves();
    int32_t* lp = Motion2::lastMotorPos[Motion2::lastMotorIdx];
    FOR_ALL_AXES(i) {
    motorPos[i] = lp[i];
    }
    float zpCorr = 0;
    float zRot = 0;
    if (isAL) {
    zRot = currentPosition[X_AXIS] * autolevelTransformation[2] + currentPosition[Y_AXIS] * autolevelTransformation[5];
    }
    // undo safety move from rotMin/max plus correct for real bed rotation
    if (homeDir[Z_AXIS] < 0) { // z min homing
    zpCorr = zpCorr - zRot + rotMin[Z_AXIS] - rotMax[Z_AXIS];
    } else { // z max homing
    zpCorr = zpCorr - zRot + rotMax[Z_AXIS] - rotMin[Z_AXIS];
    }

    if (homeDir[Z_AXIS] < 0 && ZProbe != nullptr) {
    zpCorr += ZProbeHandler::getCoating() - ZProbeHandler::getZProbeHeight();
    }
    if (zpCorr != 0.0f) { // anything to do?
    setTmpPositionXYZ(IGNORE_COORDINATE, IGNORE_COORDINATE, zpCorr);
    bool isNoDest = Printer::isNoDestinationCheck();
    Printer::setNoDestinationCheck(true);
    moveRelativeByPrinter(tmpPosition, moveFeedrate[Z_AXIS], false);
    waitForEndOfMoves();
    Printer::setNoDestinationCheck(isNoDest);
    lp = Motion2::lastMotorPos[Motion2::lastMotorIdx];
    FOR_ALL_AXES(i) {
    lp[i] = motorPos[i];
    currentPositionTransformed[i] = oldPos[i];
    }
    updatePositionsFromCurrentTransformed();
    }
    }

    which moves especially Z to make place for z corrections without hitting end stop (zpCorr with zRot and rotMinMax). That is the last z move you see I think.

    What we need to achieve is that at the end the official z position is <= your set z max position. If that is not the case you get the illegal position message when the tool gets activated.

    Looking a bit further downwards I see:

    if (Tool::getActiveTool() != nullptr && ok && (axes & 7) != 0) { // select only if all is homed or we get unwanted moves! Also only do it if position has changed allowing homing of non position axis in extruder selection.
    Tool::selectTool(activeToolId, true);
    }
    oldCoordinates[E_AXIS] = currentPosition[E_AXIS];
    moveByOfficial(oldCoordinates, moveFeedrate[X_AXIS], false); // make official pos = homing pos reagrdless of transformation
    Motion1::printCurrentPosition();

    here you see I first switch extruder and then move to target position. That could be the problem we have with your positions. It should be the other way around. Can you replace this with

        oldCoordinates[E_AXIS] = currentPosition[E_AXIS];
        moveByOfficial(oldCoordinates, moveFeedrate[X_AXIS], false); // make official pos = homing pos reagrdless of transformation
       if (Tool::getActiveTool() != nullptr && ok && (axes & 7) != 0) { // select only if all is homed or we get unwanted moves! Also only do it if position has changed allowing homing of non position axis in extruder selection.
            Tool::selectTool(activeToolId, true);
        }
        Motion1::printCurrentPosition();

    and report if it solves the position problem also with autolevel enabled.
  • I found it in motionlevel1 and changed it.

    Without correction:
    Send:12:06:39.985: N18 G28
    Recv:12:06:39.985: Info:Autoleveling disabled
    Recv:12:06:39.985: X:0.00 Y:0.00 Z:0.000 E:0.0000
    Recv:12:06:42.764: Info:Autoleveling disabled
    Recv:12:06:42.764: X:-65.00 Y:400.00 Z:160.000 E:0.0000
    Recv:12:06:42.954: SelectTool:0 (2)
    Recv:12:06:42.954: X:-65.00 Y:400.00 Z:160.000 E:0.0000
    Send:12:06:46.538: @getip
    Send:12:06:46.561: N19 M117 192.168.178.29:3344

    with correction:
    Send:12:07:50.711: N22 G28
    Recv:12:07:50.711: Info:Autoleveling disabled
    Recv:12:07:50.711: X:-65.09 Y:399.92 Z:160.172 E:0.0000
    Recv:12:07:53.663: Info:Autoleveling enabled
    Recv:12:07:53.663: X:-64.91 Y:400.08 Z:159.828 E:0.0000
    Recv:12:07:53.740: SelectTool:0
    Recv:12:07:53.740: Axis failed:1
    Recv:12:07:53.740: Warning:Move to illegal position prevented! Position should not be trusted any more!
    Recv:12:07:53.740: SelectTool:0
    Recv:12:07:53.796: X:-65.00 Y:400.00 Z:160.000 E:0.0000

    Sorry.

    About the small movement at the end: I can observe that after z homing it moves a bit down, than homes x and y and moves a bit up again. So it seems to be okay. Anyway there is no need for it and would expect it only if I set "z distance after homing" <> 0. Seems to be antoher value. I am sure I will find it in your code, but that will take some time, because I am not yet familiar with the language.
  • Recv:12:07:53.740: SelectTool:0
    Recv:12:07:53.740: Axis failed:1
    Recv:12:07:53.740: Warning:Move to illegal position prevented! Position should not be trusted any more!

    Nice you have the old version where the debug output was forgotton. The axis failing is Y axis and not Z as we expect. Y limit is 400.0 and first try where autolevel was disabled you see Y400 while with correction it was 400.08 so outside! 

    Ok we are quite close. Please add
    #define DEBUG_MOVES
    in your configuration.h so we get some more informations and enable echo
    M111 S7

    Also modify the homeAxes end to get some more informations:

    oldCoordinates[E_AXIS] = currentPosition[E_AXIS];
        moveByOfficial(oldCoordinates, moveFeedrate[X_AXIS], false); // make official pos = homing pos reagrdless of transformation
    Com::printFLN(PSTR("Position before select"));
        Motion1::printCurrentPosition();   if (Tool::getActiveTool() != nullptr && ok && (axes & 7) != 0) { // select only if all is homed or we get unwanted moves! Also only do it if position has changed allowing homing of non position axis in extruder selection.
            Tool::selectTool(activeToolId, true);
        }
        Motion1::printCurrentPosition();

    As I understand we are still at making G28 work. So send full output of that. That should then provide all informations on what is going on. We can also see every move with distances that gets made. So perfect for analysis.
Sign In or Register to comment.