code avec modifs, programme mit dans les robots pour les derniers matchs

Dependencies:   mbed SerialHalfDuplex SDFileSystem liaison_Bluetooth ident_crac DISCO-F469NI_portrait

Files at this revision

API Documentation at this revision

Comitter:
slowness
Date:
Wed Mar 17 08:13:52 2021 +0000
Parent:
28:7f2990747e09
Child:
30:059df50682f4
Commit message:
version correction de la sd

Changed in this revision

Globals/global.h Show annotated file Show diff for this revision Revisions of this file
IHM/ihm.cpp Show annotated file Show diff for this revision Revisions of this file
Instruction/Instruction.cpp Show annotated file Show diff for this revision Revisions of this file
Instruction/lecture_repertoire.cpp Show annotated file Show diff for this revision Revisions of this file
SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Globals/global.h	Fri Jul 17 14:35:11 2020 +0000
+++ b/Globals/global.h	Wed Mar 17 08:13:52 2021 +0000
@@ -66,4 +66,7 @@
 extern unsigned short waitingId;
 
 extern unsigned char isStopEnable;
+
+extern char sd_present;
+extern char can_present;
 #endif
--- a/IHM/ihm.cpp	Fri Jul 17 14:35:11 2020 +0000
+++ b/IHM/ihm.cpp	Wed Mar 17 08:13:52 2021 +0000
@@ -85,7 +85,9 @@
             DrawCheck(30,30,50,343,0);
             DrawCheck(30,30,50,393,0);
             lcd.DisplayStringAt(100, 250, (uint8_t *)"Init CAN", LEFT_MODE);
+            DrawCheck(30,30,50,243,can_present);
             lcd.DisplayStringAt(100, 300, (uint8_t *)"Micro SD", LEFT_MODE);
+            DrawCheck(30,30,50,293,sd_present);
             lcd.DisplayStringAt(100, 350, (uint8_t *)"Carte Moteur", LEFT_MODE);
             lcd.DisplayStringAt(100, 400, (uint8_t *)"Balise IR", LEFT_MODE);
             FORCE_LAUNCH.Draw(0xFFFF0000, 0);
@@ -566,10 +568,10 @@
             break;
 
         case TACTIQUE : //AFFICHE LA LISTE DES STRATS AFIN DE SELECTIONNER CELLE VOULUE
-            if (Cote == 0) {
+            if (Cote == 1) {
                 lcd.Clear(JAUNE);
                 lcd.SetBackColor(JAUNE);
-            } else if (Cote == 1) {
+            } else if (Cote == 0) {
                 lcd.Clear(VIOLET);
                 lcd.SetBackColor(VIOLET);
             } else {
--- a/Instruction/Instruction.cpp	Fri Jul 17 14:35:11 2020 +0000
+++ b/Instruction/Instruction.cpp	Wed Mar 17 08:13:52 2021 +0000
@@ -3,9 +3,8 @@
 
 
 
-
+SDFileSystem sd(PB_15, PB_14,PD_3,PH_6,"sd");
 
-SDFileSystem sd(PB_15, PB_14,PD_3,PH_6,"sd");
 
 enum E_InstructionType charToInstructionType(char type)
 {
--- a/Instruction/lecture_repertoire.cpp	Fri Jul 17 14:35:11 2020 +0000
+++ b/Instruction/lecture_repertoire.cpp	Wed Mar 17 08:13:52 2021 +0000
@@ -3,6 +3,7 @@
 
 struct dirent* files_name[10];
 char *rest;
+char sd_present=0;
 
 
 void lecture_fichier(void){
@@ -11,28 +12,34 @@
     DIR* rep = NULL;
 
     mkdir("/sd", 0777);
-    strcpy(cheminFileStart,"/sd");
-    rep=opendir("/sd");
-    
-    for(i=0;i<20;i++){
-        files_name[i]= readdir(rep);  
+        strcpy(cheminFileStart,"/sd");
+        rep=opendir("/sd");
+        
+        for(i=0;i<20;i++)
+        {
+            files_name[i]= readdir(rep);  
+                    
+            if(files_name[i]->d_name=="")
+            {
+                i=20;
+            }
+            else
+            {
+                sd_present=1;
+                strcpy(strat_sd[i-j],files_name[i]->d_name);
+                rest=strstr(strat_sd[i-j],".txt");
                 
-        if(files_name[i]->d_name==""){
-            i=20;
+                if(rest==NULL)
+                {
+                    strcpy(strat_sd[i-j],"");
+                    j++;
+                }
+                else
+                {
+                    strcpy(strat_sd[i-j],strtok(strat_sd[i-j],"."));
+                }
+                
+            }
         }
-        else{
-            strcpy(strat_sd[i-j],files_name[i]->d_name);
-            rest=strstr(strat_sd[i-j],".txt");
-            
-            if(rest==NULL){
-                strcpy(strat_sd[i-j],"");
-                j++;
-            }
-            else{
-                strcpy(strat_sd[i-j],strtok(strat_sd[i-j],"."));
-            }
-            
-        }
-    }
 }
         
--- a/SDFileSystem.lib	Fri Jul 17 14:35:11 2020 +0000
+++ b/SDFileSystem.lib	Wed Mar 17 08:13:52 2021 +0000
@@ -1,1 +1,1 @@
-https://os.mbed.com/teams/CRAC-Team/code/SDFileSystem/#2cf33501d9c5
+https://os.mbed.com/teams/CRAC-Team/code/SDFileSystem/#d369ac9697d1
--- a/main.cpp	Fri Jul 17 14:35:11 2020 +0000
+++ b/main.cpp	Wed Mar 17 08:13:52 2021 +0000
@@ -2,6 +2,8 @@
 
 CAN can1(PB_8,PB_9); // Rx&Tx pour le CAN
 CAN can2(PB_5, PB_13);
+
+
 CANMessage msgRxBuffer[SIZE_FIFO];
 unsigned char FIFO_ecriture;
 char strat_sd[10][SIZE+8];
@@ -16,6 +18,8 @@
 unsigned short waitingAckID=0;//L'id du ack attendu
 unsigned short waitingAckFrom=0;//La provenance du ack attendu
 unsigned short waitingId=0;
+    char can_present=1;
+
 char modeTelemetre; // Si à 1, indique que l'on attend une reponse du telemetre
 DigitalOut led1(LED1);//Led d'indication de problème, si elle clignote, c'est pas bon
 DigitalOut led2(LED2);//Led d'indication de problème, si elle clignote, c'est pas bon