From 6d0574a460fe7d6a9ce9fec85a5e56c4d4828096 Mon Sep 17 00:00:00 2001 From: Joseph Coffland Date: Thu, 20 Jul 2017 16:39:03 -0700 Subject: [PATCH] Removed unnecessary 1/jerk precalculations --- avr/src/axis.c | 18 ++---------------- avr/src/axis.h | 3 --- avr/src/plan/line.c | 3 +-- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/avr/src/axis.c b/avr/src/axis.c index 8953882..0697aaf 100644 --- a/avr/src/axis.c +++ b/avr/src/axis.c @@ -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) diff --git a/avr/src/axis.h b/avr/src/axis.h index eede58f..af7f658 100644 --- a/avr/src/axis.h +++ b/avr/src/axis.h @@ -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); diff --git a/avr/src/plan/line.c b/avr/src/plan/line.c index 8cb845d..1a0a34c 100644 --- a/avr/src/plan/line.c +++ b/avr/src/plan/line.c @@ -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; -- 2.27.0