From 3e75a53ba6991af1499f8355d97ac4da33e642a0 Mon Sep 17 00:00:00 2001 From: Jenna Fox Date: Tue, 2 Oct 2012 14:51:16 +1000 Subject: Made live progress printouts more human friendly (total progress instead of step progress) --- commandline/examples/micronucleus.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'commandline/examples') diff --git a/commandline/examples/micronucleus.c b/commandline/examples/micronucleus.c index 5fb4c32..8bca517 100644 --- a/commandline/examples/micronucleus.c +++ b/commandline/examples/micronucleus.c @@ -100,8 +100,8 @@ int main(int argc, char **argv) { } setProgressData("waiting", 1); - printProgress(0.5); - printf("> Please plug the device ... \n"); + if (dump_progress) printProgress(0.5); + printf("> Please plug in the device ... \n"); printf("> Press CTRL+C to terminate the program.\n"); while (my_device == NULL) { @@ -221,7 +221,10 @@ static void printProgress(float progress) { printf("\033[1F\033[2K"); // move cursor to previous line and erase last update in this progress sequence } #endif - printf("%s: %d%% complete\n", progress_friendly_name, (int) (progress * 100.0f)); + + float total_progress = ((float) progress_step - 1.0f) / (float) progress_total_steps; + total_progress += progress / (float) progress_total_steps; + printf("%s: %d%% complete\n", progress_friendly_name, (int) (total_progress * 100.0f)); } last_step = progress_step; -- cgit v1.2.3