kopia lustrzana https://git.code.sf.net/p/tinypythonpanadapter/code
rodzic
414190a5ad
commit
31bcf17d85
2
iq.py
2
iq.py
|
@ -458,7 +458,7 @@ while True:
|
||||||
iq_data_cmplx = dataIn.ReadSamples(chunk_size)
|
iq_data_cmplx = dataIn.ReadSamples(chunk_size)
|
||||||
if opt.rev_iq: # reverse spectrum?
|
if opt.rev_iq: # reverse spectrum?
|
||||||
iq_data_cmplx = np.imag(iq_data_cmplx)+1j*np.real(iq_data_cmplx)
|
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...
|
stats = [ 0, 0] # for now...
|
||||||
else: # Input from audio card
|
else: # Input from audio card
|
||||||
# In its separate thread, a chunk of audio data has accumulated.
|
# In its separate thread, a chunk of audio data has accumulated.
|
||||||
|
|
7
iq_af.py
7
iq_af.py
|
@ -44,22 +44,17 @@ import pyaudio as pa
|
||||||
|
|
||||||
# Global variables (in this module's namespace!)
|
# Global variables (in this module's namespace!)
|
||||||
# globals are required to communicate with callback thread.
|
# globals are required to communicate with callback thread.
|
||||||
led_underrun_ct = 0 # buffer underrun LED
|
led_underrun_ct = 0 # buffer underrun LED
|
||||||
cbcount = 0
|
cbcount = 0
|
||||||
MAXQUEUELEN = 32 # Don't use iq-opt for this?
|
MAXQUEUELEN = 32 # Don't use iq-opt for this?
|
||||||
cbqueue = Queue.Queue(MAXQUEUELEN) # will be queue to transmit af data
|
cbqueue = Queue.Queue(MAXQUEUELEN) # will be queue to transmit af data
|
||||||
cbskip_ct = 0
|
cbskip_ct = 0
|
||||||
queueLock = threading.Lock() # protect queue accesses
|
queueLock = threading.Lock() # protect queue accesses
|
||||||
cbfirst = 1 # Skip this many buffers at start
|
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):
|
def pa_callback_iqin(in_data, f_c, time_info, status):
|
||||||
global cbcount, cbqueue, cbskip, cbskip_ct
|
global cbcount, cbqueue, cbskip, cbskip_ct
|
||||||
#global err_status, err_time_info
|
|
||||||
global led_underrun_ct, queueLock, cbfirst
|
global led_underrun_ct, queueLock, cbfirst
|
||||||
|
|
||||||
#err_status = status # for debugging in case of hangup
|
|
||||||
#err_time_info = time_info
|
|
||||||
cbcount += 1
|
cbcount += 1
|
||||||
|
|
||||||
if status == pa.paInputOverflow:
|
if status == pa.paInputOverflow:
|
||||||
|
|
13
iq_opt.py
13
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.")
|
help="Special mode to fix PCM290x R/L offset.")
|
||||||
op.add_option("--LCD4", action="store_true", dest="lcd4",
|
op.add_option("--LCD4", action="store_true", dest="lcd4",
|
||||||
help='Use 4" LCD instead of large screen')
|
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",
|
op.add_option("--RTL", action="store_true", dest="source_rtl",
|
||||||
help="Set source to RTL-SDR")
|
help="Set source to RTL-SDR")
|
||||||
op.add_option("--REV", action="store_true", dest="rev_iq",
|
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.")
|
"selects default input device.")
|
||||||
op.add_option("--lcd4_brightness", action="store", type="int", dest="lcd4_brightness",
|
op.add_option("--lcd4_brightness", action="store", type="int", dest="lcd4_brightness",
|
||||||
help="LCD4 display brightness 0 - 100")
|
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",
|
op.add_option("--n_buffers", action="store", type="int", dest="buffers",
|
||||||
help="Number of FFT buffers in 'chunk', default 12")
|
help="Number of FFT buffers in 'chunk', default 12")
|
||||||
op.add_option("--pulse_clip", action="store", type="int", dest="pulse",
|
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.")
|
help="RTL_SDR gain, default 0.")
|
||||||
op.add_option("--size", action="store", type="int", dest="size",
|
op.add_option("--size", action="store", type="int", dest="size",
|
||||||
help="size of FFT. Default is 512.")
|
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",
|
op.add_option("--skip", action="store", type="int", dest="skip",
|
||||||
help="Skipping input data parameter >= 0")
|
help="Skipping input data parameter >= 0")
|
||||||
op.add_option("--sp_min", action="store", type="int", dest="sp_min",
|
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
|
lagfix = False, # Fix up PCM 290x bug
|
||||||
lcd4 = False, # default large screen
|
lcd4 = False, # default large screen
|
||||||
lcd4_brightness = 75, # brightness 0 - 100
|
lcd4_brightness = 75, # brightness 0 - 100
|
||||||
# max_queue = 30, # max depth of queue from audio callback
|
|
||||||
pulse = 10, # pulse clip threshold
|
pulse = 10, # pulse clip threshold
|
||||||
rev_iq = False, # Reverse I & Q
|
rev_iq = False, # Reverse I & Q
|
||||||
rtl_frequency = 146.e6, # RTL center freq. Hz
|
rtl_frequency = 146.e6, # RTL center freq. Hz
|
||||||
rtl_gain = 0, # auto
|
rtl_gain = 0, # auto
|
||||||
sample_rate = DEF_SAMPLE_RATE, # (stereo) frames/second (Hz)
|
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
|
skip = 0, # if not =0, skip some input data
|
||||||
source_rtl = False, # Use sound card, not RTL-SDR input
|
source_rtl = False, # Use sound card, not RTL-SDR input
|
||||||
sp_min =-120, # dB relative to clipping, at bottom of grid
|
sp_min =-120, # dB relative to clipping, at bottom of grid
|
||||||
sp_max =-20, # dB relative to clipping, at top of grid
|
sp_max =-20, # dB relative to clipping, at top of grid
|
||||||
v_min =-120, # palette starts at this level
|
v_min =-120, # palette starts at this level
|
||||||
v_max =-20, # palette ends 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 = False, # Using waterfall? T/F
|
||||||
waterfall_accumulation = 4, # No. of spectra per waterfall line
|
waterfall_accumulation = 4, # No. of spectra per waterfall line
|
||||||
waterfall_palette = 2 # choose a waterfall color scheme
|
waterfall_palette = 2 # choose a waterfall color scheme
|
||||||
|
@ -137,7 +128,7 @@ op.set_defaults(
|
||||||
opt, args = op.parse_args()
|
opt, args = op.parse_args()
|
||||||
|
|
||||||
# This is an "option" that the user can't change.
|
# 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
|
# --RTL option forces source=rtl, but normally source=audio
|
||||||
opt.source = "rtl" if opt.source_rtl else "audio"
|
opt.source = "rtl" if opt.source_rtl else "audio"
|
||||||
|
|
7
try.sh
7
try.sh
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# Uncomment exactly one test line.
|
||||||
|
|
||||||
# Audio test, Raspberry Pi, iMic soundcard, USB 1.1 ~85% cpu load
|
# Audio test, Raspberry Pi, iMic soundcard, USB 1.1 ~85% cpu load
|
||||||
# Use 'nice -20 ...' when running at highest CPU utilization.
|
# Use 'nice -20 ...' when running at highest CPU utilization.
|
||||||
|
@ -7,6 +8,8 @@
|
||||||
# RTL Test, Raspberry Pi
|
# RTL Test, Raspberry Pi
|
||||||
#python iq.py --RTL --WATERFALL --rtl_gain=0 --n_buffers=12 --size=384 --REV
|
#python iq.py --RTL --WATERFALL --rtl_gain=0 --n_buffers=12 --size=384 --REV
|
||||||
|
|
||||||
# Audio test, BBB, iMic, USB 2.0 ~75% cpu load
|
# Audio test, BBB, iMic, USB 2.0 ~90% cpu load
|
||||||
/home/martin/iq/iq.py --index=-1 --size=256 --n_buffers=6 --WATERFALL
|
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
|
||||||
|
|
Ładowanie…
Reference in New Issue