Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: config is not required #6

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,8 @@ EOF

## How to configure it?

Open `z_tramming_settings.cfg` and uncomment the line with `variable_screw_lead`,
set the number to your lead. The lead is the distance the screw moves in one rotation.
It is calculated by multiplying the pitch with the number of starts of the screw.
So a 2mm pitch, 4 start screw has a lead of 8mm.
You can look at the examples in the file for some known values.
Open `z_tramming_settings.cfg`.
There is an example of what values can be configured together with their defaults.

## Alternatives

Expand Down
8 changes: 2 additions & 6 deletions macros/z_tramming.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ gcode:
{action_raise_error("Missing probe settings")}
{% endif %}

# Verify that required configurations are present
{% set config = printer["gcode_macro _Z_TRAMMING_SETTINGS"] %}
{% if config is undefined %}
{action_raise_error("Missing _Z_TRAMMING_SETTINGS macro")}
{% endif %}
{% set config = printer["gcode_macro _Z_TRAMMING_SETTINGS"] | default({}) %}

{% set speed = config.speed | default(printer.configfile.settings.bed_mesh.speed) * 60 %}

Expand Down Expand Up @@ -55,7 +51,7 @@ gcode:
variable_left: 0
variable_right: 0
gcode:
{% set config = printer["gcode_macro _Z_TRAMMING_SETTINGS"] %}
{% set config = printer["gcode_macro _Z_TRAMMING_SETTINGS"] | default({}) %}
{% set probe = printer.configfile.settings.probe %}
{% set tolerance = config.tolerance | default(probe.samples_tolerance * 2)%}
{% set screw_lead = printer.configfile.settings.stepper_z.rotation_distance | float %}
Expand Down
Loading