testando

Dependencies:   mbed TextLCD2

Revision:
99:409a77673f2d
Parent:
98:712ac6d10522
Child:
100:bbaf114eab93
Child:
102:d8e9cb7f3725
--- a/main_PM.cpp	Wed Jun 10 01:17:24 2020 +0000
+++ b/main_PM.cpp	Wed Jun 10 01:29:38 2020 +0000
@@ -143,9 +143,58 @@
    }
 }
 
+//Funcao de colocar;modificar volume no solta
+void modifica_solta(bool condicao, int volume,  int posicao_cursor_0, int posicao_cursor_1, int volume_do_solta){
+    TextLCD lcd(D4, D5, D6, D7, D8, D9);
+    while(condicao){ // Pega o valor imputado pelo usuário
+        tecla = pega_tecla();
+        wait(t_teclado);
+        if(tecla!= 'A' && tecla!='B' && tecla!= 'k'){
+            if(volume*10<100)
+            {
+                volume =10*volume + ((int)tecla-48);//((int)tecla-48) é o valor real da tecla pressionada em inteiro    
+                lcd.printf("%c", tecla);
+            }
+            else
+            {
+                volume = 0;
+                lcd.locate(posicao_cursor_0,posicao_cursor_1);
+            }
+        }
+        else if(tecla == 'A'){
+            tecla = 'k';
+            condicao = 0;
+            volume_do_solta = volume; 
+            printf("SAIUU");
+        }
+    }
+}
+
+//Funcao da torina de execucao
+void rotina_pino(float volume_solta, int tipo_do_pega, float medida_do_pega, float volume_do_pega, int contador, float pos_pino_x, float pos_pino_y){
+    printf("Entrou na funcao de exec!");
+    for(int i; i < volume_solta; i++){
+        float altura = calcula_altura(tipo_do_pega,medida_do_pega, volume_do_pega, contador);
+        go_to_z(altura);
+        pipeta = 0;
+        wait(1);
+        pipeta = 1;
+        go_to_z(normal_z);
+        go_to_posicao(pos_pino_x,pos_pino_y);
+        go_to_z(altura_solta);
+        pipeta = 0;
+        wait(1);
+        pipeta = 1;
+        go_to_z(normal_z);
+        contador+=1;
+    }
+    printf("SAIU EXECC!!");
+}
+
 //Função que troca de tela
 void troca_tela(bool cond, void telas1(), void telas2(), float valort11, float valort12, float valort21, float valort22, int argumento){
     TextLCD lcd(D4, D5, D6, D7, D8, D9);
+    printf("Entrou funcao modifica solta!");
     while(cond){
         telas1();
         if(argumento == 1){
@@ -665,6 +714,7 @@
                      volume = 0;
                      continuar = 1;
                      lcd.locate(2,0);
+                     modifica_solta(continuar, volume,  2, 0, volume_solta_1[programa]);
                     while(continuar){ // Pega o valor imputado pelo usuário
                         printf("\n%c",pega_tecla()); 
                         tecla = pega_tecla();
@@ -1627,31 +1677,7 @@
             
 
           //Calcular a altura do pega com base no tipo do pega
-           for(int i; i<volume_solta_1[programa];i++){
-                printf("Entrou na rotina pino 1!!");
-                altura = calcula_altura(tipo_pega[programa],medida_lado_pega[programa], volume_pega[programa], cont_pipeta);
-                go_to_posicao(pos_x_pega[programa], pos_y_pega[programa]);
-                wait(1);
-                go_to_z(altura);
-                wait(1);
-                pipeta = 0;
-                wait(1);
-                pipeta = 1;
-                wait(1);
-                go_to_z(normal_z);
-                wait(1);
-                go_to_posicao(pos1[0],pos1[1]);
-                wait(1);
-                go_to_z(altura_solta);
-                wait(1);
-                pipeta = 0;
-                wait(1);
-                pipeta = 1;
-                wait(1);
-                go_to_z(normal_z);
-                wait(1);
-                cont_pipeta+=1;
-           }
+           rotina_pino(volume_solta_1[programa], tipo_pega[programa], medida_lado_pega[programa], volume_pega[programa], cont_pipeta, pos1[0],pos1[1]);
             for(int i; i<volume_solta_2[programa];i++){
                 altura = calcula_altura(tipo_pega[programa],medida_lado_pega[programa], volume_pega[programa], cont_pipeta);
                 go_to_posicao(pos_x_pega[programa], pos_y_pega[programa]);