TLeconte / acarsdec

ACARS SDR decoder
337 stars 89 forks source link

SoapySDR: Support multiple gains #118

Open Trumeet opened 1 month ago

Trumeet commented 1 month ago

SoapySDR has a function called setGainElement() that allows users to specify gains for different hardware components (e.g., for HackRF, the preamp, the LNA, and the VGA.

Currently acarsdec calls setGain(double) which asks the driver to distribute the gain number to different components, which sometimes may not be desired.

This patch enables the new cmd syntax of -g name:gain -g name:gain ... that allows users to set different gains for different components.

This patch preserves compatibility with the previous syntax -g gain. It conflicts with the previous syntax. The user has to choose between -g gain (use setGain(), supports AGC) or -g name:gain -g name:gain ... (use setGainElement(), does not support AGC)." -m "This patch is for SoapySDR only.

Trumeet commented 1 month ago
$ SOAPY_SDR_LOG_LEVEL=TRACE ./acarsdec -v -m 1600 -g LNA:10.0 -g VGA:30.0 -d "driver=hackrf" 131.475 131.550 131.125 131.450 131.525 131.725 131.850 130.450 130.425 130.025 129.125 129.525 
Got gain argument: 'LNA:10.0'
Got gain argument: 'VGA:30.0'
[INFO] Opening HackRF One #0 15a863dc248a5287...
Setting LNA gain to: 10.000000
[DEBUG] setGain LNA RX, channel 0, gain 10
Setting VGA gain to: 30.000000
[DEBUG] setGain VGA RX, channel 0, gain 30
Set center freq. to 131875000Hz
Setting sample rate: 20.0000 MS/s
[DEBUG] Using format CS16.
Decoding 12 channels
blk_starting
[DEBUG] Start RX
Trumeet commented 1 month ago

Supported gain names: