Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
nexboot
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
nexboot
Commits
65b53caa
Commit
65b53caa
authored
May 18, 2018
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write uploaded file on OTA partition
parent
5f9e6c9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
nexboot.c
main/nexboot.c
+14
-2
No files found.
main/nexboot.c
View file @
65b53caa
...
...
@@ -143,7 +143,6 @@ char *mgStrToStr(struct mg_str mgStr) {
struct
fwriter_data
{
const
esp_partition_t
*
update_partition
;
char
recv_buf
[
1024
];
esp_ota_handle_t
update_handle
;
size_t
bytes_written
;
};
...
...
@@ -190,13 +189,26 @@ static void mg_ev_handler(struct mg_connection *nc, int ev, void *p) {
data
->
bytes_written
=
0
;
data
->
update_partition
=
NULL
;
data
->
update_handle
=
0
;
data
->
update_partition
=
esp_ota_get_next_update_partition
(
NULL
);
ESP_LOGI
(
TAG
,
"Writing to partition subtype %d at offset 0x%x
\n
"
,
data
->
update_partition
->
subtype
,
data
->
update_partition
->
address
);
if
(
data
->
update_partition
==
NULL
)
ESP_ERROR_CHECK
(
ESP_FAIL
);
ESP_ERROR_CHECK
(
esp_ota_begin
(
data
->
update_partition
,
OTA_SIZE_UNKNOWN
,
&
data
->
update_handle
));
ESP_LOGI
(
TAG
,
"esp_ota_begin succeeded
\n
"
);
}
nc
->
user_data
=
(
void
*
)
data
;
break
;
}
case
MG_EV_HTTP_PART_DATA
:
{
data
->
bytes_written
+=
mp
->
data
.
len
;
ESP_LOGD
(
TAG
,
"MG_EV_HTTP_PART_DATA %p len %d
\n
"
,
nc
,
mp
->
data
.
len
);
ESP_LOGI
(
TAG
,
"MG_EV_HTTP_PART_DATA %p len %d
\n
"
,
nc
,
mp
->
data
.
len
);
ESP_ERROR_CHECK
(
esp_ota_write
(
data
->
update_handle
,
(
void
*
)
mp
->
data
.
p
,
mp
->
data
.
len
));
break
;
}
case
MG_EV_HTTP_PART_END
:
{
...
...
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