carte esclave pompe 2020 V1

Dependencies:   mbed ident_crac

Revision:
19:952208276c63
Parent:
18:972d29c668a5
Child:
20:677dcf689523
--- a/main.cpp	Sat May 25 14:08:48 2019 +0000
+++ b/main.cpp	Thu Mar 05 16:32:21 2020 +0000
@@ -1,10 +1,7 @@
-
 #include "extern.h"
 #define SIZE_FIFO 50
 
 
-
-
 CANMessage msgRxBuffer[SIZE_FIFO];
 unsigned char FIFO_ecriture=0; //Position du fifo pour la reception CAN
 signed char FIFO_lecture=0;//Position du fifo de lecture des messages CAN
@@ -24,27 +21,6 @@
 
 void lecture_contacts(void);
 
-#ifdef ROBOT_SMALL
-         
-#endif
-
-#ifdef ROBOT_BIG
-
-PwmOut ascenseur[8] = {PC_9, PA_8, PA_9, PA_10, PC_7, PC_8, PB_10 ,PB_2};
-PwmOut* ascenseur_D = ascenseur;
-PwmOut* ascenseur_G = ascenseur+4;
-
-//ascenseur_D = ascenseur;
-//ascenseur_G = ascenseur + 4;
-    
-#define VIT_COURROIE_HAUT_V 0.5
-#define VIT_COURROIE_HAUT_L 0.4
-#define VIT_COURROIE_BAS_V 0.6
-#define VIT_COURROIE_BAS_L 0.5
-
-void set_ascensseur(int allume);
-#endif
-
 
 
 void get_etat_ventouses();
@@ -82,7 +58,7 @@
     
         switch(identifiant){
             
-            case HACHEUR_GET_ATOM:
+            /*case HACHEUR_GET_ATOM:
                 BRAS = msgRxBuffer[FIFO_lecture].data[0];
                 ventouse[BRAS]->action(1);
                 break;
@@ -104,10 +80,7 @@
                 char contacts_tmp = contacts;
                 can.write(CANMessage(HACHEUR_ETAT_CONTACTS,&contacts_tmp,1));
                 break;
-            
-            #ifdef ROBOT_SMALL
                        
-            
             case HACHEUR_GET_PRESENTOIR_AR:           
                 ventouse[AR_GAUCHE]->action(1);
                 ventouse[AR_CENTRE]->action(1);
@@ -130,31 +103,25 @@
                 ventouse[AV_GAUCHE]->action(0);
                 ventouse[AV_CENTRE]->action(0);
                 ventouse[AV_DROIT]->action(0);
-                break;
+                break;*/
                 
-            
-
-            #endif
-
-            #ifdef ROBOT_BIG            
-            
-            case HACHEUR_GET_PRESENTOIR_AV :
+            case TEST_ELECTROV_1:
+                ventouse[AR_GAUCHE]->action(1);
+                ventouse[AR_CENTRE]->action(1);
+                ventouse[AR_DROIT]->action(1);
                 ventouse[AV_GAUCHE]->action(1);
                 ventouse[AV_CENTRE]->action(1);
                 ventouse[AV_DROIT]->action(1);
                 break;
-            
-            case HACHEUR_RELEASE_AV :
+                
+            case TEST_ELECTROV_2:
+                ventouse[AR_GAUCHE]->action(0);
+                ventouse[AR_CENTRE]->action(0);
+                ventouse[AR_DROIT]->action(0);
                 ventouse[AV_GAUCHE]->action(0);
                 ventouse[AV_CENTRE]->action(0);
                 ventouse[AV_DROIT]->action(0);
                 break;
-            
-            case HACHEUR_ID_COUROIES :
-                set_ascensseur(msgRxBuffer[FIFO_lecture].data[0]);
-                break;
-            
-            #endif
         }
         FIFO_lecture=(FIFO_lecture+1)%SIZE_FIFO;
     }
@@ -164,38 +131,15 @@
     
     can.attach(&canRx_ISR); // création de l'interrupt attachée à la réception sur le CAN
     wait(1);
-    #ifdef ROBOT_SMALL
+    
     pc.printf("\nPetit robot\n\n");
     ventouse[AV_GAUCHE] = new Ventouse(PB_7, PB_6, PC_0, AV_GAUCHE);
     ventouse[AR_CENTRE] = new Ventouse(PC_9, PA_8, PB_0, AR_CENTRE);
     ventouse[AR_DROIT] = new Ventouse(PA_9, PA_10,  PB_1, AR_DROIT);
