Skip to content

Commit

Permalink
Replaced traject_wait_for_completion by pruss stepper function.
Browse files Browse the repository at this point in the history
  • Loading branch information
modmaker committed Jun 16, 2013
1 parent 6aa7efc commit d695bca
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions home.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static int step_until_switch_change( axis_e axis, int reverse, int new_state, in
incMoveNr( pruss_axis);
pruss_queue_dwell( pruss_axis, cmin, *position + direction * (ramp + delta));
pruss_queue_exec_limited( mask, (new_state) ? invert : ~invert);
traject_wait_for_completion();
pruss_wait_for_completion();

pruss_get_positions( pruss_axis, &virtPosI_new, NULL);
if (DEBUG_HOME && (debug_flags & DEBUG_HOME)) {
Expand Down Expand Up @@ -159,7 +159,7 @@ static int run_home_one_axis( axis_e axis, int reverse, int32_t* position, uint3
/// home the selected axis to the selected limit switch.
static void home_one_axis( axis_e axis, int reverse, int32_t* position, uint32_t feed)
{
traject_wait_for_completion();
pruss_wait_for_completion();
// move to a limit switch or sensor
run_home_one_axis( axis, reverse, position, feed);
}
Expand Down
11 changes: 11 additions & 0 deletions pruss_stepper.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,17 @@ int pruss_queue_config_limsw( int axis, uint8_t min_gpio, uint8_t min_invert, ui
return 0;
}

int pruss_wait_for_completion( void)
{
while (!pruss_queue_empty() || pruss_stepper_busy()) {
if (pruss_stepper_halted()) {
return -1;
}
usleep( 500);
}
return 0;
}

/*
* If the idle timeout is not set to 0, the motors will be enabled
* and disabled automatically. The first step pulse asserts the
Expand Down
1 change: 1 addition & 0 deletions pruss_stepper.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern int pruss_dump_position( void);
extern int pruss_stepper_busy( void);
extern int pruss_stepper_halted( void);
extern int pruss_get_positions( int axis, int32_t* virtPosI, int32_t* requestedPos);
extern int pruss_wait_for_completion( void);
extern void pruss_queue_exit( void);
extern void pruss_stepper_resume( void);
extern void pruss_stepper_single_step( void);
Expand Down

0 comments on commit d695bca

Please sign in to comment.