fmscan: Correctly calculate percentages for display during scan.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 20 Dec 2009 04:43:43 +0000 (19 20:43 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 20 Dec 2009 04:43:43 +0000 (19 20:43 -0800)
The final percentages were already correct, but the ones displayed during
the scan were off.

fmscan.c

index 0ef092d..2b24f0b 100644 (file)
--- a/fmscan.c
+++ b/fmscan.c
@@ -151,7 +151,7 @@ int main(int argc, char **argv)
                totsig = 0;
                for (i = 0; i < tries; i++) {
                         totsig += tuner_get_signal(&tuner);
-                       perc = totsig / (65535.0 * i);
+                       perc = totsig / (65535.0 * (i + 1));
                         if (!quiet) {
                                 printf("%2.1f: checking: %3.1f%% (%d/%d)"
                                        "    \r",