mirror of
https://github.com/ole00/afterburner.git
synced 2024-06-18 04:29:28 +00:00
PC app: added progress bar update function
This commit is contained in:
parent
0761907067
commit
b733cd5e6a
|
@ -796,6 +796,17 @@ static int sendLine(char* buf, int bufSize, int maxDelay) {
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void updateProgressBar(char* label, int current, int total) {
|
||||||
|
int done = ((current + 1) * 40) / total;
|
||||||
|
if (current >= total) {
|
||||||
|
printf("%s%5d/%5d |########################################|\n", label, total, total);
|
||||||
|
} else {
|
||||||
|
printf("%s%5d/%5d |", label, current, total);
|
||||||
|
printf("%.*s%*s|\r", done, "########################################", 40 - done, "");
|
||||||
|
fflush(stdout); //flush the text out so that the animation of the progress bar looks smooth
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Upload fusemap in byte format (as opposed to bit format used in JEDEC file).
|
// Upload fusemap in byte format (as opposed to bit format used in JEDEC file).
|
||||||
static char upload() {
|
static char upload() {
|
||||||
char fuseSet;
|
char fuseSet;
|
||||||
|
@ -851,12 +862,9 @@ static char upload() {
|
||||||
sprintf(line, "%02X", f);
|
sprintf(line, "%02X", f);
|
||||||
strcat(buf, line);
|
strcat(buf, line);
|
||||||
|
|
||||||
printf("%4d/%4d |", i + 1, totalFuses);
|
updateProgressBar("", i, totalFuses);
|
||||||
int done = ((i + 1) * 40) / totalFuses;
|
|
||||||
printf("%.*s%*s|\r", done, "########################################", 40 - done, "");
|
|
||||||
fflush(stdout); //flush the text out so that the animation of the progress bar looks smooth
|
|
||||||
}
|
}
|
||||||
printf("%4d/%4d |########################################|\n", totalFuses, totalFuses);
|
updateProgressBar("", totalFuses, totalFuses);
|
||||||
|
|
||||||
// send last unfinished fuse line
|
// send last unfinished fuse line
|
||||||
if (fuseSet) {
|
if (fuseSet) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user