Skip to content

Commit 9a35d94

Browse files
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
1 parent 875b923 commit 9a35d94

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

libraries/SD/src/SD.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ using namespace fs;
2222

2323
SDFS::SDFS(FSImplPtr impl) : FS(impl), _pdrv(0xFF) {}
2424

25+
SDFS::~SDFS() {
26+
end();
27+
}
28+
2529
bool SDFS::begin(uint8_t ssPin, SPIClass &spi, uint32_t frequency, const char *mountpoint, uint8_t max_files, bool format_if_empty) {
2630
if (_pdrv != 0xFF) {
2731
return true;

libraries/SD/src/SD.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class SDFS : public FS {
2626

2727
public:
2828
SDFS(FSImplPtr impl);
29+
~SDFS();
2930
bool begin(
3031
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
3132
);

0 commit comments

Comments
 (0)