avec dfu

Fork of Utils by POTLESS

Files at this revision

API Documentation at this revision

Comitter:
POTLESS_2
Date:
Thu May 03 08:42:58 2018 +0000
Parent:
15:a8c19ad9c11d
Child:
17:af9dbae179c1
Commit message:
derni?re version

Changed in this revision

Utils.cpp Show annotated file Show diff for this revision Revisions of this file
Utils.h Show annotated file Show diff for this revision Revisions of this file
--- a/Utils.cpp	Mon Apr 09 06:51:14 2018 +0000
+++ b/Utils.cpp	Thu May 03 08:42:58 2018 +0000
@@ -39,7 +39,8 @@
 
 void UTILS::Flash_Infos(Serial *serial_port)
 {
-    serial_port->printf("\r\n");
+    serial_port->printf("?\r\n");
+    
     serial_port->printf("  Flash size         : %llu Mb\r\n", bd.size() / 1048576);
     serial_port->printf("  Flash read size    : %llu\r\n", bd.get_read_size());
     serial_port->printf("  Flash program size : %llu\r\n", bd.get_program_size());
@@ -48,7 +49,8 @@
 
 void UTILS::Get_File_Size(Serial *serial_port, char* File_Name)
 {
-
+    serial_port->printf("?\r\n");
+    
     char filename[50];
     sprintf(filename, "/Root/%s", File_Name);
 
@@ -150,6 +152,8 @@
 
 void UTILS::Read_Flash_File(Serial *serial_port, char* File_Name)
 {   
+    serial_port->printf("?\r\n");
+    
     if (File_Exist(File_Name)) {
     char filename[50];
     sprintf(filename, "/Root/%s", File_Name);    
@@ -161,8 +165,7 @@
     while (!feof(fd)) {
         memset(s1, 0, sizeof(s1));
         fgets(s1, sizeof(s1), fd);
-        serial_port->printf("%s", s1);       
-        fflush(stdout);
+        serial_port->printf("%s", s1);
     }
     fclose(fd);
     DEBUG("\r\n  Fin du fichier.\r\n");
@@ -204,13 +207,15 @@
 {
     DEBUG("  Nettoyage de la Flash.\r\n");
     //float Saved_O2 = UTILS::Read_A_Val("Calibration_O2");
-    int Saved_Motor = (int)UTILS::Read_A_Val("Servo_Poumon.sys");
+    int Saved_Motor_P = (int)UTILS::Read_A_Val("Servo_Poumon.sys");
+    int Saved_Motor_F = (int)UTILS::Read_A_Val("Servo_Fuite.sys");
     int ARNSRS_ID = (int)UTILS::Read_A_Val("ARNSRS_ID.sys");
     UTILS::UnMount_Flash();
     UTILS::Format_Flash();
     UTILS::Mount_Flash();
     //UTILS::Store_A_Val(Saved_O2, "Calibration_O2");
-    UTILS::Store_A_Val(Saved_Motor, "Servo_Poumon.sys");
+    UTILS::Store_A_Val(Saved_Motor_P, "Servo_Poumon.sys");
+    UTILS::Store_A_Val(Saved_Motor_F, "Servo_Fuite.sys");
     UTILS::Store_A_Val(ARNSRS_ID, "ARNSRS_ID.sys");
     DEBUG("  Flash nettoyée.\r\n");
     DEBUG("  Redémmarage code.\r\n");
@@ -285,16 +290,20 @@
     struct dirent* de;
     DEBUG("  Fichiers du répertoire :\r\n\r\n");
     while((de = readdir(dir)) != NULL) {
-        serial_port->printf("  %s\r\n", &(de->d_name)[0]);
+        serial_port->printf("%s\r\n", &(de->d_name)[0]);
         fflush(stdout);
         nb++;
     }
+    
+    serial_port->printf("!\r\n");
+    
     DEBUG("\r\n  Nombre de fichiers = %d\r\n", nb);
     DEEP_DEBUG("  Fermeture du répertoire.\r\n");
     error = closedir(dir);
     return_error(error);
 }
 
+
 int UTILS::File_Index()
 {
     int error = 0;
@@ -330,7 +339,8 @@
 
 void UTILS::Help(Serial *serial_port)
 {
-    serial_port->printf("\r\n");
+    serial_port->printf("?\r\n");
+    
     serial_port->printf("  COMMANDES GENERALES\r\n\r\n");
     /*
     serial_port->printf("  help             =    liste des commandes.\r\n");
@@ -367,7 +377,7 @@
     serial_port->printf("  O2_1_ID X        =    Numérote le numéro X d'identification de la cellule O2 1 dans l'eeprom.\r\n");
     serial_port->printf("  O2_2_ID X        =    Numérote le numéro X d'identification de la cellule O2 2 dans l'eeprom.\r\n");
     serial_port->printf("  CO2_ID X         =    Numérote le numéro X d'identification du capteur CO2 dans l'eeprom.\r\n");
-    serial_port->printf("  check_E          =    sortie des valeurs de calibration enregistrées dans l'eeprom.\r\n");
+    //serial_port->printf("  check_E          =    sortie des valeurs de calibration enregistrées dans l'eeprom.\r\n");
     serial_port->printf("  calib_O2 X       =    calibration des cellules O2 dans l'air avec X itérations.\r\n");
     
     serial_port->printf("  Les commandes pour le Mini-r sont à entrer conformément à la doc. Les plus utilisée :\r\n");
--- a/Utils.h	Mon Apr 09 06:51:14 2018 +0000
+++ b/Utils.h	Thu May 03 08:42:58 2018 +0000
@@ -24,7 +24,7 @@
 //Adresse i2C de l'eeprom
 #define EEPROM_ADDRESS 0xA0
 
-#define DEBUG_MODE 1
+#define DEBUG_MODE 0
 
 #if DEBUG_MODE
 #define DEBUG(...) { printf(__VA_ARGS__); fflush(stdout);}