From 7513cfd97cc47d0398adf1a39f963a1da6bbb18a Mon Sep 17 00:00:00 2001 From: Joseph Coffland Date: Wed, 21 Sep 2016 09:08:55 -0700 Subject: [PATCH] Round seg period, removed dead code --- src/motor.c | 15 --------------- src/stepper.c | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/src/motor.c b/src/motor.c index 78d90ab..a39be7d 100644 --- a/src/motor.c +++ b/src/motor.c @@ -403,21 +403,6 @@ stat_t motor_prep_move(int motor, int32_t clocks, float target, int32_t error) { 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. diff --git a/src/stepper.c b/src/stepper.c index 488e667..aad14a5 100644 --- a/src/stepper.c +++ b/src/stepper.c @@ -204,7 +204,7 @@ stat_t st_prep_line(float time, const float target[], const int32_t error[]) { // 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 -- 2.27.0