[2.0.x] Automatically reset stepper timeout (#10179)

* Automatically reset stepper timeout in manage_inactivity

Any code that adds moves to the planner can skip resetting the stepper timeout. We can let `idle` / `manage_inactivity` reset the timer whenever it detects any moves in the planner.

* blocks_queued => has_blocks_queued
This commit is contained in:
Scott Lahteine
2018-03-21 19:30:06 -05:00
committed by GitHub
parent 97e8a6ebd9
commit 1cb810ff1c
16 changed files with 47 additions and 62 deletions

View File

@ -512,14 +512,14 @@ class Planner {
/**
* Does the buffer have any blocks queued?
*/
static bool blocks_queued() { return (block_buffer_head != block_buffer_tail); }
static bool has_blocks_queued() { return (block_buffer_head != block_buffer_tail); }
/**
* "Discard" the block and "release" the memory.
* Called when the current block is no longer needed.
*/
FORCE_INLINE static void discard_current_block() {
if (blocks_queued())
if (has_blocks_queued())
block_buffer_tail = BLOCK_MOD(block_buffer_tail + 1);
}
@ -528,7 +528,7 @@ class Planner {
* Called after an interrupted move to throw away the rest of the move.
*/
FORCE_INLINE static bool discard_continued_block() {
const bool discard = blocks_queued() && TEST(block_buffer[block_buffer_tail].flag, BLOCK_BIT_CONTINUED);
const bool discard = has_blocks_queued() && TEST(block_buffer[block_buffer_tail].flag, BLOCK_BIT_CONTINUED);
if (discard) discard_current_block();
return discard;
}
@ -539,7 +539,7 @@ class Planner {
* WARNING: Called from Stepper ISR context!
*/
static block_t* get_current_block() {
if (blocks_queued()) {
if (has_blocks_queued()) {
block_t * const block = &block_buffer[block_buffer_tail];
// If the block has no trapezoid calculated, it's unsafe to execute.