diff options
author | Jenna Fox <a@creativepony.com> | 2012-10-02 14:51:16 +1000 |
---|---|---|
committer | Jenna Fox <a@creativepony.com> | 2012-10-02 14:51:16 +1000 |
commit | 3e75a53ba6991af1499f8355d97ac4da33e642a0 (patch) | |
tree | 71b375d8465e2731d4c38ca173100273ab13a7ce /commandline/examples | |
parent | 85669da5c3101b2e8c815e257a5e17615ada26f5 (diff) | |
download | micronucleus-3e75a53ba6991af1499f8355d97ac4da33e642a0.tar.gz micronucleus-3e75a53ba6991af1499f8355d97ac4da33e642a0.tar.bz2 micronucleus-3e75a53ba6991af1499f8355d97ac4da33e642a0.zip |
Made live progress printouts more human friendly (total progress instead of step progress)
Diffstat (limited to 'commandline/examples')
-rw-r--r-- | commandline/examples/micronucleus.c | 9 |
1 files changed, 6 insertions, 3 deletions
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; |