forked from Archive/PX4-Autopilot
canbootloader:Send number of KB written while updating FW
This commit is contained in:
parent
d426dd771f
commit
51b54c025b
|
@ -98,6 +98,7 @@ typedef volatile struct bootloader_t {
|
||||||
bool wait_for_getnodeinfo;
|
bool wait_for_getnodeinfo;
|
||||||
bool app_bl_request;
|
bool app_bl_request;
|
||||||
bool sent_node_info_response;
|
bool sent_node_info_response;
|
||||||
|
uint16_t percentage_done;
|
||||||
union {
|
union {
|
||||||
uint32_t l;
|
uint32_t l;
|
||||||
uint8_t b[sizeof(uint32_t)];
|
uint8_t b[sizeof(uint32_t)];
|
||||||
|
@ -288,7 +289,7 @@ static void node_status_process(bl_timer_id id, void *context)
|
||||||
message.u8 = uavcan_pack(bootloader.sub_mode, NodeStatus, sub_mode)
|
message.u8 = uavcan_pack(bootloader.sub_mode, NodeStatus, sub_mode)
|
||||||
| uavcan_pack(bootloader.mode, NodeStatus, mode)
|
| uavcan_pack(bootloader.mode, NodeStatus, mode)
|
||||||
| uavcan_pack(bootloader.health, NodeStatus, health);
|
| uavcan_pack(bootloader.health, NodeStatus, health);
|
||||||
message.vendor_specific_status_code = 0u;
|
message.vendor_specific_status_code = bootloader.percentage_done;
|
||||||
uavcan_tx_dsdl(DSDLMsgNodeStatus, &protocol, (const uint8_t *) &message, sizeof(uavcan_NodeStatus_t));
|
uavcan_tx_dsdl(DSDLMsgNodeStatus, &protocol, (const uint8_t *) &message, sizeof(uavcan_NodeStatus_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -756,6 +757,8 @@ static flash_error_t file_read_and_program(const uavcan_Path_t *fw_path, uint8_t
|
||||||
/* Set up the read request */
|
/* Set up the read request */
|
||||||
memcpy(&request.path, fw_path, sizeof(uavcan_Path_t));
|
memcpy(&request.path, fw_path, sizeof(uavcan_Path_t));
|
||||||
|
|
||||||
|
bootloader.percentage_done = 0;
|
||||||
|
|
||||||
uint8_t retries = UavcanServiceRetries;
|
uint8_t retries = UavcanServiceRetries;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -852,6 +855,7 @@ static flash_error_t file_read_and_program(const uavcan_Path_t *fw_path, uint8_t
|
||||||
length + (length & 1));
|
length + (length & 1));
|
||||||
|
|
||||||
request.offset += length;
|
request.offset += length;
|
||||||
|
bootloader.percentage_done = (request.offset / 1024) + 1;
|
||||||
|
|
||||||
/* rate limit */
|
/* rate limit */
|
||||||
while (!timer_expired(tread)) {
|
while (!timer_expired(tread)) {
|
||||||
|
@ -870,7 +874,7 @@ static flash_error_t file_read_and_program(const uavcan_Path_t *fw_path, uint8_t
|
||||||
* was not. */
|
* was not. */
|
||||||
if (uavcan_status == UavcanOk && flash_status == FLASH_OK
|
if (uavcan_status == UavcanOk && flash_status == FLASH_OK
|
||||||
&& request.offset == fw_image_size && length != 0) {
|
&& request.offset == fw_image_size && length != 0) {
|
||||||
|
bootloader.percentage_done = 0;
|
||||||
return FLASH_OK;
|
return FLASH_OK;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue