// planner_recalculate() needs to go over the current plan twice. Once in reverse and once forward. This // implements the reverse pass. void planner_reverse_pass() { auto int8_t block_index = block_buffer_head; block_t *block[3] = { NULL, NULL, NULL }; while (block_index != block_buffer_tail) { block_index--; if (block_index < 0) { block_index = BLOCK_BUFFER_SIZE - 1; } block[2] = block[1]; block[1] = block[0]; block[0] = &block_buffer[block_index]; planner_reverse_pass_kernel(block[0], block[1], block[2]); } planner_reverse_pass_kernel(NULL, block[0], block[1]); }
void TimeEstimateCalculator::reverse_pass() { Block* block[3] = {NULL, NULL, NULL}; for(unsigned int n=blocks.size()-1; int(n)>=0; n--) { block[2]= block[1]; block[1]= block[0]; block[0] = &blocks[n]; planner_reverse_pass_kernel(block[0], block[1], block[2]); } }
// planner_recalculate() needs to go over the current plan twice. Once in reverse and once forward. This // implements the reverse pass. static void planner_reverse_pass() { auto int8_t block_index = block_buffer_head; block_t *block[3] = {NULL, NULL, NULL}; while(block_index != block_buffer_tail) { block_index = prev_block_index( block_index ); block[2]= block[1]; block[1]= block[0]; block[0] = &block_buffer[block_index]; planner_reverse_pass_kernel(block[0], block[1], block[2]); } // Skip buffer tail/first block to prevent over-writing the initial entry speed. }
// planner_recalculate() needs to go over the current plan twice. Once in reverse and once forward. This // implements the reverse pass. void planner_reverse_pass() { char block_index = block_buffer_head; if(((block_buffer_head-block_buffer_tail + BLOCK_BUFFER_SIZE) & (BLOCK_BUFFER_SIZE - 1)) > 3) { block_index = (block_buffer_head - 3) & (BLOCK_BUFFER_SIZE - 1); block_t *block[3] = { NULL, NULL, NULL }; while(block_index != block_buffer_tail) { block_index = prev_block_index(block_index); block[2]= block[1]; block[1]= block[0]; block[0] = &block_buffer[block_index]; planner_reverse_pass_kernel(block[0], block[1], block[2]); } } }
// planner_recalculate() needs to go over the current plan twice. Once in reverse and once forward. This // implements the reverse pass. void planner_reverse_pass() { uint8_t block_index = block_buffer_head; //Make a local copy of block_buffer_tail, because the interrupt can alter it CRITICAL_SECTION_START; unsigned char tail = block_buffer_tail; CRITICAL_SECTION_END if (BLOCK_MOD(block_buffer_head - tail + BLOCK_BUFFER_SIZE) > 3) { // moves queued block_t *block[3] = { NULL, NULL, NULL }; while (block_index != tail) { block_index = prev_block_index(block_index); block[2]= block[1]; block[1]= block[0]; block[0] = &block_buffer[block_index]; planner_reverse_pass_kernel(block[0], block[1], block[2]); } } }
// planner_recalculate() needs to go over the current plan twice. Once in reverse and once forward. This // implements the reverse pass. void planner_reverse_pass() { uint8_t block_index = block_buffer_head; //Make a local copy of block_buffer_tail, because the interrupt can alter it CRITICAL_SECTION_START; unsigned char tail = block_buffer_tail; CRITICAL_SECTION_END; if(((block_buffer_head - tail + block_buffer_size) & block_buffer_mask) > 3) { block_index = (block_buffer_head - 3) & block_buffer_mask; block_t *block[3] = { NULL, NULL, NULL }; while(block_index != tail) { block_index = prev_block_index(block_index); block[2]= block[1]; block[1]= block[0]; block[0] = &block_buffer[block_index]; planner_reverse_pass_kernel(block[0], block[1], block[2]); } } }