-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Keep stepcompress move history relative to current time #6439
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b983e7f
Expire history relative to current time rather than last move in hist…
EiNSTeiN- 8ce5a1a
Make steppersync_history_expire static
EiNSTeiN- b688b3a
Remove all history rather than keeping it where appropriate
EiNSTeiN- 120fe41
Use print time rather than system time for history expiry
EiNSTeiN- 6dc8d59
Clear trapq history consistently everywhere
EiNSTeiN- 3ebea98
Do not flush trapq history where appropriate
EiNSTeiN- File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,11 +163,10 @@ trapq_append(struct trapq *tq, double print_time | |
} | ||
} | ||
|
||
#define HISTORY_EXPIRE (30.0) | ||
|
||
// Expire any moves older than `print_time` from the trapezoid velocity queue | ||
void __visible | ||
trapq_finalize_moves(struct trapq *tq, double print_time) | ||
trapq_finalize_moves(struct trapq *tq, double print_time | ||
, double clear_history_time) | ||
{ | ||
struct move *head_sentinel = list_first_entry(&tq->moves, struct move,node); | ||
struct move *tail_sentinel = list_last_entry(&tq->moves, struct move, node); | ||
|
@@ -190,10 +189,9 @@ trapq_finalize_moves(struct trapq *tq, double print_time) | |
if (list_empty(&tq->history)) | ||
return; | ||
struct move *latest = list_first_entry(&tq->history, struct move, node); | ||
double expire_time = latest->print_time + latest->move_t - HISTORY_EXPIRE; | ||
for (;;) { | ||
struct move *m = list_last_entry(&tq->history, struct move, node); | ||
if (m == latest || m->print_time + m->move_t > expire_time) | ||
if (m == latest || m->print_time + m->move_t > clear_history_time) | ||
break; | ||
list_del(&m->node); | ||
free(m); | ||
|
@@ -206,7 +204,7 @@ trapq_set_position(struct trapq *tq, double print_time | |
, double pos_x, double pos_y, double pos_z) | ||
{ | ||
// Flush all moves from trapq | ||
trapq_finalize_moves(tq, NEVER_TIME); | ||
trapq_finalize_moves(tq, NEVER_TIME, 0); | ||
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. This would introduce a subtle change in behavior. All places that fully cleared the history should continue to fully clear the history - thus |
||
|
||
// Prune any moves in the trapq history that were interrupted | ||
while (!list_empty(&tq->history)) { | ||
|
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
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.
Just for the record I think we're now clearing the history in places where we wouldn't have before which is a change in behavior. When
print_time
isNEVER_TIME
(or a large value) all the moves would get transferred to the history, but this code would still only clear 30s prior to the last move because of the math on this line. This is why I had the new parameter as 0 initially (to keep the history until this is called from the toolhead code).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.
Okay, I goofed. You are correct and I misread the original code. I think we do want to avoid a change in behavior here, because this is an area of the code where we really want to be able to use tools like
git bisect
if necessary.If I'm reading the code correctly, the call in
trapq_finalize_moves()
doesn't need to flush the history (it can use0
), and the code inDripModeEndSignal
doesn't need to flush (it can also use0
). However, the code in manual_stepper.py and force_move.py do need to fully flush (using the current+ 99999.9
method) as nothing else will free the history (and nothing uses the history of these modules).Does that sound correct?
Thanks.
-Kevin
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.
If you mean
trapq_set_position
and nottrapq_finalize_moves
that looks correct to me (as in, it preserves the current behavior), however I'm not super familiar with this code. I left the other 2 calls with+ 99999.9
to clear the history.