Clean up planner kernel pass methods

This commit is contained in:
Scott Lahteine 2016-08-30 14:16:13 -05:00
parent b2e5ec85d7
commit d554c1dda8
2 changed files with 7 additions and 9 deletions

View file

@ -203,9 +203,8 @@ void Planner::calculate_trapezoid_for_block(block_t* block, float entry_factor,
// The kernel called by recalculate() when scanning the plan from last to first entry.
void Planner::reverse_pass_kernel(block_t* previous, block_t* current, block_t* next) {
void Planner::reverse_pass_kernel(block_t* current, block_t* next) {
if (!current) return;
UNUSED(previous);
if (next) {
// If entry speed is already at the maximum entry speed, no need to recheck. Block is cruising.
@ -250,15 +249,14 @@ void Planner::reverse_pass() {
block[2] = block[1];
block[1] = block[0];
block[0] = &block_buffer[b];
reverse_pass_kernel(block[0], block[1], block[2]);
reverse_pass_kernel(block[1], block[2]);
}
}
}
// The kernel called by recalculate() when scanning the plan from first to last entry.
void Planner::forward_pass_kernel(block_t* previous, block_t* current, block_t* next) {
void Planner::forward_pass_kernel(block_t* previous, block_t* current) {
if (!previous) return;
UNUSED(next);
// If the previous block is an acceleration block, but it is not long enough to complete the
// full speed change within the block, we need to adjust the entry speed accordingly. Entry
@ -288,9 +286,9 @@ void Planner::forward_pass() {
block[0] = block[1];
block[1] = block[2];
block[2] = &block_buffer[b];
forward_pass_kernel(block[0], block[1], block[2]);
forward_pass_kernel(block[0], block[1]);
}
forward_pass_kernel(block[1], block[2], NULL);
forward_pass_kernel(block[1], block[2]);
}
/**

View file

@ -320,8 +320,8 @@ class Planner {
static void calculate_trapezoid_for_block(block_t* block, float entry_factor, float exit_factor);
static void reverse_pass_kernel(block_t* previous, block_t* current, block_t* next);
static void forward_pass_kernel(block_t* previous, block_t* current, block_t* next);
static void reverse_pass_kernel(block_t* current, block_t* next);
static void forward_pass_kernel(block_t* previous, block_t* current);
static void reverse_pass();
static void forward_pass();