Grupo T / Mbed OS GRUPOT
Revision:
35:4a527ba7281a
Parent:
34:e3090fc2e9a4
Child:
36:4d0e131146e6
diff -r e3090fc2e9a4 -r 4a527ba7281a main.cpp
--- a/main.cpp	Sun Jun 10 06:15:17 2018 +0000
+++ b/main.cpp	Mon Jun 11 20:05:47 2018 +0000
@@ -26,15 +26,13 @@
 
 // hardware input signal
 // end-of-stroke sensors
-InterruptIn endX(A3);
-InterruptIn endY(A4);
-InterruptIn endZ(A5);
+InterruptIn endX(A2);
+InterruptIn endY(A1);
+InterruptIn endZ(A0);
 
 // JOG Controls
-AnalogIn joyX(A0);
-AnalogIn joyY(A1);
-
-InterruptIn joyClick(A2);
+AnalogIn joyX(A5);
+AnalogIn joyY(A4);
 
 // variables definition
 int modeStatus = 1;
@@ -181,7 +179,7 @@
     }*/
     
     //  interrupções de fim de curso
-    /*
+    
     endX.fall(&endX_press);
     endX.rise(&endX_release);
     
@@ -189,9 +187,9 @@
     endY.rise(&endY_release);
     
     endZ.fall(&endZ_press);
-    endZ.rise(&endZ_release);*/
+    endZ.rise(&endZ_release);
     
-    joyClick.fall(&joystickClick);
+    //joyClick.fall(&joystickClick);
     
     while(1){
         if(ihm.readable()){
@@ -235,6 +233,7 @@
 
 void endZ_press(void){
     printf("Z - press\n\r");
+    toggle = !toggle;
     if(dirZ == z_plus){
         z_block_max = 1;
     }
@@ -510,7 +509,7 @@
             //speed = ppsMax*(valX - 0.52)/0.48;
             activeX = 1;     
         }
-        else if(valX < 0.4 && !toggle){
+        else if(valX < 0.3 && !toggle){
             if(x_dir != x_minus){
                 x_dir = x_minus;   
             }
@@ -530,7 +529,7 @@
             //speed = ppsMax*(valY - 0.52)/0.48; 
             activeY = 1;  
         }
-        else if(valY < 0.4 && !toggle){
+        else if(valY < 0.3 && !toggle){
             if(y_dir != y_minus){
                 y_dir = y_minus;  
             }
@@ -550,7 +549,7 @@
             activeZ = 1; 
             //speed = ppsMax*(valY - 0.52)/0.48;   
         }
-        else if(valY < 0.4 && toggle){
+        else if(valY < 0.3 && toggle){
             if(z_dir != z_minus){
                 z_dir = z_minus;  
             }
@@ -951,12 +950,14 @@
 }
 
 void goMachineHome(int ppsMax){
-    /*zeroX(ppsMax);
+    enable = 0;
+    zeroX(ppsMax);
     zeroY(ppsMax);
-    zeroZ(ppsMax);*/
+    zeroZ(ppsMax);
     printf("Machine Zero\n\r");
     wait(0.1);
     ihm_class.action_complete();
+    enable = 0;
 }
 
 void joystickClick(void){