![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
3-26-2015 DSV
Fork of R5_StepperDrive by
Diff: StepperDrive.cpp
- Revision:
- 3:97bea13f40a9
- Parent:
- 2:80c0b2a5adc0
- Child:
- 4:754c74beef20
--- a/StepperDrive.cpp Wed Feb 17 16:47:29 2016 +0000 +++ b/StepperDrive.cpp Tue Feb 23 23:36:09 2016 +0000 @@ -10,7 +10,7 @@ invertRight=in6; pit.attach_us(this, &StepperDrive::pitCallback, in9); moveComplete=true; - + } int StepperDrive::move(float distance, float angle) @@ -19,10 +19,10 @@ { //return return -1; } - + float stepDistance=wheelCircum/(200*Ustep); float d, dl, dr; - + if(distance==0 && angle!=0) { d=angle*wheelSepar/2; @@ -44,7 +44,7 @@ { dl=angle*(distance/angle+wheelSepar/2); dr=angle*(distance/angle-wheelSepar/2); - + leftSteps=dl/stepDistance; rightSteps=dr/stepDistance; leftStepsPC=-1; @@ -55,7 +55,7 @@ { dl=angle*(distance/angle-wheelSepar/2); dr=angle*(distance/angle+wheelSepar/2); - + leftSteps=dl/stepDistance; rightSteps=dr/stepDistance; leftStepsPC=-1*(dl/dr); @@ -120,12 +120,12 @@ leftStep=1; wait_us(3); leftStep=0; - + /* completed 1 step (increment or decrement */ if(leftSteps < 0) leftSteps++; else - leftSteps--; + leftSteps--; } void StepperDrive::stepRight(bool dir) @@ -134,12 +134,12 @@ rightStep=1; wait_us(3); rightStep=0; - + /* completed 1 step (increment or decrement */ if(rightSteps < 0) rightSteps++; else - rightSteps--; + rightSteps--; } bool StepperDrive::isMoveDone()