testando

Dependencies:   mbed TextLCD2

Revision:
58:d573b618f45a
Parent:
57:e26deee15b8f
Child:
59:447534f1e4f5
--- a/main_PM.cpp	Sat May 30 21:37:01 2020 +0000
+++ b/main_PM.cpp	Sat May 30 22:03:30 2020 +0000
@@ -136,33 +136,6 @@
 float pos_x_solta=0;
 float pos_y_solta=0;
 
-//Função IHM - OK
-void funcao_ok_pega(){
-    TextLCD lcd(D4, D5, D6, D7, D8, D9); 
-    if(pos_y_pega !=0){
-    lcd.locate(18,1);lcd.printf("OK");   
-    }
-    if(medida_lado_pega !=0){
-    lcd.locate(18,1);lcd.printf("OK");
-    }
-    if(volume_pega !=0){
-    lcd.locate(18,0);lcd.printf("OK");    
-    }
-}
-
-void funcao_ok_solta(){
-    TextLCD lcd(D4, D5, D6, D7, D8, D9); 
-    if(pos_y_solta !=0){
-    lcd.locate(18,1);lcd.printf("OK");   
-    }
-    if(dimensao_solta !=0){
-    lcd.locate(18,1);lcd.printf("OK");
-    }
-    if(volume_solta_9 !=0){
-    lcd.locate(18,0);lcd.printf("OK");    
-    }  
-}
-
 //main
 
 int main() {
@@ -445,10 +418,17 @@
         if(tecla == 'A' && status_tela == "forma_quad"){
             funcao_pega1();
             medida_lado_pega = 10;
-            funcao_ok_solta();
+            if(pos_y_pega !=0){
+            lcd.locate(18,1);lcd.printf("OK");   
+            }
+            if(medida_lado_pega !=0){
+            lcd.locate(18,1);lcd.printf("OK");
+            }
             wait(1);
             funcao_pega2();
-            funcao_ok_solta();
+            if(volume_pega !=0){
+            lcd.locate(18,0);lcd.printf("OK");    
+            }
             status_tela ="novo";}
         else if(tecla == 'B' && status_tela == "forma_quad"){
             funcao_pega_forma();
@@ -456,10 +436,17 @@
         else if(tecla == 'A' && status_tela == "forma_red"){
             medida_lado_pega = 10;
             funcao_pega1();
-            funcao_ok_pega();
+            if(pos_y_pega !=0){
+            lcd.locate(18,1);lcd.printf("OK");   
+            }
+            if(medida_lado_pega !=0){
+            lcd.locate(18,1);lcd.printf("OK");
+            }
             wait(1);
             funcao_pega2();
-            funcao_ok_pega();
+            if(volume_pega !=0){
+            lcd.locate(18,0);lcd.printf("OK");    
+            }
             status_tela ="novo";}
         else if(tecla == 'B' && status_tela == "forma_red"){
             funcao_pega_forma();
@@ -467,10 +454,17 @@
         else if(tecla == 'A' && status_tela == "volume"){
             funcao_pega1();
             volume_pega = 12;
-            funcao_ok_pega();
+            if(pos_y_pega !=0){
+            lcd.locate(18,1);lcd.printf("OK");   
+            }
+            if(medida_lado_pega !=0){
+            lcd.locate(18,1);lcd.printf("OK");
+            }
             wait(1);
             funcao_pega2();
-            funcao_ok_pega();
+            if(volume_pega !=0){
+            lcd.locate(18,0);lcd.printf("OK");    
+            }
             status_tela ="novo";}
         else if( tecla == 'B' && status_tela == "volume"){
             funcao_pega_forma();
@@ -486,10 +480,17 @@
         tecla = pega_tecla();    
         if(tecla == 'A' && status_tela == "pos_y"){
             funcao_pega1();
-            funcao_ok_pega();
+            if(pos_y_pega !=0){
+            lcd.locate(18,1);lcd.printf("OK");   
+            }
+            if(medida_lado_pega !=0){
+            lcd.locate(18,1);lcd.printf("OK");
+            }
             wait(1);
             funcao_pega2();
-            funcao_ok_pega();
+            if(volume_pega !=0){
+            lcd.locate(18,0);lcd.printf("OK");    
+            }
             wait(1);
             status_tela ="novo";}
         else if(tecla == 'B' && status_tela == "pos_y"){
@@ -502,6 +503,9 @@
             funcao_solta1();
             wait(3);
             funcao_solta2();
+            if(volume_solta_9 !=0){
+            lcd.locate(18,0);lcd.printf("OK");    
+            }
             wait(3);
             status_tela="solta";}
         
@@ -520,10 +524,17 @@
             }
         else if(tecla == 'B' && status_tela == "solta"){
             funcao_pega1();
-            funcao_ok_solta();
+            if(pos_y_pega !=0){
+            lcd.locate(18,1);lcd.printf("OK");   
+            }
+            if(medida_lado_pega !=0){
+            lcd.locate(18,1);lcd.printf("OK");
+            }
             wait(1);
             funcao_pega2();
-            funcao_ok_solta();
+            if(volume_pega !=0){
+            lcd.locate(18,0);lcd.printf("OK");    
+            }
             status_tela="inicio";
             }
         
@@ -531,16 +542,33 @@
         if(tecla=='A' && status_tela=="solta_dimensao"){
             dimensao_solta = 10;
             funcao_solta1();
-            funcao_ok_solta();
+            if(pos_y_solta !=0){
+            lcd.locate(18,1);lcd.printf("OK");   
+            }
+            if(dimensao_solta !=0){
+            lcd.locate(18,1);lcd.printf("OK");
+            }
             wait(3);
             funcao_solta2();
+            if(volume_solta_9 !=0){
+            lcd.locate(18,0);lcd.printf("OK");    
+            }
             wait(3);
             status_tela="solta";   
             }
         else if(tecla=='B' && status_tela=="solta_dimensao"){
             funcao_solta1();
+            if(pos_y_solta !=0){
+            lcd.locate(18,1);lcd.printf("OK");   
+            }
+            if(dimensao_solta !=0){
+            lcd.locate(18,1);lcd.printf("OK");
+            }
             wait(3);
             funcao_solta2();
+            if(volume_solta_9 !=0){
+            lcd.locate(18,0);lcd.printf("OK");    
+            }
             wait(3);
             status_tela="solta";     
             }
@@ -554,8 +582,17 @@
             }
         else if(tecla=='B' && status_tela=="solta_vol"){
             funcao_solta1();
+                if(pos_y_solta !=0){
+                lcd.locate(18,1);lcd.printf("OK");   
+                }
+                if(dimensao_solta !=0){
+                lcd.locate(18,1);lcd.printf("OK");
+                }
             wait(3);
             funcao_solta2();
+            if(volume_solta_9 !=0){
+            lcd.locate(18,0);lcd.printf("OK");    
+            }
             wait(3);
             status_tela="solta";  
             }
@@ -566,8 +603,17 @@
             }
         else if(tecla=='B' && status_tela=="solta_pos_x"){
             funcao_solta1();
+            if(pos_y_solta !=0){
+            lcd.locate(18,1);lcd.printf("OK");   
+            }
+            if(dimensao_solta !=0){
+            lcd.locate(18,1);lcd.printf("OK");
+            }
             wait(3);
             funcao_solta2();
+            if(volume_solta_9 !=0){
+            lcd.locate(18,0);lcd.printf("OK");    
+            }
             wait(3);
             status_tela="solta";  
             }  
@@ -585,10 +631,17 @@
             volume_solta_9=10;
             
             funcao_solta1();
-            funcao_ok_solta();
+        if(pos_y_solta !=0){
+        lcd.locate(18,1);lcd.printf("OK");   
+        }
+        if(dimensao_solta !=0){
+        lcd.locate(18,1);lcd.printf("OK");
+        }
             wait(3);
             funcao_solta2();
-            funcao_ok_solta();
+            if(volume_solta_9 !=0){
+            lcd.locate(18,0);lcd.printf("OK");    
+            }
             wait(3);
             status_tela="solta";}
         else if(tecla=='B' && status_tela=="solta_vol_igual"){
@@ -633,10 +686,17 @@
             }
         if(tecla=='A' && status_tela=="solta_vol_dif"){
             funcao_solta1();
-            funcao_ok_solta();
+            if(pos_y_solta !=0){
+            lcd.locate(18,1);lcd.printf("OK");   
+            }
+            if(dimensao_solta !=0){
+            lcd.locate(18,1);lcd.printf("OK");
+            }
             wait(3);
             funcao_solta2();
-            funcao_ok_solta();
+            if(volume_solta_9 !=0){
+            lcd.locate(18,0);lcd.printf("OK");    
+            }
             wait(3);
             status_tela="solta"; 
             }
@@ -646,18 +706,34 @@
             }
         if(tecla=='A' && status_tela=="solta_pos_y"){
             funcao_solta1();
-            funcao_ok_solta();
+            if(pos_y_solta !=0){
+            lcd.locate(18,1);lcd.printf("OK");   
+            }
+            if(dimensao_solta !=0){
+            lcd.locate(18,1);lcd.printf("OK");
+            }
             wait(3);
             funcao_solta2();
-            funcao_ok_solta();
+            if(volume_solta_9 !=0){
+            lcd.locate(18,0);lcd.printf("OK");    
+            }
             pos_y_solta = 10;
             wait(3);
             status_tela="solta"; 
             }
          else if(tecla=='B' && status_tela=="solta_pos_y"){
             funcao_solta1();
+            if(pos_y_solta !=0){
+            lcd.locate(18,1);lcd.printf("OK");   
+            }
+            if(dimensao_solta !=0){
+            lcd.locate(18,1);lcd.printf("OK");
+            }
             wait(3);
             funcao_solta2();
+            if(volume_solta_9 !=0){
+            lcd.locate(18,0);lcd.printf("OK");    
+            }
             pos_y_solta = 10;
             wait(3);
             status_tela="solta";