Skip to content

Machine Acceleration Overwritten by Macros #228

@FreeWilly2022

Description

@FreeWilly2022

What happened

The max_accel value can also be set in printer.cfg. This is very useful to reduce the noise from the printer, for example. However, the SET_VELOCITY_LIMIT macro in RatOS/macros/overrides.cfg overwrites the max_accel value if a macro calls the function with. a higher acceleration . The macro has two branches, neither of which cap the acceleration to max_accel. So when a lower acceleration is set in printer.cfg, the value gets overwritten when the startup macros are activated, particularly RatOS.cfg and vaoc.cfg.

On the Mainsail Dashboard, in the Machine panel, there is the ability to set the machine acceleration, which shows SET_VELOCITY_LIMIT ACCEL=1000 for example in the Console. On a layer change the max_accel also gets overwritten.

What did you expect to happen

I expected that the max_accel set in the printer.cfg file would be persistent and not overwritten to a higher value by other macros. I have not figured out how to make the Mainsail Machine setting persistent, but the following change to the SET_VELOCITY_LIMIT macro in RatOS/macros/overrides.cfg seemed to keep the lower value from the printer.cfg file:

Branch 1 (ACCEL_TO_DECEL defined)

{% if params.ACCEL is defined %}
    {% set accel = [params.ACCEL|float, printer.toolhead.max_accel|float]|min %}
{% else %}
    {% set accel = printer.toolhead.max_accel|float %}
{% endif %}

Branch 2 (no ACCEL_TO_DECEL)

{% if params.ACCEL is defined %}
    {% set accel = [params.ACCEL|float, printer.toolhead.max_accel|float]|min %}
    SET_VELOCITY_LIMIT_BASE ACCEL={accel} { rawparams | replace('ACCEL=' + params.ACCEL|string, '') | trim }
{% else %}
    SET_VELOCITY_LIMIT_BASE { rawparams }
{% endif %}

How to reproduce

In 'printer.cfg' put the following lines:

[printer]
max_accel: 4000

Start a print. As different macros are executed, apparently Beacon probe and VAOC, the acceleration will be increased to 8000 and kept there when trying to print.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions