mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-22 23:26:45 -08:00
Fix SD Card support
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
<!---[](https://travis-ci.com/justcallmekoko/ESP32Marauder)--->
|
<!---[](https://travis-ci.com/justcallmekoko/ESP32Marauder)--->
|
||||||
<!---Shields/Badges https://shields.io/--->
|
<!---Shields/Badges https://shields.io/--->
|
||||||
|
|
||||||
# ESP32 Marauder v0.4.5
|
# ESP32 Marauder v0.4.6
|
||||||
<p align="center"><img alt="Marauder logo" src="https://github.com/justcallmekoko/ESP32Marauder/blob/master/pictures/marauder3L.jpg?raw=true" width="300"></p>
|
<p align="center"><img alt="Marauder logo" src="https://github.com/justcallmekoko/ESP32Marauder/blob/master/pictures/marauder3L.jpg?raw=true" width="300"></p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<b>A suite of WiFi/Bluetooth offensive and defensive tools for the ESP32</b>
|
<b>A suite of WiFi/Bluetooth offensive and defensive tools for the ESP32</b>
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class Display
|
|||||||
TFT_eSPI tft = TFT_eSPI();
|
TFT_eSPI tft = TFT_eSPI();
|
||||||
TFT_eSprite img = TFT_eSprite(&tft);
|
TFT_eSprite img = TFT_eSprite(&tft);
|
||||||
TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
||||||
String version_number = "v0.4.6";
|
String version_number = "v0.5.1";
|
||||||
|
|
||||||
bool printing = false;
|
bool printing = false;
|
||||||
bool loading = false;
|
bool loading = false;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "SDInterface.h"
|
#include "SDInterface.h"
|
||||||
|
|
||||||
bool SDInterface::initSD() {
|
bool SDInterface::initSD() {
|
||||||
|
String display_string = "";
|
||||||
|
|
||||||
if (!SD.begin(SD_CS)) {
|
if (!SD.begin(SD_CS)) {
|
||||||
Serial.println("Failed to mount SD Card");
|
Serial.println("Failed to mount SD Card");
|
||||||
this->supported = false;
|
this->supported = false;
|
||||||
@@ -27,6 +29,24 @@ bool SDInterface::initSD() {
|
|||||||
Serial.printf("SD Card Size: %lluKB\n", this->cardSizeKB);
|
Serial.printf("SD Card Size: %lluKB\n", this->cardSizeKB);
|
||||||
Serial.printf("SD Card Size: %lluMB\n", this->cardSizeMB);
|
Serial.printf("SD Card Size: %lluMB\n", this->cardSizeMB);
|
||||||
Serial.printf("SD Card Size: %lluGB\n", this->cardSizeGB);
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,10 @@ class SDInterface {
|
|||||||
uint64_t cardSizeMB;
|
uint64_t cardSizeMB;
|
||||||
uint64_t cardSizeGB;
|
uint64_t cardSizeGB;
|
||||||
bool supported = false;
|
bool supported = false;
|
||||||
|
|
||||||
|
String card_sz;
|
||||||
|
|
||||||
bool initSD();
|
bool initSD();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -248,20 +248,8 @@ void WiFiScan::RunInfo()
|
|||||||
if (sd_obj.supported) {
|
if (sd_obj.supported) {
|
||||||
display_obj.tft.println(" SD Card: Connected");
|
display_obj.tft.println(" SD Card: Connected");
|
||||||
display_obj.tft.print("SD Card Size: ");
|
display_obj.tft.print("SD Card Size: ");
|
||||||
//display_obj.tft.println((byte)(sd_obj.cardSizeMB % 10));
|
display_obj.tft.print(sd_obj.card_sz);
|
||||||
const int NUM_DIGITS = log10(sd_obj.cardSizeMB) + 1;
|
|
||||||
|
|
||||||
char sz[NUM_DIGITS + 1];
|
|
||||||
|
|
||||||
sz[NUM_DIGITS] = 0;
|
|
||||||
for ( size_t i = NUM_DIGITS; i--; sd_obj.cardSizeMB /= 10)
|
|
||||||
{
|
|
||||||
sz[i] = '0' + (sd_obj.cardSizeMB % 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
display_obj.tft.print(sz);
|
|
||||||
display_obj.tft.println("MB");
|
display_obj.tft.println("MB");
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
display_obj.tft.println(" SD Card: Not Connected");
|
display_obj.tft.println(" SD Card: Not Connected");
|
||||||
|
|||||||
Reference in New Issue
Block a user