Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-esp32
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-esp32
Commits
ca88fdc2
Commit
ca88fdc2
authored
Sep 24, 2019
by
lbernstone
Committed by
Me No Dev
Sep 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed FFat::end. Fixes #3244 (#3245)
* Fixed FFat::end. Fixes #3244 * Missed the handle check in format
parent
f32083a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
libraries/FFat/src/FFat.cpp
libraries/FFat/src/FFat.cpp
+12
-7
libraries/FFat/src/FFat.h
libraries/FFat/src/FFat.h
+1
-1
No files found.
libraries/FFat/src/FFat.cpp
View file @
ca88fdc2
...
...
@@ -40,16 +40,20 @@ const esp_partition_t *check_ffat_partition(const char* label)
bool
F_Fat
::
begin
(
bool
formatOnFail
,
const
char
*
basePath
,
uint8_t
maxOpenFiles
,
const
char
*
partitionLabel
)
{
if
(
_wl_handle
){
if
(
_wl_handle
!=
WL_INVALID_HANDLE
){
log_w
(
"Already Mounted!"
);
return
true
;
}
if
(
!
check_ffat_partition
(
partitionLabel
))
return
false
;
if
(
!
check_ffat_partition
(
partitionLabel
)){
log_e
(
"No fat partition found on flash"
);
return
false
;
}
esp_vfs_fat_mount_config_t
conf
=
{
.
format_if_mount_failed
=
formatOnFail
,
.
max_files
=
maxOpenFiles
.
max_files
=
maxOpenFiles
,
.
allocation_unit_size
=
CONFIG_WL_SECTOR_SIZE
};
esp_err_t
err
=
esp_vfs_fat_spiflash_mount
(
basePath
,
partitionLabel
,
&
conf
,
&
_wl_handle
);
if
(
err
){
...
...
@@ -62,13 +66,13 @@ bool F_Fat::begin(bool formatOnFail, const char * basePath, uint8_t maxOpenFiles
void
F_Fat
::
end
()
{
if
(
_wl_handle
){
if
(
_wl_handle
!=
WL_INVALID_HANDLE
){
esp_err_t
err
=
esp_vfs_fat_spiflash_unmount
(
_impl
->
mountpoint
(),
_wl_handle
);
if
(
err
){
log_e
(
"Unmounting FFat partition failed! Error: %d"
,
err
);
return
;
}
_wl_handle
=
0
;
_wl_handle
=
WL_INVALID_HANDLE
;
_impl
->
mountpoint
(
NULL
);
}
}
...
...
@@ -77,7 +81,7 @@ bool F_Fat::format(bool full_wipe, char* partitionLabel)
{
esp_err_t
result
;
bool
res
=
true
;
if
(
_wl_handle
){
if
(
_wl_handle
!=
WL_INVALID_HANDLE
){
log_w
(
"Already Mounted!"
);
return
false
;
}
...
...
@@ -102,7 +106,8 @@ bool F_Fat::format(bool full_wipe, char* partitionLabel)
// Now do a mount with format_if_fail (which it will)
esp_vfs_fat_mount_config_t
conf
=
{
.
format_if_mount_failed
=
true
,
.
max_files
=
1
.
max_files
=
1
,
.
allocation_unit_size
=
CONFIG_WL_SECTOR_SIZE
};
result
=
esp_vfs_fat_spiflash_mount
(
"/format_ffat"
,
partitionLabel
,
&
conf
,
&
temp_handle
);
esp_vfs_fat_spiflash_unmount
(
"/format_ffat"
,
temp_handle
);
...
...
libraries/FFat/src/FFat.h
View file @
ca88fdc2
...
...
@@ -37,7 +37,7 @@ public:
bool
exists
(
const
String
&
path
);
private:
wl_handle_t
_wl_handle
;
wl_handle_t
_wl_handle
=
WL_INVALID_HANDLE
;
};
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment