Always call hackrf_set_hw_sync_mode in hackrf_transfer.

Avoids the need to manually disable the hw synchronisation by specifyinh the option -H 0.
Omitting -H 0 has the same effect.
This commit is contained in:
Marco Bartolucci
2017-05-22 11:40:12 +02:00
parent 8d0187770a
commit e682fe812e

View File

@ -311,7 +311,7 @@ bool signalsource = false;
uint32_t amplitude = 0; uint32_t amplitude = 0;
bool hw_sync = false; bool hw_sync = false;
uint32_t hw_sync_enable; uint32_t hw_sync_enable = 0;
bool receive = false; bool receive = false;
bool receive_wav = false; bool receive_wav = false;
@ -963,14 +963,12 @@ int main(int argc, char** argv) {
} }
} }
if(hw_sync) {
fprintf(stderr, "call hackrf_set_hw_sync_mode(%d)\n", hw_sync_enable); fprintf(stderr, "call hackrf_set_hw_sync_mode(%d)\n", hw_sync_enable);
result = hackrf_set_hw_sync_mode(device, hw_sync_enable ? HW_SYNC_MODE_ON : HW_SYNC_MODE_OFF); result = hackrf_set_hw_sync_mode(device, hw_sync_enable ? HW_SYNC_MODE_ON : HW_SYNC_MODE_OFF);
if( result != HACKRF_SUCCESS ) { if( result != HACKRF_SUCCESS ) {
fprintf(stderr, "hackrf_set_hw_sync_mode() failed: %s (%d)\n", hackrf_error_name(result), result); fprintf(stderr, "hackrf_set_hw_sync_mode() failed: %s (%d)\n", hackrf_error_name(result), result);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
}
if( transceiver_mode == TRANSCEIVER_MODE_RX ) { if( transceiver_mode == TRANSCEIVER_MODE_RX ) {
result = hackrf_set_vga_gain(device, vga_gain); result = hackrf_set_vga_gain(device, vga_gain);