File tree 5 files changed +26
-1
lines changed
5 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -167,6 +167,12 @@ bool FS::begin() {
167
167
return _impl->begin ();
168
168
}
169
169
170
+ void FS::end () {
171
+ if (_impl) {
172
+ _impl->end ();
173
+ }
174
+ }
175
+
170
176
bool FS::format () {
171
177
if (!_impl) {
172
178
return false ;
Original file line number Diff line number Diff line change @@ -102,7 +102,8 @@ class FS
102
102
FS (FSImplPtr impl) : _impl(impl) { }
103
103
104
104
bool begin ();
105
-
105
+ void end ();
106
+
106
107
bool format ();
107
108
bool info (FSInfo& info);
108
109
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ class DirImpl {
63
63
class FSImpl {
64
64
public:
65
65
virtual bool begin () = 0;
66
+ virtual void end () = 0;
66
67
virtual bool format () = 0;
67
68
virtual bool info (FSInfo& info) = 0;
68
69
virtual FileImplPtr open (const char * path, OpenMode openMode, AccessMode accessMode) = 0;
Original file line number Diff line number Diff line change @@ -132,6 +132,14 @@ class SPIFFSImpl : public FSImpl
132
132
return _tryMount ();
133
133
}
134
134
135
+ void end () override
136
+ {
137
+ if (SPIFFS_mounted (&_fs) == 0 ) {
138
+ return ;
139
+ }
140
+ SPIFFS_unmount (&_fs);
141
+ }
142
+
135
143
bool format () override
136
144
{
137
145
if (_size == 0 ) {
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ title: File System
7
7
* [ Uploading files to file system] ( #uploading-files-to-file-system )
8
8
* [ File system object (SPIFFS)] ( #file-system-object-spiffs )
9
9
* [ begin] ( #begin )
10
+ * [ end] ( #end )
10
11
* [ format] ( #format )
11
12
* [ open] ( #open )
12
13
* [ exists] ( #exists )
@@ -86,6 +87,14 @@ This method mounts SPIFFS file system. It must be called before any other
86
87
FS APIs are used. Returns * true* if file system was mounted successfully, false
87
88
otherwise.
88
89
90
+ ### end
91
+
92
+ ``` c++
93
+ SPIFFS.end()
94
+ ```
95
+
96
+ This method unmounts SPIFFS file system. Use this method before updating SPIFFS using OTA.
97
+
89
98
### format
90
99
91
100
``` c++
You can’t perform that action at this time.
0 commit comments