Removed unnecessary 1/jerk precalculations
authorJoseph Coffland <joseph@cauldrondevelopment.com>
Thu, 20 Jul 2017 23:39:03 +0000 (16:39 -0700)
committerJoseph Coffland <joseph@cauldrondevelopment.com>
Thu, 20 Jul 2017 23:39:03 +0000 (16:39 -0700)
avr/src/axis.c
avr/src/axis.h
avr/src/plan/line.c

index 8953882b4a226d132b9ec2b7d08e473aeb3a2494..0697aafb056b193757f9ba5ef6d142661d708d21 100644 (file)
@@ -43,7 +43,6 @@ typedef struct {
   float travel_max;      // max work envelope for soft limits
   float travel_min;      // min work envelope for soft limits
   float jerk_max;        // max jerk (Jm) in km/min^3
-  float recip_jerk;      // reciprocal of current jerk in min^3/km
   float radius;          // radius in mm for rotary axes
   float search_velocity; // homing search velocity
   float latch_velocity;  // homing latch velocity
@@ -77,12 +76,7 @@ int axis_get_id(char axis) {
 
 
 int axis_get_motor(int axis) {return motor_map[axis];}
-
-
-void axis_set_motor(int axis, int motor) {
-  motor_map[axis] = motor;
-  axis_set_jerk_max(axis, axes[axis].jerk_max); // Init 1/jerk
-}
+void axis_set_motor(int axis, int motor) {motor_map[axis] = motor;}
 
 
 float axis_get_vector_length(const float a[], const float b[]) {
@@ -128,11 +122,10 @@ AXIS_GET(search_velocity, float, 0)
 AXIS_GET(latch_velocity, float, 0)
 AXIS_GET(zero_backoff, float, 0)
 AXIS_GET(latch_backoff, float, 0)
-AXIS_GET(recip_jerk, float, 0)
 
 /* Note on jerk functions
  *
- * Jerk values can be rather large. Jerk values are stored in the system in
+ * Jerk values can be rather large.  Jerk values are stored in the system in
  * truncated format; values are divided by 1,000,000 then multiplied before use.
  *
  * The axis_jerk() functions expect the jerk in divided by 1,000,000 form.
@@ -140,13 +133,6 @@ AXIS_GET(recip_jerk, float, 0)
 AXIS_GET(jerk_max, float, 0)
 
 
-/// Sets jerk and its reciprocal for axis
-void axis_set_jerk_max(int axis, float jerk) {
-  axes[axis].jerk_max = jerk;
-  axes[axis].recip_jerk = 1.0 / jerk;
-}
-
-
 AXIS_VAR_SET(velocity_max, float)
 AXIS_VAR_SET(radius, float)
 AXIS_VAR_SET(travel_min, float)
index eede58f10eba8adb3009a87bc1309f96f7688f6b..af7f658e868fe972f8299421255fb7e0203edc0c 100644 (file)
@@ -58,7 +58,6 @@ float axis_get_vector_length(const float a[], const float b[]);
 
 float axis_get_velocity_max(int axis);
 float axis_get_jerk_max(int axis);
-void axis_set_jerk_max(int axis, float jerk);
 bool axis_get_homed(int axis);
 void axis_set_homed(int axis, bool homed);
 homing_mode_t axis_get_homing_mode(int axis);
@@ -70,5 +69,3 @@ float axis_get_search_velocity(int axis);
 float axis_get_latch_velocity(int axis);
 float axis_get_zero_backoff(int axis);
 float axis_get_latch_backoff(int axis);
-float axis_get_recip_jerk(int axis);
-float axis_get_jerk_max(int axis);
index 8cb845d87eb9c4c7fd3a7cc96cbce2dbb983afb3..1a0a34c8ca1bcdb23c7c8a2d5cb195246d705b0f 100644 (file)
@@ -189,8 +189,7 @@ static float _get_junction_vmax(const float a_unit[], const float b_unit[]) {
  *
  *   C[n]^2 = 1 / J[n] * D[n]^2
  *
- * We don't care that C is squared, so we'll use it that way.  Also note that
- * we already have 1 / J[n] calculated for each axis.
+ * We don't care that C is squared, so we'll use it that way.
  */
 int mp_find_jerk_axis(const float axis_square[]) {
   float C;