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:
Kuba Andrýsek 2025-06-30 10:50:49 +02:00 committed by GitHub
parent 875b923035
commit 9a35d9455f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View file

@ -22,6 +22,10 @@ using namespace fs;
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) {
if (_pdrv != 0xFF) {
return true;

View file

@ -26,6 +26,7 @@ protected:
public:
SDFS(FSImplPtr impl);
~SDFS();
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
);