|
@@ -24,13 +24,16 @@ long int STEPS_PER_TURN = 200 ; // stepper motor
|
|
|
int MICROSTEPPING = 8 ; //stepper driver
|
|
|
int REDUCTION_RATIO = 70 ; // mechanical reduction ration to real camera rotation
|
|
|
|
|
|
-// microswitch pins
|
|
|
-int switchLow = A5;
|
|
|
+// homing switch pins
|
|
|
+const int homing_Pins = { 2, 3 } ;
|
|
|
+bool homing[NUM_OF_STEPPERS] ;
|
|
|
|
|
|
int driveMode ; // global stepper driving mode : default position with acceleration, 1 position with constant speed, 2 constant speed
|
|
|
long int speedLimit[2] = { 50 , 10000000 } ;// sets an absolute minimum/maximum speed limit
|
|
|
long int accLimit[2] = { 100, 200000} ;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
//////////// UTILITIES ///////////////
|
|
|
|
|
|
|
|
@@ -87,10 +90,28 @@ long int acceleration_Stepper(int stepperIndex, long int acc ){
|
|
|
|
|
|
|
|
|
|
|
|
-//////////////// CALIBRATION ////////////////////////
|
|
|
+//////////////// HOMING ////////////////////////
|
|
|
+
|
|
|
+float homing_steppers(){
|
|
|
+ //run at constant speed until hitting switch
|
|
|
+ while( homing[0] + homing[1] != 2 ){
|
|
|
+ for (int i; i++; i<NUM_OF_STEPPERS) {
|
|
|
+ if (!homing[i]) {
|
|
|
+ steppers[i].runSpeed() ;
|
|
|
+ homing[i] = digitalRead(homing_Pins[i]) ;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //this is the new 0 step for both axes
|
|
|
+ for (int i; i++; i<NUM_OF_STEPPERS) {
|
|
|
+ steppers[i].setCurrentPosition(0);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
-float init_steppers(){
|
|
|
-// //run at constant speed until hitting switchLow
|
|
|
// stepper.setSpeed(-1*speedLimit[1]);
|
|
|
// while(digitalRead(switchLow)) {
|
|
|
// stepper.runSpeed();
|