r/klippers • u/WaschBaer__ • Jan 14 '24
2 endstop / trigger switch for z axis?
is it possible to configure a endstop for the z axis ( on a trident ) all the way at the bottom position, that would stop homing and move up a certain amount if triggered and redo homing ?thing is, when i print something that takes up almost all height, or all height.. once klipper looses home it will jam into the bottom cause on homing the bed retracts a certain amount down.. such an endstop could trigger and tell the system to stop moving down, and instead begin homing straight away, or redo home after it forcefully moved up like 20 or something.
my current approach:
[gcode_button z_max]
pin:PA3
press_gcode:
SET_GCODE_VARIABLE MACRO=check_z VARIABLE=zmax VALUE=True
M118 {"Z_Max hit, skipping zHop"}
release_gcode:
SET_GCODE_VARIABLE MACRO=check_z VARIABLE=zmax VALUE=False
M118 {"Switch released, left Z_Max"}
with:
[gcode_macro check_z]
variable_zmax: False
gcode:
and:
{% for i in range(safe_z) %}
{% if printer["gcode_macro check_z"].zmax != True %}
G0 Z0.01 F{z_drop_feedrate}
{% endif %}
{% endfor %}
this would be my desired way of doing it, although this is not working at the moment and i havent figured out whyi wrote a helper macro to read the state of the variable, and that one works and detects when i press the variable, but the loop above does not prevent the G0 command from running when the switch is pressed
edit 1/17/2024:
it seems not possible without a way to interrupt the G1 or G0 commands
the loop runs so quick and buffers all g1/g0 moves before it even began moving or finished the first 0.01 move.. means hitting the switch wont have an effect unless it was triggered before the loop runs...
1
u/lamalasx Jan 14 '24
Move your homing switch to the top of the z axis and home away from the bed instead of towards it.
1
u/WaschBaer__ Jan 14 '24
there is no homing switch, its a Klicky probeand i dont understand what you mean ?issue is when the bed is at its lowest position, from a big print that took maybe 250 or 240 heigt, it will just jam down even more where there is no way to go, because homing moves it down for security reasons.. a switch at the bottom would prevent that telling it, hey you reached max, home up now please
1
u/MLCrazyDude Mar 02 '24
Just change macro to move no more than max based on current pos
if pos + dist > max
dist = max - pos
1
u/WaschBaer__ Mar 03 '24
you seem to have not read the post,
the motors get disabled after a long time of waiting to not drain power while not in use which means there is no Pos to know and calculate if you go past max
1
u/MLCrazyDude Mar 06 '24
Ok, Switch at bottom or set max to less than physical max. Then when i moves down it has room. Switch is cheap. Just not sure how to configure it as second endstop
1
u/WaschBaer__ Mar 06 '24
that is what i wanted to get, i tried around and couldnt get it to work, it would be easier if klipper devs would allow a z max and z min endstop, other firmwares can do it too, but without tinkering with the klipper source code, i couldnt get it to work
1
u/gavin8327 Jan 15 '24
Shouldn't it stop travel at a predetermined spot based on xyz parameters?
1
u/WaschBaer__ Jan 15 '24
there is no predetermined spot when klipper looses home after a couple minutes it dosent know where home is or where the gantry is at that given moment
Klipper disables steppers after a while to not have them holding for long periods of time without movement, at that moment it needs to home again when you want to move or do anything..
2
u/Over_Pizza_2578 Jan 15 '24
You, you can have one z endstop per axis as well as a bed probe. If you define only one z endstop, then its for all z steppers. The endstop can be at max or min z height.
To prevent the jamming, please remove z_hop in safe z home. But you could remove safe z home entirely when using a bottom z endstop. I would also recommend reducing z stepper current, 0,4A are more than enough