Skip to content

[SMOOTH_LINEAR_ADVANCE] Fix underflow on disabled shaping AND e-synch when only one axis is shaped #27862

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

Conversation

dbuezas
Copy link
Contributor

@dbuezas dbuezas commented May 17, 2025

Description

There are three bugs in the current implementation:

  1. [fixed here] If only one axis is shaped, the extrusion for the other one will not be accounted for. (only present if you use input shaping in a single axis)
  2. [fixed here] If input shaping is disabled at runtime, the e-sync look back buffer underflows and crashes marlin.
  3. [not fixed here but hinted at in the code] At runtime, the user can set an input shaping frequency lower than SHAPING_MIN_FREQ. This should make input shaping misbehave degrade, and also happens to make e-synch crash marlin. I left a mitigation commented out, and it shouldn't be used since it will result in extrusion issues, and uncommenting it would just hide them.

Regarding the lower frequency limit issue, I see multiple options:

  • Use a very low minimum frequency, which increases the buffer size. Since the isr runs at only 1kHz by default, 10Hz minimum IS freq make the buffer "only" have 100 elements (100322/2= 3200 bits = 400 bytes). This would be the simplest option
  • Add a warning in configuration_adv advising to manually set a SHAPING_MIN_FREQ as low as it can possibly be or face a crash. This would be the most efficient solution.
  • Automatically disabling e-synch if the freq is too low. Sneaky but safe. I don't like it.

Maybe it would be best to combine them all?

Requirements

Benefits

Configurations

Related Issues

@dbuezas dbuezas changed the title Fix underflow on disabled shaping AND e-synch when only one axis is shaped [SMOOTH_LINEAR_ADVANCE] Fix underflow on disabled shaping AND e-synch when only one axis is shaped May 17, 2025
@grizzleeadam
Copy link

This PR did fix my issue of M593 causing a printer lockup when setting values below that in the config (with MIN_FREQ not set).

However, it also causes some ugly stepper noises when using M593 below what's set in the config - I'll have to test to see if setting MIN_FREQ prevents that.

@grizzleeadam
Copy link

Confirmed that setting a SHAPING_MIN_FREQ to a lower value than will be used by M593 does stop the clunky extruder noises. Anything else you want me to test?

@dbuezas
Copy link
Contributor Author

dbuezas commented May 17, 2025

Oh yes going below SHAPING_MIN_FREQ will make e-synch read from out of the buffer. I.e it will be quasi random

@dbuezas
Copy link
Contributor Author

dbuezas commented May 17, 2025

Thanks for the testing btw :)

@grizzleeadam
Copy link

grizzleeadam commented May 17, 2025 via email

@dbuezas
Copy link
Contributor Author

dbuezas commented May 17, 2025

any issue with
leaving a lower MIN_FREQ value enabled

No, it will just use a bit more ram if you set it lower than needed. On a side note: have you already tried higher acceleration printing? Have you otherwise noted quality improvements? And what is your k value?

@grizzleeadam
Copy link

grizzleeadam commented May 17, 2025 via email

@dbuezas
Copy link
Contributor Author

dbuezas commented May 17, 2025

Oh bowden, I'm very curious how it works on bowden. Did you print the cube also without smooth LA? Does your extruder make noises? If it does increase tau.

@grizzleeadam
Copy link

grizzleeadam commented May 17, 2025 via email

@grizzleeadam
Copy link

grizzleeadam commented May 17, 2025 via email

@dbuezas
Copy link
Contributor Author

dbuezas commented May 17, 2025

Oh sounds good. If you could at some point make some before/after pics of that I'd really appreciate it, I plan to make a page in Marlin's help and I only have my own machine which has very low k.

Increasing tau would smooth extrusion even more, it's only worth it if the extruder starts skipping. Otherwise keep it low for highest accuracy

@dbuezas dbuezas force-pushed the dbuezas/fix-e-synch-when-IS-is-disabled branch from fd3dba1 to c496ed2 Compare May 22, 2025 08:12
@thinkyhead thinkyhead merged commit d0e8eda into MarlinFirmware:bugfix-2.1.x May 27, 2025
66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants