Skip to content

v6.1.0#274

Open
Frix-x wants to merge 7 commits intomainfrom
develop
Open

v6.1.0#274
Frix-x wants to merge 7 commits intomainfrom
develop

Conversation

@Frix-x
Copy link
Copy Markdown
Owner

@Frix-x Frix-x commented Feb 22, 2026

Summary by Sourcery

Add configurability for vibration tests and document the new parameters.

New Features:

  • Allow overriding the resonance test X and Y probe positions via X_POS and Y_POS parameters in excitate_axis_at_freq.
  • Add a configurable MIN_SPEED parameter to CREATE_VIBRATIONS_PROFILE to control the starting speed of the sweep.

Bug Fixes:

  • Prevent invalid vibration profiles by enforcing that MIN_SPEED is lower than MAX_SPEED.

Documentation:

  • Document the new X_POS and Y_POS parameters for EXCITATE_AXIS_AT_FREQ and the MIN_SPEED parameter for CREATE_VIBRATIONS_PROFILE in the macros documentation.

Chores:

  • Update dummy macros configuration to expose the new X_POS, Y_POS, and MIN_SPEED parameters.

NerdyGriffin and others added 4 commits February 17, 2026 09:20
… position

Add X_POS and Y_POS parameters to EXCITATE_AXIS_AT_FREQ, following the
same pattern as the existing Z_HEIGHT parameter. Each independently
overrides its respective coordinate from [resonance_tester] probe_points.

Use case: belt tension measurement requires parking the toolhead at a
specific Y position (calibrated belt span), not the default resonance
test point.
feat(excitate): add X_POS and Y_POS parameters to override test point position
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Feb 22, 2026

Reviewer's Guide

Adds positional overrides to the excitate_axis_at_freq command, introduces a configurable minimum speed for create_vibrations_profile, and updates the dummy macros and docs to expose these new parameters and validations.

Sequence diagram for excitate_axis_at_freq position resolution with X_POS/Y_POS overrides

sequenceDiagram
    actor User
    participant Macro_EXCITATE_AXIS_AT_FREQ as Macro_EXCITATE_AXIS_AT_FREQ
    participant Command_excitate_axis_at_freq as Command_excitate_axis_at_freq
    participant Klipper_gcmd as Klipper_gcmd
    participant Klipper_toolhead as Klipper_toolhead
    participant Klipper_config as Klipper_config

    User->>Macro_EXCITATE_AXIS_AT_FREQ: Invoke with parameters (ACCEL_PER_HZ, AXIS, TRAVEL_SPEED, X_POS, Y_POS, Z_HEIGHT, ACCEL_CHIP)
    Macro_EXCITATE_AXIS_AT_FREQ->>Command_excitate_axis_at_freq: Call excitate_axis_at_freq(gcmd, klipper_config, st_process)

    Command_excitate_axis_at_freq->>Klipper_gcmd: get_float ACCEL_PER_HZ
    Command_excitate_axis_at_freq->>Klipper_gcmd: get AXIS
    Command_excitate_axis_at_freq->>Klipper_gcmd: get_float TRAVEL_SPEED
    Command_excitate_axis_at_freq->>Klipper_gcmd: get_float X_POS (default None)
    Command_excitate_axis_at_freq->>Klipper_gcmd: get_float Y_POS (default None)
    Command_excitate_axis_at_freq->>Klipper_gcmd: get_float Z_HEIGHT
    Command_excitate_axis_at_freq->>Klipper_gcmd: get ACCEL_CHIP

    alt resonance_tester has probe_points
        Command_excitate_axis_at_freq->>Klipper_config: Read resonance_tester test_points
        Klipper_config-->>Command_excitate_axis_at_freq: test_points
        Command_excitate_axis_at_freq->>Command_excitate_axis_at_freq: x, y, z = test_points[0]
        alt Z_HEIGHT provided
            Command_excitate_axis_at_freq->>Command_excitate_axis_at_freq: Override z with Z_HEIGHT
        end
    else test_points is [-1, -1, -1]
        Command_excitate_axis_at_freq->>Klipper_toolhead: toolhead.kin.get_status(systime)
        Klipper_toolhead-->>Command_excitate_axis_at_freq: axis_minimum, axis_maximum
        Command_excitate_axis_at_freq->>Command_excitate_axis_at_freq: x = (axis_minimum.x + axis_maximum.x) / 2
        Command_excitate_axis_at_freq->>Command_excitate_axis_at_freq: y = (axis_minimum.y + axis_maximum.y) / 2
        Command_excitate_axis_at_freq->>Command_excitate_axis_at_freq: z = Z_HEIGHT
    end

    alt X_POS provided
        Command_excitate_axis_at_freq->>Command_excitate_axis_at_freq: Override x with X_POS
    end
    alt Y_POS provided
        Command_excitate_axis_at_freq->>Command_excitate_axis_at_freq: Override y with Y_POS
    end

    Command_excitate_axis_at_freq->>Command_excitate_axis_at_freq: point = (x, y, z)
    Command_excitate_axis_at_freq->>Klipper_toolhead: manual_move(point, TRAVEL_SPEED)
    Command_excitate_axis_at_freq->>Klipper_toolhead: dwell(0.5)
    Klipper_toolhead-->>User: Toolhead positioned at final test point
Loading

Flow diagram for create_vibrations_profile speed range with configurable MIN_SPEED

