From d1ae0cd2b979683cf0b1d061d4298be2cb297a01 Mon Sep 17 00:00:00 2001 From: "kurtis.heimerl" Date: Sat, 26 Nov 2011 03:17:35 +0000 Subject: uhd: set attenuation relative to max RF gain Previously this was referenced off the the ad9862 PGA with a range from 0 to -20 dB. Instead base the attenuation factor on the maximum total RF gain returned by the device. Signed-off-by: Thomas Tsou git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2649 19bc5d8c-e614-43d4-8b26-e1612bc8e597 --- Transceiver52M/radioInterface.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Transceiver52M/radioInterface.cpp') diff --git a/Transceiver52M/radioInterface.cpp b/Transceiver52M/radioInterface.cpp index 8fd2ec3..e8eea6f 100644 --- a/Transceiver52M/radioInterface.cpp +++ b/Transceiver52M/radioInterface.cpp @@ -103,10 +103,9 @@ double RadioInterface::fullScaleOutputValue(void) { void RadioInterface::setPowerAttenuation(double dBAtten) { - float HWdBAtten = mRadio->setTxGain(-dBAtten); - dBAtten -= (-HWdBAtten); - float linearAtten = powf(10.0F,0.1F*dBAtten); - if (linearAtten < 1.0) + double HWatten = mRadio->setTxGain(mRadio->maxTxGain() - atten); + atten -= (-HWatten); + if (atten < 1.0) powerScaling = 1.0; else powerScaling = 1.0/sqrt(linearAtten); -- cgit v1.2.3