added axes_map computation

This commit is contained in:
Félix Boisselier
2023-12-01 00:08:32 +01:00
parent 7ba692954f
commit 8721488d8c
13 changed files with 298 additions and 47 deletions

View File

@@ -8,7 +8,6 @@ gcode:
{% set size = params.SIZE|default(60)|int %} # size of the area where the movements are done
{% set direction = params.DIRECTION|default('XY') %} # can be set to either XY, AB, ABXY, A, B, X, Y, Z
{% set z_height = params.Z_HEIGHT|default(20)|int %} # z height to put the toolhead before starting the movements
{% set verbose = params.VERBOSE|default(true) %} # Wether to log the current speed in the console
{% set min_speed = params.MIN_SPEED|default(20)|float * 60 %} # minimum feedrate for the movements
{% set max_speed = params.MAX_SPEED|default(200)|float * 60 %} # maximum feedrate for the movements
@@ -100,9 +99,7 @@ gcode:
}
%}
#
# STARTING...
#
{% if not 'xyz' in printer.toolhead.homed_axes %}
{ action_raise_error("Must Home printer first!") }
{% endif %}
@@ -126,22 +123,19 @@ gcode:
SAVE_GCODE_STATE NAME=STATE_VIBRATIONS_CALIBRATION
M83
G90
# Set the wanted acceleration values (not too high to avoid oscillation, not too low to be able to reach constant speed on each segments)
SET_VELOCITY_LIMIT ACCEL={accel} ACCEL_TO_DECEL={accel} SQUARE_CORNER_VELOCITY={[(accel / 1000), 5.0]|max}
# Going to the start position
G1 Z{z_height}
G1 Z{z_height} F{feedrate_travel / 10}
G1 X{mid_x + (size * direction_factor[direction].start.x) } Y{mid_y + (size * direction_factor[direction].start.y)} F{feedrate_travel}
# vibration pattern for each frequency
{% for curr_sample in range(0, nb_samples) %}
{% set curr_speed = min_speed + curr_sample * speed_increment %}
{% if verbose %}
RESPOND MSG="{"Current speed: %.2f mm/s" % (curr_speed / 60)|float}"
{% endif %}
RESPOND MSG="{"Current speed: %.2f mm/s" % (curr_speed / 60)|float}"
ACCELEROMETER_MEASURE CHIP={accel_chip}
{% if direction == 'E' %}
@@ -152,14 +146,13 @@ gcode:
{% endfor %}
{% endif %}
ACCELEROMETER_MEASURE CHIP={accel_chip} NAME=sp{("%.2f" % (curr_speed / 60)|float)|replace('.','_')}n1
G4 P300
M400
{% endfor %}
{% if verbose %}
RESPOND MSG="Graphs generation... Please wait a minute or two and look in the configured folder."
{% endif %}
RESPOND MSG="Machine and motors vibration graph generation..."
RESPOND MSG="This may take some time (3-5min)"
RUN_SHELL_COMMAND CMD=shaketune PARAMS="VIBRATIONS {direction}"
# Restore the previous acceleration values