Code cleanup and force-inline removal testing

This commit is contained in:
Ted Hess 2017-11-15 09:00:02 -05:00
parent ad0f7ff33b
commit c9db6ac451
2 changed files with 5 additions and 9 deletions

View File

@ -153,6 +153,7 @@ static inline int8_t prev_block_index(int8_t block_index) {
//=============================functions ============================ //=============================functions ============================
//=========================================================================== //===========================================================================
#if 0
// Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the // Calculates the distance (not time) it takes to accelerate from initial_rate to target_rate using the
// given acceleration: // given acceleration:
FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration) FORCE_INLINE float estimate_acceleration_distance(float initial_rate, float target_rate, float acceleration)
@ -181,6 +182,7 @@ FORCE_INLINE float intersection_distance(float initial_rate, float final_rate, f
return 0.0; // acceleration was 0, set intersection distance to 0 return 0.0; // acceleration was 0, set intersection distance to 0
} }
} }
#endif
#define MINIMAL_STEP_RATE 120 #define MINIMAL_STEP_RATE 120
@ -418,7 +420,7 @@ void plan_init() {
block_buffer_tail = 0; block_buffer_tail = 0;
memset(position, 0, sizeof(position)); // clear position memset(position, 0, sizeof(position)); // clear position
#ifdef LIN_ADVANCE #ifdef LIN_ADVANCE
memset(position_float, 0, sizeof(position)); // clear position memset(position_float, 0, sizeof(position_float)); // clear position
#endif #endif
previous_speed[0] = 0.0; previous_speed[0] = 0.0;
previous_speed[1] = 0.0; previous_speed[1] = 0.0;

View File

@ -282,13 +282,7 @@ void st_wake_up() {
ENABLE_STEPPER_DRIVER_INTERRUPT(); ENABLE_STEPPER_DRIVER_INTERRUPT();
} }
void step_wait(){ unsigned short calc_timer(unsigned short step_rate) {
for(int8_t i=0; i < 6; i++){
}
}
FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
unsigned short timer; unsigned short timer;
if(step_rate > MAX_STEP_FREQUENCY) step_rate = MAX_STEP_FREQUENCY; if(step_rate > MAX_STEP_FREQUENCY) step_rate = MAX_STEP_FREQUENCY;
@ -325,7 +319,7 @@ FORCE_INLINE unsigned short calc_timer(unsigned short step_rate) {
// Initializes the trapezoid generator from the current block. Called whenever a new // Initializes the trapezoid generator from the current block. Called whenever a new
// block begins. // block begins.
FORCE_INLINE void trapezoid_generator_reset() { void trapezoid_generator_reset() {
deceleration_time = 0; deceleration_time = 0;
// step_rate to timer interval // step_rate to timer interval
OCR1A_nominal = calc_timer(current_block->nominal_rate); OCR1A_nominal = calc_timer(current_block->nominal_rate);