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 <ttsou@vt.edu>
This commit is contained in:
parent
e64e4119ae
commit
f8838172ad
|
@ -82,10 +82,10 @@ double RadioInterface::fullScaleOutputValue(void) {
|
||||||
|
|
||||||
void RadioInterface::setPowerAttenuation(double atten)
|
void RadioInterface::setPowerAttenuation(double atten)
|
||||||
{
|
{
|
||||||
double rfAtten, digAtten;
|
double rfGain, digAtten;
|
||||||
|
|
||||||
rfAtten = usrp->setTxGain(usrp->maxTxGain() - atten);
|
rfGain = usrp->setTxGain(usrp->maxTxGain() - atten);
|
||||||
digAtten = atten - rfAtten;
|
digAtten = atten - usrp->maxTxGain() + rfGain;
|
||||||
|
|
||||||
if (digAtten < 1.0)
|
if (digAtten < 1.0)
|
||||||
powerScaling = 1.0;
|
powerScaling = 1.0;
|
||||||
|
|
|
@ -109,10 +109,10 @@ double RadioInterface::fullScaleOutputValue(void) {
|
||||||
|
|
||||||
void RadioInterface::setPowerAttenuation(double atten)
|
void RadioInterface::setPowerAttenuation(double atten)
|
||||||
{
|
{
|
||||||
double rfAtten, digAtten;
|
double rfGain, digAtten;
|
||||||
|
|
||||||
rfAtten = mRadio->setTxGain(mRadio->maxTxGain() - atten);
|
rfGain = mRadio->setTxGain(mRadio->maxTxGain() - atten);
|
||||||
digAtten = atten - rfAtten;
|
digAtten = atten - mRadio->maxTxGain() + rfGain;
|
||||||
|
|
||||||
if (digAtten < 1.0)
|
if (digAtten < 1.0)
|
||||||
powerScaling = 1.0;
|
powerScaling = 1.0;
|
||||||
|
|
Reference in New Issue