|
|
|
@ -408,10 +408,13 @@ void Stepper::isr() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// If there is no current block, attempt to pop one from the buffer
|
|
|
|
|
bool first_step = false;
|
|
|
|
|
if (!current_block) {
|
|
|
|
|
// Anything in the buffer?
|
|
|
|
|
if ((current_block = planner.get_current_block())) {
|
|
|
|
|
trapezoid_generator_reset();
|
|
|
|
|
HAL_timer_set_current_count(STEP_TIMER_NUM, 0);
|
|
|
|
|
first_step = true;
|
|
|
|
|
|
|
|
|
|
// Initialize Bresenham counters to 1/2 the ceiling
|
|
|
|
|
counter_X = counter_Y = counter_Z = counter_E = -(current_block->step_event_count >> 1);
|
|
|
|
@ -666,12 +669,18 @@ void Stepper::isr() {
|
|
|
|
|
// Calculate new timer value
|
|
|
|
|
if (step_events_completed <= (uint32_t)current_block->accelerate_until) {
|
|
|
|
|
|
|
|
|
|
#ifdef CPU_32_BIT
|
|
|
|
|
MultiU32X24toH32(acc_step_rate, acceleration_time, current_block->acceleration_rate);
|
|
|
|
|
#else
|
|
|
|
|
MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
|
|
|
|
|
#endif
|
|
|
|
|
acc_step_rate += current_block->initial_rate;
|
|
|
|
|
if (first_step) {
|
|
|
|
|
acc_step_rate = current_block->initial_rate;
|
|
|
|
|
acceleration_time = 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
#ifdef CPU_32_BIT
|
|
|
|
|
MultiU32X24toH32(acc_step_rate, acceleration_time, current_block->acceleration_rate);
|
|
|
|
|
#else
|
|
|
|
|
MultiU24X32toH16(acc_step_rate, acceleration_time, current_block->acceleration_rate);
|
|
|
|
|
#endif
|
|
|
|
|
acc_step_rate += current_block->initial_rate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// upper limit
|
|
|
|
|
NOMORE(acc_step_rate, current_block->nominal_rate);
|
|
|
|
|