From f8838172ad289675b9c8a1013492798e5335c468 Mon Sep 17 00:00:00 2001 From: Thomas Tsou Date: Mon, 1 Aug 2011 19:52:35 -0700 Subject: [PATCH] transceiver: fix bug in setting low-level attenuation This patch fixes some confusion in gain vs. attenuation setting. The UHD device is controlled through gain settings but OpenBTS represents gain in terms of attenuation relative to maximum - 0 dB attenuation. Signed-off-by: Thomas Tsou --- public-trunk/Transceiver/radioInterface.cpp | 6 +++--- public-trunk/Transceiver52M/radioInterface.cpp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public-trunk/Transceiver/radioInterface.cpp b/public-trunk/Transceiver/radioInterface.cpp index d3b5ec8..ff395c1 100644 --- a/public-trunk/Transceiver/radioInterface.cpp +++ b/public-trunk/Transceiver/radioInterface.cpp @@ -82,10 +82,10 @@ double RadioInterface::fullScaleOutputValue(void) { void RadioInterface::setPowerAttenuation(double atten) { - double rfAtten, digAtten; + double rfGain, digAtten; - rfAtten = usrp->setTxGain(usrp->maxTxGain() - atten); - digAtten = atten - rfAtten; + rfGain = usrp->setTxGain(usrp->maxTxGain() - atten); + digAtten = atten - usrp->maxTxGain() + rfGain; if (digAtten < 1.0) powerScaling = 1.0; diff --git a/public-trunk/Transceiver52M/radioInterface.cpp b/public-trunk/Transceiver52M/radioInterface.cpp index 5a4ad20..006cda8 100644 --- a/public-trunk/Transceiver52M/radioInterface.cpp +++ b/public-trunk/Transceiver52M/radioInterface.cpp @@ -109,10 +109,10 @@ double RadioInterface::fullScaleOutputValue(void) { void RadioInterface::setPowerAttenuation(double atten) { - double rfAtten, digAtten; + double rfGain, digAtten; - rfAtten = mRadio->setTxGain(mRadio->maxTxGain() - atten); - digAtten = atten - rfAtten; + rfGain = mRadio->setTxGain(mRadio->maxTxGain() - atten); + digAtten = atten - mRadio->maxTxGain() + rfGain; if (digAtten < 1.0) powerScaling = 1.0;