flowchart TD
    A["Start CREATE_VIBRATIONS_PROFILE"] --> B["Read SIZE from gcmd (default 100.0, min 50.0)"]
    B --> C["Read Z_HEIGHT from gcmd (default 20.0)"]
    C --> D["Read MIN_SPEED from gcmd (default 2.0, min 1.0)"]
    D --> E["Read MAX_SPEED from gcmd (default 200.0, min 10.0)"]
    E --> F["Read SPEED_INCREMENT from gcmd (default 2.0, min 1.0)"]
    F --> G["Read ACCEL and other parameters"]

    G --> H{"Is MIN_SPEED >= MAX_SPEED?"}
    H -->|Yes| I["Raise error MIN_SPEED must be lower than MAX_SPEED"]
    H -->|No| J{"Is size / (MAX_SPEED / 60) < 0.25?"}
    J -->|Yes| K["Raise error size too small for given speed"]
    J -->|No| L["Compute nb_speed_samples = int((MAX_SPEED - MIN_SPEED) / SPEED_INCREMENT + 1)"]

    L --> M["Initialize main_angles loop"]
    M --> N["For each curr_angle in main_angles"]
    N --> O["Compute radian_angle and segment geometry"]
    O --> P["Initialize speed sample loop"]

    P --> Q["For curr_speed_sample in range(nb_speed_samples)"]
    Q --> R["Compute curr_speed = MIN_SPEED + curr_speed_sample * SPEED_INCREMENT"]
    R --> S["Print current speed and generate movement segments"]
    S --> T["Record vibrations at curr_speed"]
    T --> U{"More speed samples?"}
    U -->|Yes| Q
    U -->|No| V{"More angles?"}
    V -->|Yes| N
    V -->|No| W["Finish measurement, save profile files"]
    W --> X["End"]
Loading

File-Level Changes

Change Details Files
Allow overriding the X/Y probe position when exciting an axis at a given frequency.
  • Parse optional X_POS and Y_POS parameters from the GCode command.
  • When resonance_tester probe point is auto-centered, compute x, y, z separately and only form the point tuple after all overrides.
  • If X_POS or Y_POS are provided, override the computed/probe-based X/Y coordinates before performing the manual move.
shaketune/commands/excitate_axis_at_freq.py
shaketune/dummy_macros.cfg
docs/macros/excitate_axis_at_freq.md
Make the minimum sweep speed configurable in the vibrations profile generator and validate the range.
  • Replace the MIN_SPEED constant with a MIN_SPEED GCode parameter with bounds and default value.
  • Add a validation that MIN_SPEED must be strictly lower than MAX_SPEED and raise a GCode error otherwise.
  • Use the configured min_speed when computing the number of speed samples and per-sample speeds.
  • Expose MIN_SPEED in the dummy macro for UI discoverability and document it in the macro docs.
shaketune/commands/create_vibrations_profile.py
shaketune/dummy_macros.cfg
docs/macros/create_vibrations_profile.md
Minor documentation and formatting cleanups.
  • Normalize whitespace in dummy_macros.cfg comments.
  • Fix trailing whitespace in excitate_axis_at_freq documentation.
shaketune/dummy_macros.cfg
docs/macros/excitate_axis_at_freq.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `docs/macros/excitate_axis_at_freq.md:16` </location>
<code_context>
 |ACCEL_PER_HZ|None (default to `[resonance_tester]` value)|accel per Hz value used for the test|
 |AXIS|x|axis you want to excitate. Can be set to either "x", "y", "a", "b"|
 |TRAVEL_SPEED|120|speed in mm/s used for all the travel movements (to go to the start position prior to the test)|
+|X_POS|None|X position wanted for the test. This value can be used if needed to override the X value of the probe_point set in your `[resonance_tester]` config section|
</code_context>

<issue_to_address>
**issue (typo):** Consider changing "excitate" to "excite" in this description.

In this parameter description, "axis you want to excitate" should be "axis you want to excite" for correct English; this only changes the prose, not any macro or configuration names.

```suggestion
|AXIS|x|axis you want to excite. Can be set to either "x", "y", "a", "b"|
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@@ -15,6 +15,8 @@ Here are the parameters available:
|ACCEL_PER_HZ|None (default to `[resonance_tester]` value)|accel per Hz value used for the test|
|AXIS|x|axis you want to excitate. Can be set to either "x", "y", "a", "b"|
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (typo): Consider changing "excitate" to "excite" in this description.

In this parameter description, "axis you want to excitate" should be "axis you want to excite" for correct English; this only changes the prose, not any macro or configuration names.

Suggested change
|AXIS|x|axis you want to excitate. Can be set to either "x", "y", "a", "b"|
|AXIS|x|axis you want to excite. Can be set to either "x", "y", "a", "b"|

Values like ACCEL_CHIP="adxl345 T0" were losing their quotes when the
dummy macro reconstructed the command string, causing shlex parsing
failures in the internal command. Fix by wrapping all values in double
quotes in the for-loop output.

Also simplifies all 5 macros to use the same pattern: {% set dummy %}
for web UI hints + params.items() iteration. This unifying them all
with consistent empty-string filtering.

Fixes #234
Supersedes the previous approach in PR #239
improved dummy macros handling of spaces in parameters strings values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose MIN_SPEED from create_vibrations_profile.py as a user editable variable for the create_vibrations_profile macro

2 participants