-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
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
Fixed Time Motion: Fix switching on or off FTM when printing #27335
Merged
thinkyhead
merged 9 commits into
MarlinFirmware:bugfix-2.1.x
from
narno2202:FTM_On_Off_fix
Aug 17, 2024
Merged
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
258ccec
M493 S0 or S1 are forbidden during a print
narno2202 80816de
M493 S0 ans S1 possible when printing
narno2202 5e30734
Merge branch 'bugfix-2.1.x' into FTM_On_Off_fix
narno2202 7ab808c
Merge branch 'MarlinFirmware:bugfix-2.1.x' into FTM_On_Off_fix
narno2202 31d4c7b
Merge branch 'bugfix-2.1.x' into FTM_On_Off_fix
narno2202 7aa73d7
told em so
thinkyhead eaa9ed4
format
thinkyhead 7ae5980
just report
thinkyhead 6995edd
might as well…
thinkyhead File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,27 +190,20 @@ void GcodeSuite::M493_report(const bool forReplay/*=true*/) { | |
* R 0.00 Set the vibration tolerance for the Y axis | ||
*/ | ||
void GcodeSuite::M493() { | ||
struct { bool update:1, reset_ft:1, report_h:1; } flag = { false }; | ||
struct { bool update:1, report_h:1; } flag = { false }; | ||
|
||
if (!parser.seen_any()) | ||
flag.report_h = true; | ||
|
||
// Parse 'S' mode parameter. | ||
if (parser.seen('S')) { | ||
const bool active = parser.value_bool(); | ||
|
||
if (active != ftMotion.cfg.active) { | ||
switch (active) { | ||
case false: | ||
flag.reset_ft = true; | ||
// fall-thru | ||
case true: | ||
const bool active = parser.value_bool(); | ||
if (active != ftMotion.cfg.active) { | ||
flag.report_h = true; | ||
stepper.ftMotion_syncPosition(); | ||
ftMotion.cfg.active = active; | ||
break; | ||
} | ||
} | ||
} | ||
} | ||
|
||
#if HAS_X_AXIS | ||
auto set_shaper = [&](const AxisEnum axis, const char c) { | ||
|
@@ -309,7 +302,7 @@ void GcodeSuite::M493() { | |
// TODO: Frequency minimum is dependent on the shaper used; the above check isn't always correct. | ||
if (WITHIN(val, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2)) { | ||
ftMotion.cfg.baseFreq.x = val; | ||
flag.update = flag.reset_ft = flag.report_h = true; | ||
flag.update = flag.report_h = true; | ||
} | ||
else // Frequency out of range. | ||
SERIAL_ECHOLNPGM("Invalid [", C('A'), "] frequency value."); | ||
|
@@ -370,7 +363,7 @@ void GcodeSuite::M493() { | |
const float val = parser.value_float(); | ||
if (WITHIN(val, FTM_MIN_SHAPE_FREQ, (FTM_FS) / 2)) { | ||
ftMotion.cfg.baseFreq.y = val; | ||
flag.update = flag.reset_ft = flag.report_h = true; | ||
flag.update = flag.report_h = true; | ||
} | ||
else // Frequency out of range. | ||
SERIAL_ECHOLNPGM("Invalid frequency [", C('B'), "] value."); | ||
|
@@ -423,15 +416,8 @@ void GcodeSuite::M493() { | |
|
||
#endif // HAS_Y_AXIS | ||
|
||
planner.synchronize(); | ||
|
||
if (flag.update) ftMotion.update_shaping_params(); | ||
|
||
if (flag.reset_ft) { | ||
stepper.ftMotion_syncPosition(); | ||
ftMotion.reset(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we certain that changing any of the above parameters does/will not require |
||
|
||
if (flag.report_h) say_shaping(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a smart idea to synchronize before modifying the parameters that
ftMotion
uses to do its motion. Are we certain it is / will always be safe to callupdate_shaping_params
while a move is still ongoing?