adafruit / FreqShow

Raspberry Pi & PiTFT-based RTL-SDR frequency scanning and display tool.
MIT License
144 stars 67 forks source link

Another Non-PiTFT issue #18

Open Maxhirez opened 6 years ago

Maxhirez commented 6 years ago

I had the same problem as described in this issue: If I make the changes for pygame described there, I run into another issue.
Found Fitipower FC0012 tuner Traceback (most recent call last): File "/home/pi/rtl-sdr/build/FreqShow/freqshow.py", line 105, in <module> fscontroller.current().render(screen) File "/home/pi/rtl-sdr/build/FreqShow/views.py", line 364, in render self.render_spectrogram(screen.subsurface(spect_rect)) File "/home/pi/rtl-sdr/build/FreqShow/views.py", line 471, in render_spectrogram y = freqs[i] IndexError: index 1022 is out of bounds for axis 0 with size 1022 I tried a cheap if i>1000: i=1000 just to see if it would work but clearly there was no love because it just moved the line number the error occurred in down two.

I'm using a 1920x1080 HDMI monitor on a Pi3B with that Tuner and 2.4ghz GearHead dongled mouse/kbd combo.

Any ideas?

Austinthemighty commented 6 years ago

here is a better formatted version of the code that you put in

pi@raspberrypi:~/FreqShow$ sudo python freqshow.py
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
Traceback (most recent call last):
  File "freqshow.py", line 103, in <module>
    fscontroller.current().render(screen)
  File "/home/pi/FreqShow/views.py", line 364, in render
    self.render_spectrogram(screen.subsurface(spect_rect))
  File "/home/pi/FreqShow/views.py", line 471, in render_spectrogram
    y = freqs[i]
IndexError: index 1022 is out of bounds for axis 0 with size 1022
pi@raspberrypi:~/FreqShow$ 
Austinthemighty commented 6 years ago

i think i found the solution change line 470 from width to 1000

kd8nkw commented 6 years ago

This is caused by making the sample buffer smaller than the screen width. in freqshow.py ( line 28) change

# Application configuration.
SDR_SAMPLE_SIZE = 1024     # Number of samples to grab from the radio.  Should be

to

# Application configuration.
SDR_SAMPLE_SIZE = 2048     # Number of samples to grab from the radio.  Should be

2048 can be any number >= your screen width+2. The actual number of samples gets truncated to width+2 in model.py

samples = self.sdr.read_samples(freqshow.SDR_SAMPLE_SIZE)[0:self.width+2]