Reinstated feed holds into new stepper algorithm and planner. Rough draft, but working.
- Reinstated the feed hold feature with the new stepper algorithm and new optimized planner. It works, but will be re-factored a bit soon to clean up the code. - At this point, feedrate overrides may need to be installed in the v1.0 version of grbl, while this version will likely be pushed to the edge branch soon and pushed to master after the bugs have been squashed. - Measured the overall performance of the new planner and stepper algorithm on an oscilloscope. The new planner is about 4x faster than before, where it is completing a plan in around 1ms. The stepper algorithm itself is minutely faster, as it is a little lighter. The trade-off in the increased planner performance comes from the new step segment buffer. However, even in the worse case scenario, the step segment buffer generates a new segment with a typical 0.2 ms, and the worse case is 1ms upon a new block or replanning the active block. Added altogether, it’s argubly still twice as efficient as the old one.
This commit is contained in:
17
planner.c
17
planner.c
@ -399,10 +399,6 @@ void plan_buffer_line(float *target, float feed_rate, uint8_t invert_feed_rate)
|
||||
|
||||
// Finish up by recalculating the plan with the new block.
|
||||
planner_recalculate();
|
||||
|
||||
// int32_t blength = block_buffer_head - block_buffer_tail;
|
||||
// if (blength < 0) { blength += BLOCK_BUFFER_SIZE; }
|
||||
// printInteger(blength);
|
||||
}
|
||||
|
||||
|
||||
@ -418,19 +414,10 @@ void plan_sync_position()
|
||||
|
||||
// Re-initialize buffer plan with a partially completed block, assumed to exist at the buffer tail.
|
||||
// Called after a steppers have come to a complete stop for a feed hold and the cycle is stopped.
|
||||
void plan_cycle_reinitialize(int32_t step_events_remaining)
|
||||
void plan_cycle_reinitialize()
|
||||
{
|
||||
plan_block_t *block = &block_buffer[block_buffer_tail]; // Point to partially completed block
|
||||
|
||||
// Only remaining millimeters and step_event_count need to be updated for planner recalculate.
|
||||
// Other variables (step_x, step_y, step_z, rate_delta, etc.) all need to remain the same to
|
||||
// ensure the original planned motion is resumed exactly.
|
||||
block->millimeters = (block->millimeters*step_events_remaining)/block->step_event_count;
|
||||
block->step_event_count = step_events_remaining;
|
||||
|
||||
// Re-plan from a complete stop. Reset planner entry speeds and buffer planned pointer.
|
||||
block->entry_speed_sqr = 0.0;
|
||||
block->max_entry_speed_sqr = 0.0;
|
||||
// st_update_plan_block_parameters();
|
||||
block_buffer_planned = block_buffer_tail;
|
||||
planner_recalculate();
|
||||
}
|
||||
|
Reference in New Issue
Block a user