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 <ttsou@vt.edu>
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@2649 19bc5d8c-e614-43d4-8b26-e1612bc8e597
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 @@
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);