diff --git a/host/hackrf-tools/src/hackrf_sweep.c b/host/hackrf-tools/src/hackrf_sweep.c index 1947a36a..2edd68cf 100644 --- a/host/hackrf-tools/src/hackrf_sweep.c +++ b/host/hackrf-tools/src/hackrf_sweep.c @@ -173,6 +173,7 @@ bool antenna = false; uint32_t antenna_enable; bool binary_output = false; +bool one_shot = false; volatile bool sweep_started = false; int fftSize = 20; @@ -208,6 +209,9 @@ int rx_callback(hackrf_transfer* transfer) { byte_count += transfer->valid_length; buf = (int8_t*) transfer->buffer; for(j=0; j= (uint64_t)(FREQ_ONE_MHZ*frequencies[num_ranges*2-1]))) { + do_exit = true; + } } return 0; } @@ -289,6 +297,7 @@ static void usage() { fprintf(stderr, "\t[-g gain_db] # RX VGA (baseband) gain, 0-62dB, 2dB steps\n"); fprintf(stderr, "\t[-n num_samples] # Number of samples per frequency, 16384-4294967296\n"); fprintf(stderr, "\t[-w bin_width] # FFT bin width (frequency resolution) in Hz\n"); + fprintf(stderr, "\t[-1] # one shot mode\n"); fprintf(stderr, "\t[-B] # binary output\n"); fprintf(stderr, "\n"); fprintf(stderr, "Output fields:\n"); @@ -328,7 +337,7 @@ int main(int argc, char** argv) { uint32_t freq_max = 6000; - while( (opt = getopt(argc, argv, "a:f:p:l:g:d:n:w:Bh?")) != EOF ) { + while( (opt = getopt(argc, argv, "a:f:p:l:g:d:n:w:1Bh?")) != EOF ) { result = HACKRF_SUCCESS; switch( opt ) { @@ -390,6 +399,10 @@ int main(int argc, char** argv) { fftSize = DEFAULT_SAMPLE_RATE_HZ / fft_bin_width; break; + case '1': + one_shot = true; + break; + case 'B': binary_output = true; break; @@ -456,9 +469,9 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } - if(65536 < fftSize) { + if(16368 < fftSize) { fprintf(stderr, - "argument error: FFT bin width (-w) resulted in more than 65536 FFT bins\n"); + "argument error: FFT bin width (-w) too small, resulted in more than 16368 FFT bins\n"); return EXIT_FAILURE; }