svn commit: r246137 - user/adrian/ath_radar_stuff/src/spectral_fft

Adrian Chadd adrian at FreeBSD.org
Wed Jan 30 23:59:05 UTC 2013


Author: adrian
Date: Wed Jan 30 23:59:04 2013
New Revision: 246137
URL: http://svnweb.freebsd.org/changeset/base/246137

Log:
  Display separate lines delineating the centre frequency of channels.

Modified:
  user/adrian/ath_radar_stuff/src/spectral_fft/fft_display.c

Modified: user/adrian/ath_radar_stuff/src/spectral_fft/fft_display.c
==============================================================================
--- user/adrian/ath_radar_stuff/src/spectral_fft/fft_display.c	Wed Jan 30 23:57:19 2013	(r246136)
+++ user/adrian/ath_radar_stuff/src/spectral_fft/fft_display.c	Wed Jan 30 23:59:04 2013	(r246137)
@@ -226,6 +226,23 @@ fft_display_draw_picture(struct fft_disp
 	char text[1024];
 	struct scanresult *result;
 	SDL_Surface *surface;
+	static int chans[] = {
+	    2412, 2417, 2422, 2427,
+	    2432, 2437, 2442, 2447,
+	    2452, 2457, 2462, 2467,
+	    2472, 2484,
+
+	    5180, 5200, 5220, 5240,
+	    5260, 5280, 5300, 5320,
+	    5500, 5520, 5540, 5560,
+	    5580, 5600, 4950, 5620,
+	    4955, 5640, 4960, 5660,
+	    4965, 5680, 4970, 5700,
+	    4975, 5745, 4980, 5765,
+	    5120, 5785, 5140, 5805,
+	    5160, 5825
+	};
+	static int nchans = 48;
 
 	surface = SDL_CreateRGBSurface(SDL_SWSURFACE, WIDTH, HEIGHT, BPP, RMASK, GMASK, BMASK, AMASK);
 	pixels = (Uint32 *) surface->pixels;
@@ -234,7 +251,7 @@ fft_display_draw_picture(struct fft_disp
 			pixels[x + y * WIDTH] = AMASK;
 
 	/* vertical lines (frequency) */
-	for (i = 2300; i < 6000; i += 20) {
+	for (i = 2300; i < 6000; i += 10) {
 		x = (X_SCALE * (i - startfreq));
 
 		if (x < 0 || x > WIDTH)
@@ -243,8 +260,21 @@ fft_display_draw_picture(struct fft_disp
 		for (y = 0; y < HEIGHT - 20; y++)
 			pixels[x + y * WIDTH] = 0x40404040 | AMASK;
 
-		snprintf(text, sizeof(text), "%d MHz", i);
-		render_text(fdisp, surface, text, x - 30, HEIGHT - 20);
+		if (i % 20 == 0) {
+			snprintf(text, sizeof(text), "%d MHz", i);
+			render_text(fdisp, surface, text, x - 30, HEIGHT - 20);
+		}
+	}
+
+	/* and now, the channel lines, at least for channels 1-14 */
+	for (i = 0; i < nchans; i++) {
+		x = (X_SCALE * (chans[i] - startfreq));
+		if (x < 0 || x > WIDTH)
+
+			continue;
+
+		for (y = 0; y < HEIGHT - 20; y++)
+			pixels[x + y * WIDTH] = 0x808080FF | AMASK;
 	}
 
 	/* horizontal lines (dBm) */
@@ -287,7 +317,6 @@ fft_display_draw_picture(struct fft_disp
 				continue;
 		}
 
-
 		/* .. and the max */
 		signal = (float) fft_fetch_freq_max(fdisp->fh, freqKhz);
 		color = RMASK | AMASK;


More information about the svn-src-user mailing list