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

Implement M204 T (separate travel acceleration) #2838

Merged
merged 6 commits into from
Feb 5, 2021

Conversation

wavexx
Copy link
Collaborator

@wavexx wavexx commented Sep 21, 2020

Allow to separate extrusion and travel acceleration settings using M204, as Marlin 1.1.x and 2.x does using M204 T.

This allows to reduce the number of instructions required during printing, since resetting the acceleration just for travel moves is no longer required and can be done a single time during the print.

Provision for this parameter was pre-existing, but not implemented.
M204 has two forms: the lagacy format (Marlin <1.1):

M204 S[print-acc] T[retract-acc]

and the newer format:

M204 P[print-acc] R[retract-acc] T[travel-acc]

The distinction in the MK3 FW is done based on the presence of the P parameter. If P is seen, the new format is already used.

In the new format however, M204 T was ignored until this change.

To keep backward compatibility, M204 S[acc] will set both print and travel acceleration, which is identical in behavior to recent versions of Marlin.

M500 and M503 will report settings using the "new format". A new field in the EEPROM is stored for the travel acceleration, and is initialized with the same value as the print acceleration. The initial default from a fresh eeprom is defined in the variant file, and again it is set to the same value.

@wavexx
Copy link
Collaborator Author

wavexx commented Oct 3, 2020

I'm thinking now that the current travel acceleration also needs to be saved in eeprom during a power-panic, something which is currently missing here.

@wavexx
Copy link
Collaborator Author

wavexx commented Feb 1, 2021

PR should be complete now. Rebased on top of the current master in order to handle new EEPROM offsets without conflicts.

In the last commit I handle all acceleration settings (not just travel acceleration) during UVLO, which were completely skipped before.

Saving and restoring is not 100% correct with this PR, although is better than nothing. See comments on 3840fe3 for details.

This needs to be handled correctly by saving/restore more limits in the future.

Allow to separate extrusion and travel acceleration settings using M204,
as Marlin 1.1.x and 2.x does using M204 T.

This allows to reduce the number of instructions required during
printing, since resetting the acceleration for travel moves is no longer
required and can be done a single time during the print.

Provision for this parameter was pre-existing, but not implemented.
M204 has two forms: the lagacy format (Marlin <1.1):

  M204 S[print-acc] T[retract-acc]

and the newer format:

  M204 P[print-acc] R[retract-acc] T[travel-acc]

The distinction in the MK3 FW is done based on the presence of the P
parameter. If P is seen, the new format is adoped. In the new format
however, M204 T was ignored until this change.

To keep backward compatibility, M204 S[acc] will set both print and
travel acceleration, which is identical in behavior to recent versions
of Marlin.
Use the same value as DEFAULT_ACCELERATION for compatibility.
When reading uninitialized memory, preset the travel acceleration to be
the same as the default acceleration.
Save some space and perform some cleanup
Use the new M204 format consistently also in M503's output
Acceleration settings need to be saved in UVLO, since these are often
changed/set during a print. This is especially important for travel and
retract acceleration, which is usually set once per-print.

Saving and restoring is not 100% correct.

We save the current front-end value, which might ahead of the backend
when UVLO is triggered. Print acceleration, likely the most significant,
should be saved in the block buffer to be accurate.

Acceleration needs to be restored after the UVLO Z repositioning is
performed, using an M204 command. This is correct, however we don't save
the _temporary_ max acceleration limits set via M201, which could be
higher than the saved limits (via M500). This could result in lower
clamped values compared to the original print.

Maximum acceleration/jerk/feedrate limits should _all_ be saved in UVLO
in the future.
@DRracer DRracer merged commit 2dfe213 into prusa3d:MK3 Feb 5, 2021
@wavexx wavexx deleted the m204_travel_acceleration branch February 6, 2021 12:02
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.

2 participants