Push additional updates from @jgeisler0303

pull/1/head
Sonny Jeon 2013-02-22 13:23:13 -07:00
rodzic ea09ddba99
commit a85e1b80f7
3 zmienionych plików z 8 dodań i 6 usunięć

Wyświetl plik

@ -259,17 +259,17 @@ static uint8_t planner_recalculate()
// check for maximum allowable speed reductions to ensure maximum possible planned speed. // check for maximum allowable speed reductions to ensure maximum possible planned speed.
if (curr_block->entry_speed_sqr != curr_block->max_entry_speed_sqr) { if (curr_block->entry_speed_sqr != curr_block->max_entry_speed_sqr) {
// default if next_entry_speed_sqr > curr_block->max_entry_speed_sqr || max_entry_speed_sqr > curr_block->max_entry_speed_sqr // default if next_entry_speed_sqr > curr_block->max_entry_speed_sqr || max_entry_speed_sqr > curr_block->max_entry_speed_sqr
curr_block->entry_speed_sqr = curr_block->max_entry_speed_sqr; curr_block->new_entry_speed_sqr = curr_block->max_entry_speed_sqr;
if (next_entry_speed_sqr < curr_block->max_entry_speed_sqr) { if (next_entry_speed_sqr < curr_block->max_entry_speed_sqr) {
// Computes: v_entry^2 = v_exit^2 + 2*acceleration*distance // Computes: v_entry^2 = v_exit^2 + 2*acceleration*distance
max_entry_speed_sqr = next_entry_speed_sqr + 2*curr_block->acceleration*curr_block->millimeters; max_entry_speed_sqr = next_entry_speed_sqr + 2*curr_block->acceleration*curr_block->millimeters;
if (max_entry_speed_sqr < curr_block->max_entry_speed_sqr) { if (max_entry_speed_sqr < curr_block->max_entry_speed_sqr) {
curr_block->entry_speed_sqr = max_entry_speed_sqr; curr_block->new_entry_speed_sqr = max_entry_speed_sqr;
} }
} }
} }
next_entry_speed_sqr= curr_block->entry_speed_sqr; next_entry_speed_sqr= curr_block->new_entry_speed_sqr;
current_block_idx= prev_block_index( current_block_idx ); current_block_idx= prev_block_index( current_block_idx );
curr_block= &block_buffer[current_block_idx]; curr_block= &block_buffer[current_block_idx];
@ -286,7 +286,7 @@ static uint8_t planner_recalculate()
// If the current block is an acceleration block, but it is not long enough to complete the // If the current block is an acceleration block, but it is not long enough to complete the
// full speed change within the block, we need to adjust the exit speed accordingly. Entry // full speed change within the block, we need to adjust the exit speed accordingly. Entry
// speeds have already been reset, maximized, and reverse planned by reverse planner. // speeds have already been reset, maximized, and reverse planned by reverse planner.
if (curr_block->entry_speed_sqr < next_block->entry_speed_sqr) { if (curr_block->entry_speed_sqr < next_block->new_entry_speed_sqr) {
// Compute block exit speed based on the current block speed and distance // Compute block exit speed based on the current block speed and distance
// Computes: v_exit^2 = v_entry^2 + 2*acceleration*distance // Computes: v_exit^2 = v_entry^2 + 2*acceleration*distance
max_exit_speed_sqr = curr_block->entry_speed_sqr + 2*curr_block->acceleration*curr_block->millimeters; max_exit_speed_sqr = curr_block->entry_speed_sqr + 2*curr_block->acceleration*curr_block->millimeters;
@ -296,8 +296,8 @@ static uint8_t planner_recalculate()
} }
// adjust max_exit_speed_sqr in case this is a deceleration block or max accel cannot be reached // adjust max_exit_speed_sqr in case this is a deceleration block or max accel cannot be reached
if(max_exit_speed_sqr>next_block->entry_speed_sqr) { if(max_exit_speed_sqr>next_block->new_entry_speed_sqr) {
max_exit_speed_sqr= next_block->entry_speed_sqr; max_exit_speed_sqr= next_block->new_entry_speed_sqr;
} else { } else {
// this block has reached max acceleration, it is optimal // this block has reached max acceleration, it is optimal
planned_block_tail= next_block_idx; planned_block_tail= next_block_idx;

Wyświetl plik

@ -40,6 +40,7 @@ typedef struct {
float nominal_speed_sqr; // The nominal speed for this block in mm/min float nominal_speed_sqr; // The nominal speed for this block in mm/min
float entry_speed_sqr; // Entry speed at previous-current block junction in mm/min float entry_speed_sqr; // Entry speed at previous-current block junction in mm/min
float max_entry_speed_sqr; // Maximum allowable junction entry speed in mm/min float max_entry_speed_sqr; // Maximum allowable junction entry speed in mm/min
float new_entry_speed_sqr; // Temporary entry speed used by the planner
float millimeters; // The total travel of this block in mm float millimeters; // The total travel of this block in mm
float acceleration; float acceleration;
uint8_t recalculate_flag; // Planner flag to recalculate trapezoids on entry junction uint8_t recalculate_flag; // Planner flag to recalculate trapezoids on entry junction

Wyświetl plik

@ -120,6 +120,7 @@ void st_go_idle()
STEPPERS_DISABLE_PORT |= (1<<STEPPERS_DISABLE_BIT); STEPPERS_DISABLE_PORT |= (1<<STEPPERS_DISABLE_BIT);
} }
} }
st.ramp_type = ACCEL_RAMP;
} }