mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-21 10:26:06 +03:00
Add SPIFFS::end (#1657)
This commit is contained in:
parent
43fb139ed8
commit
5313c56f24
@ -167,6 +167,12 @@ bool FS::begin() {
|
||||
return _impl->begin();
|
||||
}
|
||||
|
||||
void FS::end() {
|
||||
if (_impl) {
|
||||
_impl->end();
|
||||
}
|
||||
}
|
||||
|
||||
bool FS::format() {
|
||||
if (!_impl) {
|
||||
return false;
|
||||
|
@ -102,6 +102,7 @@ public:
|
||||
FS(FSImplPtr impl) : _impl(impl) { }
|
||||
|
||||
bool begin();
|
||||
void end();
|
||||
|
||||
bool format();
|
||||
bool info(FSInfo& info);
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
class FSImpl {
|
||||
public:
|
||||
virtual bool begin() = 0;
|
||||
virtual void end() = 0;
|
||||
virtual bool format() = 0;
|
||||
virtual bool info(FSInfo& info) = 0;
|
||||
virtual FileImplPtr open(const char* path, OpenMode openMode, AccessMode accessMode) = 0;
|
||||
|
@ -132,6 +132,14 @@ public:
|
||||
return _tryMount();
|
||||
}
|
||||
|
||||
void end() override
|
||||
{
|
||||
if (SPIFFS_mounted(&_fs) == 0) {
|
||||
return;
|
||||
}
|
||||
SPIFFS_unmount(&_fs);
|
||||
}
|
||||
|
||||
bool format() override
|
||||
{
|
||||
if (_size == 0) {
|
||||
|
@ -7,6 +7,7 @@ title: File System
|
||||
* [Uploading files to file system](#uploading-files-to-file-system)
|
||||
* [File system object (SPIFFS)](#file-system-object-spiffs)
|
||||
* [begin](#begin)
|
||||
* [end](#end)
|
||||
* [format](#format)
|
||||
* [open](#open)
|
||||
* [exists](#exists)
|
||||
@ -86,6 +87,14 @@ This method mounts SPIFFS file system. It must be called before any other
|
||||
FS APIs are used. Returns *true* if file system was mounted successfully, false
|
||||
otherwise.
|
||||
|
||||
### end
|
||||
|
||||
```c++
|
||||
SPIFFS.end()
|
||||
```
|
||||
|
||||
This method unmounts SPIFFS file system. Use this method before updating SPIFFS using OTA.
|
||||
|
||||
### format
|
||||
|
||||
```c++
|
||||
|
Loading…
x
Reference in New Issue
Block a user