Fixed motor reverse config
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Sun, 22 Jan 2017 03:38:39 +0000 (19:38 -0800)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Sun, 22 Jan 2017 03:38:39 +0000 (19:38 -0800)
avr/src/motor.c

index 69a9de456bea7ce2784d4eb62f0db26d3b668d09..44789a197682a45d6c73b34c7c1b52ee354c2adf 100644 (file)
@@ -455,8 +455,8 @@ stat_t motor_prep_move(int motor, int32_t clocks, float target, int32_t error,
 
   // Setup the direction, compensating for polarity.
   m->negative = travel < 0;
-  if (m->negative) m->direction = DIRECTION_CCW ^ m->reverse;
-  else m->direction = DIRECTION_CW ^ m->reverse;
+  if (m->negative ^ m->reverse) m->direction = DIRECTION_CCW;
+  else m->direction = DIRECTION_CW;
 
   // Find the clock rate that will fit the required number of steps
   if (ticks_per_step <= 0xffff) m->timer_clock = TC_CLKSEL_DIV1_gc;