Add file upload progress logging to webportal service

parent 3e6f7a5c
...@@ -325,6 +325,7 @@ int fw_data_received(const char *key, const char *value, size_t valuelen, void * ...@@ -325,6 +325,7 @@ int fw_data_received(const char *key, const char *value, size_t valuelen, void *
valuelen = fw_data->buffer_length - fw_data->current_write_offset; valuelen = fw_data->buffer_length - fw_data->current_write_offset;
fw_data->overflow = 1; fw_data->overflow = 1;
} }
LOG_INF("File upload in progress, received %ld byte chunk, %ldkB transferred so far", valuelen, fw_data->current_write_offset / 1024);
memcpy(fw_data->buffer_address + fw_data->current_write_offset, value, valuelen); memcpy(fw_data->buffer_address + fw_data->current_write_offset, value, valuelen);
fw_data->current_write_offset += valuelen; fw_data->current_write_offset += valuelen;
fw_data->valid_bytes = fw_data->current_write_offset; fw_data->valid_bytes = fw_data->current_write_offset;
...@@ -351,6 +352,8 @@ int firmware_upload_handler(struct mg_connection *conn, void *cbdata) ...@@ -351,6 +352,8 @@ int firmware_upload_handler(struct mg_connection *conn, void *cbdata)
// Call the form handler // Call the form handler
ret = mg_handle_form_request(conn, &fdh); ret = mg_handle_form_request(conn, &fdh);
LOG_INF("File upload complete, received %lldkB", main_firmware_buffer.valid_bytes / 1024);
// Clear out the remainder of the buffer // Clear out the remainder of the buffer
memset(main_firmware_buffer.buffer_address + main_firmware_buffer.valid_bytes, 0xff, main_firmware_buffer.buffer_length - main_firmware_buffer.valid_bytes); memset(main_firmware_buffer.buffer_address + main_firmware_buffer.valid_bytes, 0xff, main_firmware_buffer.buffer_length - main_firmware_buffer.valid_bytes);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment