AGC does not get stuck in high gain if low signal. AGC is now default.

master
Xavier Arteaga 7 years ago
parent 080b1e3239
commit 28ef713160

@ -41,13 +41,13 @@ int rf_get_available_devices(char **devnames, int max_strlen) {
double srslte_rf_set_rx_gain_th(srslte_rf_t *rf, double gain) double srslte_rf_set_rx_gain_th(srslte_rf_t *rf, double gain)
{ {
if (gain > rf->new_rx_gain + 2 || gain < rf->new_rx_gain - 2) { if (gain > rf->cur_rx_gain + 2 || gain < rf->cur_rx_gain - 2){
pthread_mutex_lock(&rf->mutex); pthread_mutex_lock(&rf->mutex);
rf->new_rx_gain = gain; rf->new_rx_gain = gain;
pthread_cond_signal(&rf->cond); pthread_cond_signal(&rf->cond);
pthread_mutex_unlock(&rf->mutex); pthread_mutex_unlock(&rf->mutex);
} }
return gain; return rf->cur_rx_gain;
} }
void srslte_rf_set_tx_rx_gain_offset(srslte_rf_t *rf, double offset) { void srslte_rf_set_tx_rx_gain_offset(srslte_rf_t *rf, double offset) {
@ -65,8 +65,9 @@ static void* thread_gain_fcn(void *h) {
pthread_cond_wait(&rf->cond, &rf->mutex); pthread_cond_wait(&rf->cond, &rf->mutex);
} }
if (rf->new_rx_gain != rf->cur_rx_gain) { if (rf->new_rx_gain != rf->cur_rx_gain) {
rf->cur_rx_gain = rf->new_rx_gain; srslte_rf_set_rx_gain(h, rf->new_rx_gain);
srslte_rf_set_rx_gain(h, rf->cur_rx_gain); rf->cur_rx_gain = srslte_rf_get_rx_gain(h);
rf->new_rx_gain = rf->cur_rx_gain;
} }
if (rf->tx_gain_same_rx) { if (rf->tx_gain_same_rx) {
printf("setting also tx\n"); printf("setting also tx\n");

@ -28,7 +28,7 @@
dl_earfcn = 3400 dl_earfcn = 3400
freq_offset = 0 freq_offset = 0
tx_gain = 80 tx_gain = 80
rx_gain = 40 #rx_gain = 40
#nof_rx_ant = 1 #nof_rx_ant = 1
#device_name = auto #device_name = auto

Loading…
Cancel
Save