From 42f6bac7f32e3fe9a0516250cd96b2fb0b4f4c1c Mon Sep 17 00:00:00 2001 From: ismagom Date: Mon, 18 Jan 2016 12:35:40 +0100 Subject: [PATCH] Fixed get_rx_gain for blade --- srslte/examples/cell_measurement.c | 2 +- srslte/lib/rf/src/rf_blade_imp.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/srslte/examples/cell_measurement.c b/srslte/examples/cell_measurement.c index debb268a8..62084a335 100644 --- a/srslte/examples/cell_measurement.c +++ b/srslte/examples/cell_measurement.c @@ -338,7 +338,7 @@ int main(int argc, char **argv) { if (srslte_rf_has_rssi(&rf)) { rx_gain_offset = 10*log10(rssi)-srslte_rf_get_rssi(&rf); } else { - rx_gain_offset = srslte_rf_get_rx_gain(&rf); + rx_gain_offset = srslte_rf_get_rx_gain(&rf); } } diff --git a/srslte/lib/rf/src/rf_blade_imp.c b/srslte/lib/rf/src/rf_blade_imp.c index 4949ce035..5852b8718 100644 --- a/srslte/lib/rf/src/rf_blade_imp.c +++ b/srslte/lib/rf/src/rf_blade_imp.c @@ -270,7 +270,7 @@ double rf_blade_set_rx_gain(void *h, double gain) { int status; rf_blade_handler_t *handler = (rf_blade_handler_t*) h; - status = bladerf_set_rxvga2(handler->dev, (int) gain); + status = bladerf_set_rxvga2(handler->dev, (int) gain - 31); if (status != 0) { fprintf(stderr, "Failed to set RX VGA2 gain: %s\n", bladerf_strerror(status)); return -1; @@ -301,7 +301,7 @@ double rf_blade_get_rx_gain(void *h) bladerf_strerror(status)); return -1; } - return gain; + return gain+31; // Add rxvga1 and LNA } double rf_blade_get_tx_gain(void *h) @@ -315,7 +315,7 @@ double rf_blade_get_tx_gain(void *h) bladerf_strerror(status)); return -1; } - return gain; + return gain; // Add txvga1 } double rf_blade_set_rx_freq(void *h, double freq) @@ -351,8 +351,6 @@ void rf_blade_set_tx_cal(void *h, srslte_rf_cal_t *cal) { bladerf_set_correction(handler->dev, BLADERF_MODULE_TX, BLADERF_CORR_FPGA_GAIN, cal->dc_phase); bladerf_set_correction(handler->dev, BLADERF_MODULE_TX, BLADERF_CORR_LMS_DCOFF_I, cal->iq_i); bladerf_set_correction(handler->dev, BLADERF_MODULE_TX, BLADERF_CORR_LMS_DCOFF_Q, cal->iq_q); - - printf("Set CAL values %f, %f, %f, %f\n", cal->dc_gain, cal->dc_phase, cal->iq_i, cal->iq_q); } void rf_blade_set_rx_cal(void *h, srslte_rf_cal_t *cal) {