Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
e14dd7ab
Commit
e14dd7ab
authored
Jun 28, 2016
by
FrankX
Committed by
Marcel Stör
Jun 28, 2016
Browse files
Adjust EUS to new SPIFFS (#1376)
parent
adf71735
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/modules/enduser_setup.c
View file @
e14dd7ab
...
@@ -485,15 +485,20 @@ static int enduser_setup_http_load_payload(void)
...
@@ -485,15 +485,20 @@ static int enduser_setup_http_load_payload(void)
{
{
ENDUSER_SETUP_DEBUG
(
"enduser_setup_http_load_payload"
);
ENDUSER_SETUP_DEBUG
(
"enduser_setup_http_load_payload"
);
int
err
=
(
FS_OPEN_OK
-
1
);
int
err2
=
(
FS_OPEN_OK
-
1
);
int
file_len
=
0
;
int
f
=
fs_open
(
http_html_filename
,
fs_mode2flag
(
"r"
));
int
f
=
fs_open
(
http_html_filename
,
fs_mode2flag
(
"r"
));
int
err
=
fs_seek
(
f
,
0
,
FS_SEEK_END
);
if
(
f
>=
FS_OPEN_OK
)
{
int
file_len
=
(
int
)
fs_tell
(
f
);
err
=
fs_seek
(
f
,
0
,
FS_SEEK_END
);
int
err2
=
fs_seek
(
f
,
0
,
FS_SEEK_SET
);
file_len
=
(
int
)
fs_tell
(
f
);
err2
=
fs_seek
(
f
,
0
,
FS_SEEK_SET
);
}
const
char
cl_hdr
[]
=
"Content-length:%5d
\r\n\r\n
"
;
const
char
cl_hdr
[]
=
"Content-length:%5d
\r\n\r\n
"
;
const
size_t
cl_len
=
LITLEN
(
cl_hdr
)
+
3
;
/* room to expand %4d */
const
size_t
cl_len
=
LITLEN
(
cl_hdr
)
+
3
;
/* room to expand %4d */
if
(
f
==
0
||
err
==
-
1
||
err2
==
-
1
)
if
(
f
<
FS_OPEN_OK
||
err
<
FS_OPEN_OK
||
err2
<
FS_OPEN_OK
)
{
{
ENDUSER_SETUP_DEBUG
(
"enduser_setup_http_load_payload unable to load file enduser_setup.html, loading backup HTML."
);
ENDUSER_SETUP_DEBUG
(
"enduser_setup_http_load_payload unable to load file enduser_setup.html, loading backup HTML."
);
...
@@ -527,6 +532,7 @@ static int enduser_setup_http_load_payload(void)
...
@@ -527,6 +532,7 @@ static int enduser_setup_http_load_payload(void)
offset
+=
LITLEN
(
http_header_200
);
offset
+=
LITLEN
(
http_header_200
);
offset
+=
c_sprintf
(
state
->
http_payload_data
+
offset
,
cl_hdr
,
file_len
);
offset
+=
c_sprintf
(
state
->
http_payload_data
+
offset
,
cl_hdr
,
file_len
);
fs_read
(
f
,
&
(
state
->
http_payload_data
[
offset
]),
file_len
);
fs_read
(
f
,
&
(
state
->
http_payload_data
[
offset
]),
file_len
);
fs_close
(
f
);
return
0
;
return
0
;
}
}
...
...
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