From 31bcf17d852ae079a7549407ed6c4d9db1587ba0 Mon Sep 17 00:00:00 2001 From: Martin Ewing Date: Sun, 18 May 2014 20:56:40 -0400 Subject: [PATCH] Clean up --- iq.py | 2 +- iq_af.py | 7 +------ iq_opt.py | 13 ++----------- try.sh | 7 +++++-- 4 files changed, 9 insertions(+), 20 deletions(-) diff --git a/iq.py b/iq.py index da870e6..cb4fd13 100755 --- a/iq.py +++ b/iq.py @@ -458,7 +458,7 @@ while True: iq_data_cmplx = dataIn.ReadSamples(chunk_size) if opt.rev_iq: # reverse spectrum? iq_data_cmplx = np.imag(iq_data_cmplx)+1j*np.real(iq_data_cmplx) - time.sleep(0.05) # slow down if fast PC + #time.sleep(0.05) # slow down if fast PC stats = [ 0, 0] # for now... else: # Input from audio card # In its separate thread, a chunk of audio data has accumulated. diff --git a/iq_af.py b/iq_af.py index 52bd822..191f8ac 100755 --- a/iq_af.py +++ b/iq_af.py @@ -44,22 +44,17 @@ import pyaudio as pa # Global variables (in this module's namespace!) # globals are required to communicate with callback thread. -led_underrun_ct = 0 # buffer underrun LED +led_underrun_ct = 0 # buffer underrun LED cbcount = 0 MAXQUEUELEN = 32 # Don't use iq-opt for this? cbqueue = Queue.Queue(MAXQUEUELEN) # will be queue to transmit af data cbskip_ct = 0 queueLock = threading.Lock() # protect queue accesses cbfirst = 1 # Skip this many buffers at start -#err_status = None -#err_time_info = None def pa_callback_iqin(in_data, f_c, time_info, status): global cbcount, cbqueue, cbskip, cbskip_ct - #global err_status, err_time_info global led_underrun_ct, queueLock, cbfirst - #err_status = status # for debugging in case of hangup - #err_time_info = time_info cbcount += 1 if status == pa.paInputOverflow: diff --git a/iq_opt.py b/iq_opt.py index 13fb103..76ae0ff 100755 --- a/iq_opt.py +++ b/iq_opt.py @@ -43,8 +43,6 @@ op.add_option("--LAGFIX", action="store_true", dest="lagfix", help="Special mode to fix PCM290x R/L offset.") op.add_option("--LCD4", action="store_true", dest="lcd4", help='Use 4" LCD instead of large screen') -#op.add_option("--RPI", action="store_true", dest="device_rpi", -# help="Set up some defaults for Raspberry Pi") op.add_option("--RTL", action="store_true", dest="source_rtl", help="Set source to RTL-SDR") op.add_option("--REV", action="store_true", dest="rev_iq", @@ -69,9 +67,6 @@ op.add_option("--index", action="store", type="int", dest="index", "selects default input device.") op.add_option("--lcd4_brightness", action="store", type="int", dest="lcd4_brightness", help="LCD4 display brightness 0 - 100") -# Now set as constant in iq_af.py -#op.add_option("--max_queue", action="store", type="int", dest="max_queue", -# help="Real-time queue depth") op.add_option("--n_buffers", action="store", type="int", dest="buffers", help="Number of FFT buffers in 'chunk', default 12") op.add_option("--pulse_clip", action="store", type="int", dest="pulse", @@ -82,8 +77,6 @@ op.add_option("--rtl_gain", action="store", type="int", dest="rtl_gain", help="RTL_SDR gain, default 0.") op.add_option("--size", action="store", type="int", dest="size", help="size of FFT. Default is 512.") -#op.add_option("--take", action="store", type="int", dest="taking", -# help="No. of buffers to take per chunk, must be <= buffers.") op.add_option("--skip", action="store", type="int", dest="skip", help="Skipping input data parameter >= 0") op.add_option("--sp_min", action="store", type="int", dest="sp_min", @@ -115,20 +108,18 @@ op.set_defaults( lagfix = False, # Fix up PCM 290x bug lcd4 = False, # default large screen lcd4_brightness = 75, # brightness 0 - 100 -# max_queue = 30, # max depth of queue from audio callback pulse = 10, # pulse clip threshold rev_iq = False, # Reverse I & Q rtl_frequency = 146.e6, # RTL center freq. Hz rtl_gain = 0, # auto sample_rate = DEF_SAMPLE_RATE, # (stereo) frames/second (Hz) - size = 384, # size of FFT --> freq. resolution (RPi-256) + size = 384, # size of FFT --> freq. resolution skip = 0, # if not =0, skip some input data source_rtl = False, # Use sound card, not RTL-SDR input sp_min =-120, # dB relative to clipping, at bottom of grid sp_max =-20, # dB relative to clipping, at top of grid v_min =-120, # palette starts at this level v_max =-20, # palette ends at this level -# taking = -1, # 0 < taking < buffers to cut cpu load, -1=all waterfall = False, # Using waterfall? T/F waterfall_accumulation = 4, # No. of spectra per waterfall line waterfall_palette = 2 # choose a waterfall color scheme @@ -137,7 +128,7 @@ op.set_defaults( opt, args = op.parse_args() # This is an "option" that the user can't change. -opt.ident = "IQ.PY v. 0.40 de AA6E" +opt.ident = "IQ.PY v. 0.30 de AA6E" # --RTL option forces source=rtl, but normally source=audio opt.source = "rtl" if opt.source_rtl else "audio" diff --git a/try.sh b/try.sh index f2fafe5..22cb505 100755 --- a/try.sh +++ b/try.sh @@ -1,4 +1,5 @@ #!/bin/bash +# Uncomment exactly one test line. # Audio test, Raspberry Pi, iMic soundcard, USB 1.1 ~85% cpu load # Use 'nice -20 ...' when running at highest CPU utilization. @@ -7,6 +8,8 @@ # RTL Test, Raspberry Pi #python iq.py --RTL --WATERFALL --rtl_gain=0 --n_buffers=12 --size=384 --REV -# Audio test, BBB, iMic, USB 2.0 ~75% cpu load -/home/martin/iq/iq.py --index=-1 --size=256 --n_buffers=6 --WATERFALL +# Audio test, BBB, iMic, USB 2.0 ~90% cpu load +python iq.py --index=-1 --size=256 --n_buffers=6 --WATERFALL --HAMLIB +# RTL Test, BBB ~95% cpu [ Set extra RTL delay in iq.py to zero] +#python iq.py --RTL --WATERFALL --n_buffers=10 --size=384