Skip to content

Commit

Permalink
HackRF code example fix (#59)
Browse files Browse the repository at this point in the history
Getting rid of 100k entries before receiving was doing nothing.
  • Loading branch information
tadas-s authored Dec 10, 2024
1 parent 3f76bee commit 619e2d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions content/hackrf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,6 @@ After running the code below, if in your time plot, the samples are reaching the
return 0
samples = samples[100000:] # get rid of the first 100k samples just to be safe, due to transients
sdr.set_rx_callback(rx_callback)
sdr.pyhackrf_start_rx()
print('is_streaming', sdr.pyhackrf_is_streaming())
Expand All @@ -236,6 +234,8 @@ After running the code below, if in your time plot, the samples are reaching the
sdr.pyhackrf_stop_rx()
sdr.pyhackrf_close()
samples = samples[100000:] # get rid of the first 100k samples just to be safe, due to transients
fft_size = 2048
num_rows = len(samples) // fft_size
spectrogram = np.zeros((num_rows, fft_size))
Expand Down
4 changes: 2 additions & 2 deletions figure-generating-scripts/hackrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ def rx_callback(device, buffer, buffer_length, valid_length): # this callback f

return 0

samples = samples[100000:] # get rid of the first 100k samples just to be safe, due to transients

sdr.set_rx_callback(rx_callback)
sdr.pyhackrf_start_rx()
print('is_streaming', sdr.pyhackrf_is_streaming())
Expand All @@ -104,6 +102,8 @@ def rx_callback(device, buffer, buffer_length, valid_length): # this callback f
sdr.pyhackrf_stop_rx()
sdr.pyhackrf_close()

samples = samples[100000:] # get rid of the first 100k samples just to be safe, due to transients

fft_size = 2048
num_rows = len(samples) // fft_size
spectrogram = np.zeros((num_rows, fft_size))
Expand Down

0 comments on commit 619e2d9

Please sign in to comment.