Skip to content

Commit

Permalink
Fixed the -n option in airspy_rx
Browse files Browse the repository at this point in the history
  • Loading branch information
touil committed Nov 27, 2014
1 parent 0df832f commit 5d2c79f
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions airspy-tools/src/airspy_rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,6 @@ int main(int argc, char** argv)
case 'n':
limit_num_samples = true;
result = parse_u64(optarg, &samples_to_xfer);
bytes_to_xfer = samples_to_xfer * 2;
break;

default:
Expand All @@ -637,6 +636,8 @@ int main(int argc, char** argv)
}
}

bytes_to_xfer = samples_to_xfer * wav_nb_byte_per_sample * wav_nb_channels;

if (wav_nb_channels == 1)
{
wav_sample_per_sec *= 2;
Expand Down Expand Up @@ -872,19 +873,11 @@ int main(int argc, char** argv)

sleep(1);

while( (airspy_is_streaming(device) == AIRSPY_TRUE) &&
(do_exit == false) )
while( ((airspy_is_streaming(device) == AIRSPY_TRUE) &&
(do_exit == false)) && ((limit_num_samples == true) && (bytes_to_xfer > 0)))
{
float average_rate_now = average_rate * 1e-6f;

//if (average_rate_now < 10000000) {
// exit_code = EXIT_FAILURE;
// printf("\nCouldn't transfer any samples for one second.\n");
// break;
//}

printf("Streaming at %*2.2f MSPS\n", 1, average_rate_now);

sleep(1);
}

Expand All @@ -893,7 +886,7 @@ int main(int argc, char** argv)
{
printf("\nUser cancel, exiting...\n");
} else {
printf("\nExiting... airspy_is_streaming() result: %s (%d)\n", airspy_error_name(result), result);
printf("\nExiting...\n");
}

gettimeofday(&t_end, NULL);
Expand Down

0 comments on commit 5d2c79f

Please sign in to comment.