Basic Information:
Printer Model: Custom
MCU / Printerboard: Manta_M8P
Host / SBC CB1
klippy.log No
Describe your issue:
As some of you already know, i’m having problems homing z with my horizon sensor.
Prior to try using the adc signal it has, i’m trying to make it with its digital signal, even it is too much sensitive.
I avoided the vibrations in xy axis by creating a custom g28 macro that includes a dwell before homing z. (It simulates the procedure of safe_z_home but adds this dwell, and adds some custom verifications of my machine)
After this, i have seen that i still have some vibrations in my z axis as i have set a high accel in z for my prints.
I have tested, and obviously, setting a lower accel in z, solves the problem for homing or probe, but i’d like to maintain this high value for my prints.
Say this, i’d like to modify the command set_velocity_limit, or create a new command, in order to be able to set a different accel_z value, just like in set_velocity_limit.
I have seen the code and i dunno what’s the best option, if to modify set_velocity_limit in toolhead.py, and somehow add the option of accel_z, or just modify the cartesian.py, adding my command there and just changing the self.max_z_accel .
What do you think guys?
Btw i atach my custom g28 if some of you wants to take a look. I accept any suggestions
[gcode_macro G28]
rename_existing: G99928
description: Custom G28 with safe Z homing
# **Homing speeds and retracts and all that stuff is defined in the corresponding section of [stepper_xxx]
gcode:
# Initial configuration
{% set z_hop = 5.0 %} # Z Hop height
{% set z_hop_speed = 15.0 %} # Z Hop speed
# Retrieve current homing status and position
{% set homed_z = 'z' in printer.toolhead.homed_axes %}
{% set cur_z = printer.toolhead.position.z|default(0)|float %}
# Normalize and determine which axes need homing
{% set param_string = params.keys() | join('') | upper %} # Combine all parameters into a single string in uppercase -> Now G28 can also be commanded as G28 xy not only G28 X Y for example
{% set need_x = 'X' in param_string %}
{% set need_y = 'Y' in param_string %}
{% set need_z = 'Z' in param_string %}
{% if not need_x and not need_y and not need_z %}
{% set need_x = True %}
{% set need_y = True %}
{% set need_z = True %}
{% endif %}
{% if printer["gcode_button alarma_z"].state == "PRESSED" %}
RESPOND MSG="LOS MOTORES DE Z ESTÁN EN FALLO, RESUELVA ESTE ERROR ANTES DE REALIZAR CUALQUIER MOVIMIENTO"
{% else %}
# Reset alarm in motors prior to do any movement
{% if printer["gcode_button alarma_xy"].state == "PRESSED" %}
RESETEAR_ALARMA_MOTORES
{% endif %}
# Perform Z Hop if necessary - Only if any axis has been homed before or if current z height is lower than z_hop distance
{% if 'x' not in printer.toolhead.homed_axes and 'y' not in printer.toolhead.homed_axes and 'z' not in printer.toolhead.homed_axes %}
# If Z is not homed, assume Z = 0 and perform Z Hop
SET_KINEMATIC_POSITION z=0
G90
G1 Z{z_hop} F{z_hop_speed * 60}
M18 # Disable motors in order to unhome them, just in case that some error occurs, they dont have a defined position (they don't disable at all as enable signal isn't controlled via the controller but via the drivers alarm signal (external))
{% elif homed_z and cur_z < z_hop %}
# If Z is below z_hop, lift it
G1 Z{z_hop} F{z_hop_speed * 60}
{% endif %}
# Home X if needed
{% if need_x %}
G99928 X
{% endif %}
# Home Y if needed
{% if need_y %}
G99928 Y
{% endif %}
# Home Z if needed
{% if need_z %}
HOME_EVAL_Z # Evaluate homing of z in a new macro as it is needed to get the actual instance of homed_axes (Remember how macros get printer info!!)
{% endif %}
{% endif %}
[gcode_macro HOME_EVAL_Z]
description: Evaluate and home Z axis safely
gcode:
# Retrieve updated homing status
{% set pos = printer.toolhead.position %}
{% set z_hop = 5.0 %} # Z Hop height
{% set z_hop_speed = 15.0 %} # Z Hop speed
{% set home_x_pos = 560.0 %} # Safe position for homing X
{% set home_y_pos = 450.0 %} # Safe position for homing Y
{% set move_speed = 200 %}
{% if 'x' not in printer.toolhead.homed_axes or 'y' not in printer.toolhead.homed_axes %}
G99928 X Y
{% endif %}
# Move to a safe position for Z homing
G1 X{home_x_pos} Y{home_y_pos} F{move_speed *60}
# Ensure to finish all movements and set a delay before homing
M400
G4 P200 # Delay of 200 ms
# HERE A SET_Z_ACCEL COMMAND OR SET_VELOCITY_LIMIT SHOULD BE CALLED IN ORDER TO LIMIT Z_ACCEL VALUE
# Start by moving 1 mm at homing_z_speed prior to command g28 so the acceleration is done while not searching for a trigger
#SET_KINEMATIC_POSITION z={z_hop} # X Y will have the last commanded position by default of this command (in this case, home_x_pos and home_y_pos)
#G91
#G1 Z-1 F{printer.configfile.config["stepper_z"]["homing_speed"] * 60}
#G90
G99928 Z
# Do a z-hop again in order to avoid future colisions
G1 Z{z_hop} F{z_hop_speed * 60}
# HERE Z ACCEL SHOULD BE RESTORED TO THE CONFIGFILE VALUE
type or paste code here