From 657a6b1eb02d8462e1d9232cc603c547a8e9ccde Mon Sep 17 00:00:00 2001 From: pgp Date: Thu, 1 Jul 2021 14:27:05 +0200 Subject: [PATCH] inversion des fonctions erreur SD card --- src/main.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 8566f8d..4d22a42 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -372,19 +372,22 @@ void testFileIO(fs::FS &fs, const char * path){ void sd_init() { + uint8_t cardType = SD.cardType(); + + if(cardType == CARD_NONE){ + Serial.println("No SD card attached"); + errorCode(4); + return; + } + if(!SD.begin()){ Serial.println("Card Mount Failed"); errorCode(3); return; } - uint8_t cardType = SD.cardType(); - if(cardType == CARD_NONE){ - Serial.println("No SD card attached"); - errorCode(4); - return; - } + uint64_t cardSize = SD.cardSize() / (1024 * 1024); Serial.printf("SD Card Size: %lluMB\n", cardSize);