-    //ventouse[AR_BAS] = new Ventouse(PA_11, PA_15, PC_1, AR_BAS);
-    ventouse[AR_BAS] = new Ventouse(PA_11, PC_1, AR_BAS);
     
     ventouse[AV_DROIT] = new Ventouse(PA_0, PA_1, PA_4, AV_DROIT);
     ventouse[AV_CENTRE] = new Ventouse(PC_7,PC_8 , PC_5, AV_CENTRE);
     ventouse[AR_GAUCHE] = new Ventouse(PB_10, PB_2, PC_4, AR_GAUCHE);
-    //ventouse[AV_BAS] = new Ventouse(PA_6, PA_5, PA_7, AV_BAS); 
-    ventouse[AV_BAS] = new Ventouse(PA_6, PA_7, AV_BAS); 
-    
-
-    #endif    
-    
-    #ifdef ROBOT_BIG
-    pc.printf("\nGros robot\n\n");
-    ventouse[AV_GAUCHE] = new Ventouse(PA_6, PA_5, PA_7, AV_GAUCHE);
-    ventouse[AV_CENTRE] = new Ventouse(PA_0, PA_1, PA_4, AV_CENTRE);
-    ventouse[AV_DROIT] = new Ventouse(PA_11, PA_15, PC_1, AV_DROIT);
-    
-    for (int i=0; i<8; i++){
-        ascenseur[i].period_us(50);
-    }
-        
-    
-    
-    set_ascensseur(0);
-    wait(1);
-    #endif
     
     pc.printf("LAUNCHED");
     while(1) {
@@ -211,9 +155,6 @@
                 ventouse[i]->setPompe(0.0);
                 ventouse[i]->setElectrovanne(0);
             }
-#ifdef ROBOT_BIG
-            set_ascensseur(0);
-#endif
             while(1){;}
         }
     }
@@ -229,81 +170,6 @@
         can.write(CANMessage(HACHEUR_ETAT_CONTACTS,&prev_contacts,1));
     }
 }
-#ifdef ROBOT_BIG
-void set_ascensseur(int allume){
-    /*PwmOut* vitH, vitL;
-    switch(allume){
-        case 1:
-            vitH = ascenseur_G;
-            vitL = ascenseur_D;
-            break;
-        case 2:
-            vitH = ascenseur_G;
-            vitL = ascenseur_D;
-            break;
-        default:
-            vitG = 0;
-            vitD = 0;
-            break;
-    }
-    for (int i=0; i<3; i++)
-    {
-        vitL[i] = VIT_COURROIE_BAS_L;
-        vitH[i] = VIT_COURROIE_BAS_V;
-    }
-    
-    vitL[3] = VIT_COURROIE_HEUT_L;
-    vitH[3] = VIT_COURROIE_HAUT_V;*/
-
-    
-    
-   // float vitG, vitD, vitHG, vitHD;
-    
-    switch(allume){
-        case 1:
-        /*
-            vitG = VIT_COURROIE_BAS_V;
-            vitD = VIT_COURROIE_BAS_L;
-            vitHG = VIT_COURROIE_HAUT_V;
-            vitHD = VIT_COURROIE_HEUT_L;*/
-            for (int i=0; i<3; i++)
-            {
-                ascenseur_D[i] = VIT_COURROIE_BAS_L;
-                ascenseur_G[i] = VIT_COURROIE_BAS_V;
-            }
-        
-            ascenseur_D[3] = VIT_COURROIE_HAUT_L;
-            ascenseur_G[3] = VIT_COURROIE_HAUT_V;
-            break;
-        case 2:
-        /*
-            vitG = VIT_COURROIE_BAS_L;
-            vitD = VIT_COURROIE_BAS_V;
-            vitHG = VIT_COURROIE_HAUT_L;
-            vitHD = VIT_COURROIE_HEUT_V;*/
-            for (int i=0; i<3; i++)
-            {
-                ascenseur_D[i] = VIT_COURROIE_BAS_V;
-                ascenseur_G[i] = VIT_COURROIE_BAS_L;
-            }
-        
-            ascenseur_D[3] = VIT_COURROIE_HAUT_V;
-            ascenseur_G[3] = VIT_COURROIE_HAUT_L;
-            break;
-        default:    
-            for (int i=0; i<4; i++)
-            {
-                ascenseur_D[i] = 0;
-                ascenseur_G[i] = 0;
-            }
-            break;
-    }
-    
-    
-
-    
-}
-#endif
 
 void get_etat_ventouses()
 {