1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 14:28:07 +00:00

bootloader: join erase/flash loader into one process

This commit is contained in:
Pavol Rusnak 2017-06-21 13:11:15 +02:00
parent be83b8b138
commit 27f7a26d6e
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 2 additions and 3 deletions

View File

@ -158,7 +158,6 @@ void mainloop(void)
}
display_clear();
display_loader(0, 0, 0xFFFF, 0, 0, 0, 0);
uint8_t buf[USB_PACKET_SIZE];

View File

@ -225,7 +225,7 @@ static uint32_t firmware_remaining, firmware_flashed, chunk_requested;
static void progress_erase(uint16_t val)
{
display_loader(val, 0, 0xFFFF, 0, 0, 0, 0);
display_loader(val / 4, 0, 0xFFFF, 0, 0, 0, 0);
}
void process_msg_FirmwareErase(uint8_t iface_num, uint32_t msg_size, uint8_t *buf)
@ -265,7 +265,7 @@ static bool _read_payload(pb_istream_t *stream, const pb_field_t *field, void **
chunk_size = stream->bytes_left;
while (stream->bytes_left) {
// print loader
display_loader(1000 * (firmware_flashed + chunk_written) / (firmware_flashed + firmware_remaining), 0, 0xFFFF, 0, 0, 0, 0);
display_loader(250 + 750 * (firmware_flashed + chunk_written) / (firmware_flashed + firmware_remaining), 0, 0xFFFF, 0, 0, 0, 0);
memset(buf, 0xFF, sizeof(buf));
// read data
if (!pb_read(stream, (pb_byte_t *)buf, (stream->bytes_left > BUFSIZE) ? BUFSIZE : stream->bytes_left)) {