mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-22 15:16:43 -08:00
Fix SD Card support
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
#include "SDInterface.h"
|
||||
|
||||
bool SDInterface::initSD() {
|
||||
String display_string = "";
|
||||
|
||||
if (!SD.begin(SD_CS)) {
|
||||
Serial.println("Failed to mount SD Card");
|
||||
this->supported = false;
|
||||
@@ -27,6 +29,24 @@ bool SDInterface::initSD() {
|
||||
Serial.printf("SD Card Size: %lluKB\n", this->cardSizeKB);
|
||||
Serial.printf("SD Card Size: %lluMB\n", this->cardSizeMB);
|
||||
Serial.printf("SD Card Size: %lluGB\n", this->cardSizeGB);
|
||||
|
||||
if (this->supported) {
|
||||
//display_obj.tft.println((byte)(sd_obj.cardSizeMB % 10));
|
||||
const int NUM_DIGITS = log10(this->cardSizeMB) + 1;
|
||||
|
||||
char sz[NUM_DIGITS + 1];
|
||||
|
||||
sz[NUM_DIGITS] = 0;
|
||||
for ( size_t i = NUM_DIGITS; i--; this->cardSizeMB /= 10)
|
||||
{
|
||||
sz[i] = '0' + (this->cardSizeMB % 10);
|
||||
display_string.concat((String)sz[i]);
|
||||
}
|
||||
|
||||
//this->card_sz = display_string;
|
||||
this->card_sz = sz;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user