-
-
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
Planner trapezoidal nominal_rate fix #26881
Merged
thinkyhead
merged 33 commits into
MarlinFirmware:bugfix-2.1.x
from
HoverClub:Trap-nominal-fix
Jul 13, 2024
Merged
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
f4562be
Fix planner wrong trap generation
HoverClub a7a4152
Update planner.cpp
HoverClub 0257384
Update planner.h
HoverClub cdb0b1c
Update planner.h
HoverClub 3b887b4
Update planner.h
HoverClub 0c8c741
Merge branch 'MarlinFirmware:bugfix-2.1.x' into Trap-nominal-fix
HoverClub 5e0158a
Update planner.cpp
HoverClub 3da5d0c
Update planner.h
HoverClub ddf9681
Merge branch 'bugfix-2.1.x' into pr/26881
thinkyhead 9f2b99b
Revert "Update planner.cpp"
HoverClub 22f7de5
Update planner.cpp
HoverClub 2d46cc3
Update planner.h
HoverClub e2ecb03
Update planner.cpp
HoverClub 8556962
Merge branch 'bugfix-2.1.x' into pr/26881
thinkyhead bf5a532
ws
thinkyhead 2396c0f
Apply to min_step_rate
thinkyhead a67be24
misc cosmetics
thinkyhead db58fa9
Merge branch 'bugfix-2.1.x' into pr/26881
thinkyhead e5cb811
Merge branch 'bugfix-2.1.x' into pr/26881
thinkyhead 551dfa2
comment
thinkyhead 7c6daa7
allow merge sooner
thinkyhead f2d6cfd
not needed
thinkyhead e7d301f
Merge branch 'bugfix-2.1.x' into pr/26881
thinkyhead cd6b8c8
use _MAX, remove NOMOREs
thinkyhead 481369e
tweak
thinkyhead a63df47
type happy
thinkyhead 65af7d2
shorten lines
thinkyhead fe400a2
hygdmfsc
thinkyhead 83697e9
Merge branch 'bugfix-2.1.x' into pr/26881
thinkyhead c32f6c6
merge followup
thinkyhead 03ef8d2
keep comment
thinkyhead 02f9dc0
followup
thinkyhead 3b27a8e
Merge branch 'bugfix-2.1.x' into pr/26881
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
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
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
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
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
Oops, something went wrong.
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.
I took another look and the
step_rate <= minimal_step_rate
case is not correct, although it wasn't correct before either.STEPPER_TIMER_RATE
is at 100-500Mhz, divided by some 4/8 prescale. So somewhere around 10-200 million.However,
HAL_TIMER_TYPE_MAX
is usually 0xFFFFFFFF or ~4 billion. So if we're at the minimal_step_rate of 1 (usually) we'll be waiting forHAL_TIMER_TYPE_MAX
ticks which at 10-200 million rate will take in the range of 400-20 seconds.Maybe switch to:
return step_rate > minimal_step_rate ? uint32_t(STEPPER_TIMER_RATE) / step_rate : MIN(STEPPER_TIMER_RATE, HAL_TIMER_TYPE_MAX);
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.
The choice to use
HAL_TIMER_TYPE_MAX
to prevent a divide by zero incalc_timer_interval
originally comes from #25557. The aim was to use the value closest to infinity when thestep_rate
was equal to zero.This was updated in #25696 to not just apply to a
step_rate
of zero, but to any step rate below a minimum threshold.If the value returned from
calc_timer_interval
is later used in a divide bySTEPPER_TIMER_RATE
operation that expects a result >= 1, it makes sense to make that our substitute for infinity, but with this value being 1/8 ofHAL_TIMER_TYPE_MAX
, it means more likelihood of a divide result of 1 or greater.There is some code that expects
HAL_TIMER_TYPE_MAX
to be returned. Specifically, code that looks forLA_ADV_NEVER
expects it to be equal toHAL_TIMER_TYPE_MAX
, and when this value is returned it essentially represents "never."So, can this really be done? You and I and @tombrazier will need to look closer at this question.