Skip to content

Commit 7fabe3b

Browse files
committed
feat(SDFS): Add destructor to clean up resources
1 parent 444a622 commit 7fabe3b

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)