text
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Tue, 28 Mar 2017 06:50:58 +0000 (23:50 -0700)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Tue, 28 Mar 2017 06:50:58 +0000 (23:50 -0700)
avr/BezierMath.md
avr/MoveLifecycleCalls.md
avr/src/motor.c
avr/src/plan/runtime.c

index f8f4e5a6e867744b6a4d97a6625c7445b8fe3c8c..f9da75a39488921d7987b58fbce0470cc20f3544 100644 (file)
@@ -52,4 +52,5 @@
     B = 1
     e = 0
 
-    x^4 (x^2 - 3x + 5/2)
+    f(x) = 6x^5 -15x^4 + 10x^3
+    int f(x) dx = x^6 - 3x^5 + 5/2x^4 + C
index 5a9923b00879ef35ea26beec9513f4d230a28702..8c8feb9f5c6f4a7159f0a111b6684967dfc5ad4b 100644 (file)
@@ -30,7 +30,7 @@
              * mp_init_forward_dif() || mp_next_forward_dif()
              * _exec_aline_segment()
                * mp_runtime_move_to_target()
-                 * mp_kinematics() - Converts target in mm to steps
+                 * mp_kinematics() - Converts target mm to steps and maps motors
                  * st_prep_line()
                    * motor_prep_move()
 
index 145e6400cf69a2eb208e56654e782e2aa8374cd4..d43a769880941c1187efdfd4494d8e1d0293bc78 100644 (file)
@@ -444,7 +444,7 @@ 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 motor timer clock and period. Rounding is performed to eliminate
+  // 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.
   int32_t travel = round(target) - m->position + error;
@@ -454,9 +454,11 @@ stat_t motor_prep_move(int motor, int32_t clocks, float target, int32_t error,
   m->negative = travel < 0;
   if (m->negative ^ m->reverse) m->direction = DIRECTION_CCW;
   else m->direction = DIRECTION_CW;
+
+  // Use positive travel from here on
   if (m->negative) travel = -travel;
 
-  // Find the clock rate that will fit the required number of steps
+  // Find the fastest clock rate that will fit the required number of steps
   uint32_t ticks_per_step = travel ? clocks / 2 / travel : 0;
   if (ticks_per_step <= 0xffff) m->timer_clock = TC_CLKSEL_DIV1_gc;
   else if (ticks_per_step <= 0x1ffff) m->timer_clock = TC_CLKSEL_DIV2_gc;
index 6907d76efbb8ad9a68af30268d3d8ce2e2db323e..cf848a79d0b809925e2714a3856ab54c325b9977 100644 (file)
@@ -152,8 +152,7 @@ void mp_runtime_set_work_offsets(float offset[]) {
 }
 
 
-static void _step_correction(const float steps[], float time,
-                             int32_t error[]) {
+static void _step_correction(const float steps[], float time, int32_t error[]) {
 #ifdef STEP_CORRECTION
   float travel[MOTORS];
   float new_length_sqr = 0;