void stepperMoveZero() { if (!stepperStepNumber) { stepperStep(stepperStepsPerRotation - stepperStepNumber); } }
/************************************************************************* Author: Josiah Snarr Date: April 11, 2015 stepperHome finds the stepper limits on the platform, and centers the stepper at the midpoint between them *************************************************************************/ void stepperHome(void) { unsigned int midpoint; //Delay stops it from going "ttttttzzzhhggggghhghhzzzzzttttt" msDelay(25); //Go fully left while(IS_CLR(STEP_SWI_PORT, SWI_LEFT)) { stepperStep(); msDelay(2); } //All the way left, 0-position, switch direction currStep = 0; SWI_DIR(direction); //Go all the way right while(IS_CLR(STEP_SWI_PORT, SWI_RIGHT)) { stepperStep(); msDelay(2); } //All the way right, number of steps is current step, find midpoint and switch direction numSteps = currStep; midpoint = currStep/2; SWI_DIR(direction); //Move to midpoint while(currStep != midpoint) { stepperStep(); msDelay(2); } }
void stepperMoveHome() { stepperStep(stepperPosition * -1); }