feat(SDFS): Add destructor for SD card to clean up resources (#11521)
* feat(test): Enhance NVS test * fix(nvs): Remove unused Unity header and improve Serial wait loop * refactor(nvs): Extract string increment logic into a separate function * refactor(test): Format long strings in expect_exact calls for better readability * feat(SDFS): Add destructor to clean up resources
This commit is contained in:
parent
875b923035
commit
9a35d9455f
2 changed files with 5 additions and 0 deletions
|
|
@ -22,6 +22,10 @@ using namespace fs;
|
||||||
|
|
||||||
SDFS::SDFS(FSImplPtr impl) : FS(impl), _pdrv(0xFF) {}
|
SDFS::SDFS(FSImplPtr impl) : FS(impl), _pdrv(0xFF) {}
|
||||||
|
|
||||||
|
SDFS::~SDFS() {
|
||||||
|
end();
|
||||||
|
}
|
||||||
|
|
||||||
bool SDFS::begin(uint8_t ssPin, SPIClass &spi, uint32_t frequency, const char *mountpoint, uint8_t max_files, bool format_if_empty) {
|
bool SDFS::begin(uint8_t ssPin, SPIClass &spi, uint32_t frequency, const char *mountpoint, uint8_t max_files, bool format_if_empty) {
|
||||||
if (_pdrv != 0xFF) {
|
if (_pdrv != 0xFF) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SDFS(FSImplPtr impl);
|
SDFS(FSImplPtr impl);
|
||||||
|
~SDFS();
|
||||||
bool begin(
|
bool begin(
|
||||||
uint8_t ssPin = SS, SPIClass &spi = SPI, uint32_t frequency = 4000000, const char *mountpoint = "/sd", uint8_t max_files = 5, bool format_if_empty = false
|
uint8_t ssPin = SS, SPIClass &spi = SPI, uint32_t frequency = 4000000, const char *mountpoint = "/sd", uint8_t max_files = 5, bool format_if_empty = false
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue