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
This commit is contained in:
kurtis.heimerl 2011-11-26 03:17:35 +00:00
parent 41f708b9a0
commit d1ae0cd2b9
1 changed files with 3 additions and 4 deletions

View File

@ -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);