From fed415b6996dc4bcd076f103f57d38474f413505 Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 7 Jan 2013 00:29:35 +0100 Subject: [PATCH] Show 16 bit magnitude value with --debug. --- dump1090.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/dump1090.c b/dump1090.c index c33156c..b9a7879 100644 --- a/dump1090.c +++ b/dump1090.c @@ -387,19 +387,19 @@ void *readerThreadEntryPoint(void *arg) { * "." is 1 */ void dumpMagnitudeBar(int index, int magnitude) { - char *set = ".-o"; + char *set = " .-o"; char buf[256]; - int div = magnitude / 4; - int rem = magnitude % 4; + int div = magnitude / 256 / 4; + int rem = magnitude / 256 % 4; memset(buf,'O',div); buf[div] = set[rem]; buf[div+1] = '\0'; if (index >= 0) - printf("[%.3d] |%-69s %d\n", index, buf, magnitude); + printf("[%.3d] |%-66s %d\n", index, buf, magnitude); else - printf("[%.2d] |%-69s %d\n", index, buf, magnitude); + printf("[%.2d] |%-66s %d\n", index, buf, magnitude); } /* Display an ASCII-art alike graphical representation of the undecoded @@ -418,8 +418,7 @@ void dumpMagnitudeVector(uint16_t *m, uint32_t offset) { uint32_t j; for (j = start; j <= end; j++) { - /* Scale magnitude to 0-255 from 0-65535 before printing. */ - dumpMagnitudeBar(j-offset, m[j]/256); + dumpMagnitudeBar(j-offset, m[j]); } }