G1 H3 and M500 P31 to save multiple endstop on combined Z axis



  • Hi there

    3.1.1 firmware here
    So I have a printer working well with 3 point auto bed level.
    I use a BL touch for probing and 3 optical endstops on Z max.

    Homing sequence go to Z max on each endstop. Then when print start It does the 3 point bed leveling, and then probe the center.

    I'm very glad of this setup works really well.

    However, I wonder how I can setup a resume after power failure as I do with my one z axis setup.

    I've tried
    G1 Z400 F300 H3
    M500 P31

    But it only save the Z max as a global axis not one value for each motor

    Ideally it should save z max for each separated Z,
    Then on resume print no need to reprobe ( what is impossible in this case ) , it should restart with the correct previous bias recorded.

    Is there another way of achieve this yet?


  • Moderator

    You would need to split the Z axis into separate axis and save their positions independently I think.

    If you tram the bed surface using the probe first, you should be able to adjust the Z max endstop positions such that they could be used to relevel on a power loss resume.



  • Thanks. I was not sure if I can still split Z axis on 3.x as with firmware 2.x
    That should clearly work if so.

    Well, Reprap 3 made this cleaner by not splitting, perhaps someday it could be interesting to add a way to save and restore leveling.

    Adding a new flag to M500 P31 for saving multiple endstop position for one axis.


  • Moderator

    Yes RRF3 made it simpler to use multiple endstops on a single axis, but I don't think that extends to measuring of each endstop position. Perhaps
    I'll edit your title and move this to the firmware wishlist for evaluation.



  • Fell free to move the thread 👍

    I wonder what other interest than failure resume there is to use multiple Z max endstops instead of direct probing zMin?


  • Moderator

    Using Zmax endstops has the disadvantage that it doesn't actually measure the current position of the bed surface, so it's a less attractive option outside of power loss recovery where a print is still on the bed.



  • Here is the different procedure I imagine, can you confirm the logic is good ?

    Configure resume level macro ( macro started manually, not done at each print )

    • homeZ min with probe
    • level Z min
    • probe Z min
    • separate Z axis
    • home Z max H3 per Z axis with endstops
    • save M500 P31

    start print:

    • home Z min with probe
    • level Z min
    • probe z min
    • print start

    resume print after failure:

    • separate Z axis

    • home zmax H1 per Z axis with endstops

    • up bed 5mm

    • blind level:
      . calculate motor 2 and 3 bias ( 1 is reference ) and move accordingly
      G1 Z2 ( mz1max - mz2max );
      G1 Z3 ( mz1max - mz3max );

    • go to previous saved position

    • resume print


  • Moderator

    That sounds logical.



  • I'm on my way to try that.
    If it was considered to improve for Reprap 3, method could be contained like this:

    • Record zmax:
      G1 H3 Z400 ; as we have 3 independant motor will get zmax of each leadscrew.
      M500 P31; save those values

    • Resume print:
      G28 Z (home using zmax )
      G91; relative moves
      G1 Z-15; up bed 15mm
      Gxx xxx ; restore saved Z bias



  • So how I'm doing this correcctly using conditionnal gcode ?

    G1 U(move.axes[2].max-move.axes[3].max) ; restore U bias
    G1 V(move.axes[2].max - move.axes[4].max) ; restore V bias
    reports me errors

    edit: sorry, found the information , brace were missing.

    G1 U{move.axes[2].max-move.axes[3].max}
    G1 V{move.axes[2].max - move.axes[4].max}



  • Seems tehre's something wrong on my logic.
    Here is wht I've made:

    Config.g:

    M584 X1 Y0 Z6:8:7 U8 V7 P3 E4; three Z motors connected to driver outputs 6, 8, 7
    M350 X16 Y16 Z16 U16 V16 E16 I1                                     ; configure microstepping with interpolation
    M92 X200.00 Y200.00 Z400.00 U400 V400 E402.00                         ; set steps per mm
    M574 Z2 S1 P"duex.e2stop";	set endstops for Z
    M574 U2 S1 P"duex.e6stop";	set endstops for U
    M574 V2 S1 P"duex.e5stop";	set endstops for V
    ; Leadscrews
    M671 X-214:214:214 Y0:-121:118 S10 						    ; leadscrews at middle left, front right, and rear right
    

    HomeZ.g:

    if (!move.axes[0].homed)
      M98 P"homex.g" ; need to home X Y first 
    
    if sensors.endstops[2].triggered 
    	G91;
    	G1 Z-15 F1000 H2 ; move bed up a bit
    	M400			 ; wait for move to finish
    
    M220 S100		; set back speed to 100%
    G90
    G1 X0 Y0 F10000; move head to the center
    G30; probe Z = 0
    G32; level bed
    G1 X0 Y0 F10000;
    G30; probe Z again
    M400			; wait for move to finish
    

    Macro to calibrate each Zmax:

    M208 S1 Z-3;	Allow z to be negative
    G90; 
    G1 X0 Y0  F10000; 		go to the center
    G1 Z30 F1000;
    G30		;		 probe bed and set z=0
    G32		; 		start 3 point bed leveling
    G1 X0 Y0 F10000;
    G30     ;	Probe for Z=0
    G91		; relative mode
    G1 Z10 F800				; raise nozzle
    M584 Z6 U8 V7 P5 ; split z axis
    ;G92 U10 V10; set U V axis to 10 as Z
     
    G1 H3 Z370 U370 V370 F1000; move Z, U, V down until endstops trigger and get new z limits
    
    M500 P31		; save new z height
    M584 Z6:8:7 P3 ; unsplit z axis
    G90
    

    Z max values are correctly saved for each z axis:

    M208 S0 Z341.22 U314.82 V316.30
    

    Then after a powerfailure I have a homeZmax.g macro :

    
    if sensors.endstops[2].triggered || sensors.endstops[3].triggered || sensors.endstops[4].triggered
    	G91;
    	G1 Z-20 F1000 H2 ; move bed up a bit
    	M400			 ; wait for move to finish
    
    M220 S100						; set back speed to 100%
    G91
    M584 Z6 U8 V7 P5 				; split z axis
    G1 H1 Z370 U370 V370 F1000		; move Z, U, V down until endstops trigger
    G1 Z-10 U-10 V-10 F800      		; get back 10mm
    G1 H1 Z15 U15 V15 F300  			; go to zmax slowly
    
    G1 Z-30 U-30 V-30 F1000;		 			up bed 30mm
    
    ; Blind leveling
    G1 U{move.axes[2].max - move.axes[3].max} V{move.axes[2].max - move.axes[4].max}; restore U V bias
    M584 Z6:8:7 P3 ;							unsplit z axis
    G90
    
    

    Problem here is bed is completly tiled.
    I don't get now where I've failed 🙂



  • Found it.

    Seems I have to set also U and V to 0 reference after a Z probe.

    Now it works.

    macro calibrate Z max for each axis:

    M208 S1 Z-3;	Allow z to be negative
    G90; 
    G1 X0 Y0  F10000; 		go to the center
    G1 Z30 F1000;
    G30		;		 probe bed and set z=0
    G32		; 		start 3 point bed leveling
    G1 X0 Y0 F10000;
    G30     ;	Probe for Z=0
    G1 Z10 F800				; raise nozzle
    M584 Z6 U8 V7 P5 ; split z axis
    G92 U10 V10; set U V axis to 10 as Z
    G91		; relative mode
     
    G1 H3 Z370 U370 V370 F1000; move Z, U, V down until endstops trigger and get new z limits
    
    M500 P31		; save new z height
    M584 Z6:8:7 P3 ; unsplit z axis
    G90
    

    Have to say, object models and conditionnal gcode is a killer feature. 🙂


Log in to reply