{UHD,LMS}Dervice: Log expected resulting TxPower when setting device specific TxGain

Change-Id: I3c54c61cd6dd7e40bb2831fd4962ff72130b390d
This commit is contained in:
Pau Espin 2020-06-19 19:29:59 +02:00
parent 5bd3d4263b
commit 58d80a014e
2 changed files with 11 additions and 7 deletions

View File

@ -563,7 +563,7 @@ double LMSDevice::setRxGain(double dB, size_t chan)
double LMSDevice::setPowerAttenuation(int atten, size_t chan)
{
double dB;
double tx_power, dB;
dev_band_desc desc;
if (chan >= tx_gains.size()) {
@ -572,12 +572,13 @@ double LMSDevice::setPowerAttenuation(int atten, size_t chan)
}
get_dev_band_desc(desc);
dB = TxPower2TxGain(desc, desc.nom_out_tx_power - atten);
tx_power = desc.nom_out_tx_power - atten;
dB = TxPower2TxGain(desc, tx_power);
LOGCHAN(chan, DDEV, NOTICE) << "Setting TX gain to " << dB << " dB";
LOGCHAN(chan, DDEV, NOTICE) << "Setting TX gain to " << dB << " dB (~" << tx_power << " dBm)";
if (LMS_SetGaindB(m_lms_dev, LMS_CH_TX, chan, dB) < 0)
LOGCHAN(chan, DDEV, ERR) << "Error setting TX gain to " << dB << " dB";
LOGCHAN(chan, DDEV, ERR) << "Error setting TX gain to " << dB << " dB (~" << tx_power << " dBm)";
else
tx_gains[chan] = dB;
return desc.nom_out_tx_power - TxGain2TxPower(desc, tx_gains[chan]);

View File

@ -358,7 +358,7 @@ double uhd_device::getRxGain(size_t chan)
}
double uhd_device::setPowerAttenuation(int atten, size_t chan) {
double db;
double tx_power, db;
dev_band_desc desc;
if (chan >= tx_gains.size()) {
@ -367,7 +367,8 @@ double uhd_device::setPowerAttenuation(int atten, size_t chan) {
}
get_dev_band_desc(desc);
db = TxPower2TxGain(desc, desc.nom_out_tx_power - atten);
tx_power = desc.nom_out_tx_power - atten;
db = TxPower2TxGain(desc, tx_power);
if (dev_type == UMTRX) {
std::vector<std::string> gain_stages = usrp_dev->get_tx_gain_names(0);
@ -388,7 +389,9 @@ double uhd_device::setPowerAttenuation(int atten, size_t chan) {
tx_gains[chan] = usrp_dev->get_tx_gain(chan);
LOGC(DDEV, INFO) << "Set TX gain to " << tx_gains[chan] << "dB (asked for " << db << "dB)";
LOGC(DDEV, INFO) << "Set TX gain to " << tx_gains[chan] << "dB, ~"
<< TxGain2TxPower(desc, tx_gains[chan]) << " dBm "
<< "(asked for " << db << " dB, ~" << tx_power << " dBm)";
return desc.nom_out_tx_power - TxGain2TxPower(desc, tx_gains[chan]);
}