Modified phase table in stepper.cpp to enable stepping a bipolar motor using a twin H-bridge driver.
Fork of stepper by
Corrected single-stepping, now walking up or down just one phase table. Compile-time options for driving bipolar motor in any of single-phase, two-phase, or half-stepping. Coils remain engaged at end of specifed movement command - de-energize coils by issuing a motor.move(0) while already stopped.
Revision 5:f2bbcd06019e, committed 2014-12-22
- Comitter:
- gregeric
- Date:
- Mon Dec 22 21:15:55 2014 +0000
- Parent:
- 4:5b596b405573
- Child:
- 6:ee6c96064559
- Commit message:
- Fix bug with direction change to CW for deceleration phase after issuing move(0)
Changed in this revision
| stepper.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/stepper.cpp Sun Dec 21 11:11:56 2014 +0000
+++ b/stepper.cpp Mon Dec 22 21:15:55 2014 +0000
@@ -47,6 +47,7 @@
* Firing sequence for uni-polar (5+ wires) stepper (4x open-collector drivers required).
*/
#ifdef UNIPOLAR_STEPPER_2PH
+//motor wiring A+ B+ A- B-
const uint8_t pase_cw[4][4] = {{1, 1, 0, 0}, {0, 1, 1, 0}, {0, 0, 1, 1}, {1, 0, 0, 1}};
#endif
@@ -61,9 +62,11 @@
if (steps < 0){
inf.direction = D_CCW;
steps = -steps;
- } else {
- inf.direction = D_CW;
- }
+ }
+ // test for +ve, don't flip direction for stop command steps==0
+ if (steps > 0){
+ inf.direction = D_CW;
+ }
inf.total_step = steps;
setup_mtr_drv_dt(&inf, &cntl);
}
@@ -259,7 +262,7 @@
break;
}
} else { // 1st entry
- cntl.motor_step+=inf.direction;
+//needed??? cntl.motor_step+=inf.direction;
cntl.pls_width = pls_width[cntl.change_cnt];
cntl.ongoing = 1;
}
