From 39b27c3cac897cf7f5df0889519245abb1075ab1 Mon Sep 17 00:00:00 2001 From: rhgndf <16336768+rhgndf@users.noreply.github.com> Date: Mon, 2 Oct 2023 00:03:49 +0800 Subject: [PATCH] Add progress bar for uploading fuses --- src_pc/afterburner.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src_pc/afterburner.c b/src_pc/afterburner.c index 89b7778..e71decf 100644 --- a/src_pc/afterburner.c +++ b/src_pc/afterburner.c @@ -778,6 +778,9 @@ static char upload() { //fuse map buf[0] = 0; fuseSet = 0; + + printf("Uploading fuse map...\n"); + printf("\e[?25l"); for (i = 0; i < totalFuses;) { unsigned char f = 0; if (i % 32 == 0) { @@ -805,8 +808,13 @@ static char upload() { sprintf(line, "%02X", f); strcat(buf, line); - + + printf("%4d/%4d |", i + 1, totalFuses); + int done = ((i + 1) * 40) / totalFuses; + printf("%.*s%*s|\r", done, "########################################", 40 - done, ""); } + printf("%4d/%4d |########################################|\n", totalFuses, totalFuses); + printf("\e[?25h"); // send last unfinished fuse line if (i % 32 && fuseSet) {