mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 07:41:35 +08:00
canbootloader:Per UAVCAN call display Percentage not KB
This commit is contained in:
committed by
Lorenz Meier
parent
a1be559978
commit
9fd7eb5944
@@ -761,6 +761,7 @@ static flash_error_t file_read_and_program(const uavcan_Path_t *fw_path, uint8_t
|
|||||||
size_t length;
|
size_t length;
|
||||||
|
|
||||||
protocol.tail_init.u8 = 0;
|
protocol.tail_init.u8 = 0;
|
||||||
|
int a_percent = fw_image_size / 100;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* reset the rate limit */
|
/* reset the rate limit */
|
||||||
@@ -844,7 +845,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;
|
bootloader.percentage_done = (request.offset / a_percent);
|
||||||
|
|
||||||
} while (request.offset < fw_image_size &&
|
} while (request.offset < fw_image_size &&
|
||||||
length == sizeof(response.data) &&
|
length == sizeof(response.data) &&
|
||||||
@@ -856,7 +857,6 @@ 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 {
|
||||||
@@ -1336,6 +1336,8 @@ __EXPORT int main(int argc, char *argv[])
|
|||||||
goto failure;
|
goto failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bootloader.percentage_done = 100;
|
||||||
|
|
||||||
/* Send a completion log allocation_message */
|
/* Send a completion log allocation_message */
|
||||||
uavcan_tx_log_message(LOGMESSAGE_LEVELINFO,
|
uavcan_tx_log_message(LOGMESSAGE_LEVELINFO,
|
||||||
LOGMESSAGE_STAGE_FINALIZE,
|
LOGMESSAGE_STAGE_FINALIZE,
|
||||||
|
|||||||
Reference in New Issue
Block a user