Free the SDCard heap space

This commit is contained in:
George Alexandre Silva 2024-05-05 19:16:23 -03:00
parent 8d3349d080
commit f7de7fc453
3 changed files with 4 additions and 6 deletions

View File

@ -176,7 +176,7 @@ bool SDCard::cardAvailable()
/// @return true on success /// @return true on success
bool SDCard::initSDcard() bool SDCard::initSDcard()
{ {
if (!cardAvailable()) if (!cardAvailable())
{ {
Serial.println("SDCard: init SD card interface."); Serial.println("SDCard: init SD card interface.");
#if defined (BUILD_SDMMC_4) #if defined (BUILD_SDMMC_4)
@ -204,7 +204,6 @@ bool SDCard::initSDcard()
} }
#else #else
SDCard::SDCard(int ID) {} SDCard::SDCard(int ID) {}
SDCard::~SDCard() {} SDCard::~SDCard() {}
void SDCard::SD2nvMemory(nvMemory* nvMem, TSettings* Settings) {}; void SDCard::SD2nvMemory(nvMemory* nvMem, TSettings* Settings) {};
@ -212,6 +211,5 @@ bool SDCard::loadConfigFile(TSettings* Settings) { return false; }
bool SDCard::initSDcard() { return false; } bool SDCard::initSDcard() { return false; }
bool SDCard::cardAvailable() { return false; } bool SDCard::cardAvailable() { return false; }
bool SDCard::cardBusy() { return false; } bool SDCard::cardBusy() { return false; }
void SDCard::terminate() {}; void SDCard::terminate() {}
#endif //BUILD_SDMMC #endif //BUILD_SDMMC

View File

@ -55,7 +55,7 @@ public:
bool loadConfigFile(TSettings* Settings); bool loadConfigFile(TSettings* Settings);
bool cardAvailable(); bool cardAvailable();
bool cardBusy(); bool cardBusy();
void terminate(); void terminate();
private: private:
bool initSDcard(); bool initSDcard();
bool cardInitialized_; bool cardInitialized_;

View File

@ -109,7 +109,7 @@ void init_WifiManager()
} }
}; };
// Free the memory from SDCard class // Free the memory from SDCard class
SDCrd.terminate(); SDCrd.terminate();
// Reset settings (only for development) // Reset settings (only for development)