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();
|
return _impl->begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FS::end() {
|
||||||
|
if (_impl) {
|
||||||
|
_impl->end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool FS::format() {
|
bool FS::format() {
|
||||||
if (!_impl) {
|
if (!_impl) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -102,6 +102,7 @@ public:
|
|||||||
FS(FSImplPtr impl) : _impl(impl) { }
|
FS(FSImplPtr impl) : _impl(impl) { }
|
||||||
|
|
||||||
bool begin();
|
bool begin();
|
||||||
|
void end();
|
||||||
|
|
||||||
bool format();
|
bool format();
|
||||||
bool info(FSInfo& info);
|
bool info(FSInfo& info);
|
||||||
|
@ -63,6 +63,7 @@ public:
|
|||||||
class FSImpl {
|
class FSImpl {
|
||||||
public:
|
public:
|
||||||
virtual bool begin() = 0;
|
virtual bool begin() = 0;
|
||||||
|
virtual void end() = 0;
|
||||||
virtual bool format() = 0;
|
virtual bool format() = 0;
|
||||||
virtual bool info(FSInfo& info) = 0;
|
virtual bool info(FSInfo& info) = 0;
|
||||||
virtual FileImplPtr open(const char* path, OpenMode openMode, AccessMode accessMode) = 0;
|
virtual FileImplPtr open(const char* path, OpenMode openMode, AccessMode accessMode) = 0;
|
||||||
|
@ -132,6 +132,14 @@ public:
|
|||||||
return _tryMount();
|
return _tryMount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void end() override
|
||||||
|
{
|
||||||
|
if (SPIFFS_mounted(&_fs) == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SPIFFS_unmount(&_fs);
|
||||||
|
}
|
||||||
|
|
||||||
bool format() override
|
bool format() override
|
||||||
{
|
{
|
||||||
if (_size == 0) {
|
if (_size == 0) {
|
||||||
|
@ -7,6 +7,7 @@ title: File System
|
|||||||
* [Uploading files to file system](#uploading-files-to-file-system)
|
* [Uploading files to file system](#uploading-files-to-file-system)
|
||||||
* [File system object (SPIFFS)](#file-system-object-spiffs)
|
* [File system object (SPIFFS)](#file-system-object-spiffs)
|
||||||
* [begin](#begin)
|
* [begin](#begin)
|
||||||
|
* [end](#end)
|
||||||
* [format](#format)
|
* [format](#format)
|
||||||
* [open](#open)
|
* [open](#open)
|
||||||
* [exists](#exists)
|
* [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
|
FS APIs are used. Returns *true* if file system was mounted successfully, false
|
||||||
otherwise.
|
otherwise.
|
||||||
|
|
||||||
|
### end
|
||||||
|
|
||||||
|
```c++
|
||||||
|
SPIFFS.end()
|
||||||
|
```
|
||||||
|
|
||||||
|
This method unmounts SPIFFS file system. Use this method before updating SPIFFS using OTA.
|
||||||
|
|
||||||
### format
|
### format
|
||||||
|
|
||||||
```c++
|
```c++
|
||||||
|
Loading…
x
Reference in New Issue
Block a user