if (isinf(target)) return ALARM(STAT_MOVE_TARGET_INFINITE);
if (isnan(target)) return ALARM(STAT_MOVE_TARGET_NAN);
- // Compute error correction
-#if 0
- cli();
- int32_t error = m->error;
- int32_t actual_error = error;
- if (error < -MAX_STEP_CORRECTION) error = -MAX_STEP_CORRECTION;
- else if (MAX_STEP_CORRECTION < error) error = MAX_STEP_CORRECTION;
- sei();
-
- if (100 < labs(actual_error)) {
- STATUS_DEBUG("Motor %d error is %ld", motor, actual_error);
- return ALARM(STAT_EXCESSIVE_MOVE_ERROR);
- }
-#endif
-
// Compute motor timer clock and period. Rounding is performed to eliminate
// a negative bias in the uint32_t conversion that results in long-term
// negative drift.
// Setup segment parameters
st.move_type = MOVE_TYPE_ALINE;
- st.seg_period = time * 60 * STEP_TIMER_FREQ; // Must fit 16-bit
+ st.seg_period = round(time * 60 * STEP_TIMER_FREQ); // Must fit 16-bit
int32_t seg_clocks = (int32_t)st.seg_period * STEP_TIMER_DIV;
// Prepare motor moves