|
|
@ -447,13 +447,10 @@ void Stepper::isr() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// If there is no current block, attempt to pop one from the buffer
|
|
|
|
// If there is no current block, attempt to pop one from the buffer
|
|
|
|
bool first_step = false;
|
|
|
|
|
|
|
|
if (!current_block) {
|
|
|
|
if (!current_block) {
|
|
|
|
// Anything in the buffer?
|
|
|
|
// Anything in the buffer?
|
|
|
|
if ((current_block = planner.get_current_block())) {
|
|
|
|
if ((current_block = planner.get_current_block())) {
|
|
|
|
trapezoid_generator_reset();
|
|
|
|
trapezoid_generator_reset();
|
|
|
|
TCNT1 = 0; // make sure first pulse is not truncated
|
|
|
|
|
|
|
|
first_step = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Initialize Bresenham counters to 1/2 the ceiling
|
|
|
|
// Initialize Bresenham counters to 1/2 the ceiling
|
|
|
|
counter_X = counter_Y = counter_Z = counter_E = -(current_block->step_event_count >> 1);
|
|
|
|
counter_X = counter_Y = counter_Z = counter_E = -(current_block->step_event_count >> 1);
|
|
|
@ -708,14 +705,8 @@ void Stepper::isr() {
|
|
|
|
// Calculate new timer value
|
|
|
|
// Calculate new timer value
|
|
|
|
if (step_events_completed <= (uint32_t)current_block->accelerate_until) {
|
|
|
|
if (step_events_completed <= (uint32_t)current_block->accelerate_until) {
|
|
|
|
|
|
|
|
|
|
|
|
if (first_step) {
|
|
|
|
MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
|
|
|
|
acc_step_rate = current_block->initial_rate;
|
|
|
|
acc_step_rate += current_block->initial_rate;
|
|
|
|
acceleration_time = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
|
|
|
|
|
|
|
|
acc_step_rate += current_block->initial_rate;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// upper limit
|
|
|
|
// upper limit
|
|
|
|
NOMORE(acc_step_rate, current_block->nominal_rate);
|
|
|
|
NOMORE(acc_step_rate, current_block->nominal_rate);
|
|
|
|