hackrf_sweep: switch main loop timing back to 1Hz

fixes #850
fixes #851
This commit is contained in:
Mike Walters
2021-03-18 19:48:53 +00:00
parent f2021608a6
commit 5361b3a7f4

View File

@ -393,6 +393,7 @@ int main(int argc, char** argv) {
const char* serial_number = NULL;
int exit_code = EXIT_SUCCESS;
struct timeval time_now;
struct timeval time_prev;
float time_diff;
float sweep_rate;
unsigned int lna_gain=16, vga_gain=20;
@ -702,6 +703,7 @@ int main(int argc, char** argv) {
}
gettimeofday(&t_start, NULL);
time_prev = t_start;
fprintf(stderr, "Stop with Ctrl-C\n");
while((hackrf_is_streaming(device) == HACKRF_TRUE) && (do_exit == false)) {
@ -709,7 +711,7 @@ int main(int argc, char** argv) {
m_sleep(50);
gettimeofday(&time_now, NULL);
if (TimevalDiff(&time_now, &time_prev) >= 1.0f) {
time_difference = TimevalDiff(&time_now, &t_start);
sweep_rate = (float)sweep_count / time_difference;
fprintf(stderr, "%" PRIu64 " total sweeps completed, %.2f sweeps/second\n",
@ -721,6 +723,8 @@ int main(int argc, char** argv) {
break;
}
byte_count = 0;
time_prev = time_now;
}
}
result = hackrf_is_streaming(device);