diff --git a/src/main.cpp b/src/main.cpp index f2bf86b..9a97708 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -71,13 +71,31 @@ const char *ssid = "IFV-Sporix"; // SSID const char *password = "12345678"; // PASSWORD, 8 caractères minimum WiFiServer server(80); // port du serveur +//////////////////////////// +/// FONCTION CODE ERREUR /// +//////////////////////////// + +void errorCode(char codeNumber) { + while(1) { + //char i=0; + delay(4700); + for( int i=0 ; i=codeNumber ; ++i ){ + digitalWrite(LED, HIGH); + delay(300); + digitalWrite(LED, LOW); + delay(300); + } + } +} + + /////////////////////////// /* FONCTIONS DU COMPTEUR */ /////////////////////////// void start_compteur() { - esp_err_t error; + //esp_err_t error; Serial.println("Initialisation du compteur"); @@ -274,11 +292,11 @@ void sd_init() { } Serial.println("balise 01"); DateTime now = rtc.now(); - fileName[1] = '/'; - fileName[2] = now.month(); - fileName[3] = now.day(); - fileName[4] = now.hour(); - fileName[5] = now.minute(); + fileName[0] = '/'; + fileName[1] = now.month(); + fileName[2] = now.day(); + fileName[3] = now.hour(); + fileName[4] = now.minute(); char entete[64] = "fichier de data"; writeFile(SD, fileName, entete); } @@ -286,39 +304,23 @@ void sd_init() { void scribe_sd (){ DateTime now = rtc.now(); char buffer[64]; - snprintf(buffer, sizeof buffer, "%f", vRotReel); - horodatage[1] = now.year(); - horodatage[2] = '-'; - horodatage[3] = now.month(); - horodatage[4] = '-'; - horodatage[5] = now.day(); - horodatage[6] = '-'; - horodatage[7] = now.hour(); - horodatage[8] = ':'; - horodatage[9] = now.minute(); - horodatage[10] = ':'; - horodatage[11] = now.second(); - horodatage[12] = ' '; + snprintf(buffer, sizeof buffer, "%d", vRotReel); + horodatage[0] = now.year(); + horodatage[1] = '-'; + horodatage[2] = now.month(); + horodatage[3] = '-'; + horodatage[4] = now.day(); + horodatage[5] = '-'; + horodatage[6] = now.hour(); + horodatage[7] = ':'; + horodatage[8] = now.minute(); + horodatage[9] = ':'; + horodatage[10] = now.second(); + horodatage[11] = ' '; appendFile(SD, fileName, horodatage); appendFile(SD, fileName, buffer); } -//////////////////////////// -/// FONCTION CODE ERREUR /// -//////////////////////////// - -void errorCode(char codeNumber) { - while(1) { - char i=0; - delay(4700); - for(i=0; i=codeNumber; ++i){ - digitalWrite(LED, HIGH); - delay(300); - digitalWrite(LED, LOW); - delay(300); - } - } -} ///////////////////// /// FONCTIONS RTC ///