aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/radioInterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Transceiver52M/radioInterface.cpp')
-rw-r--r--Transceiver52M/radioInterface.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/Transceiver52M/radioInterface.cpp b/Transceiver52M/radioInterface.cpp
index 1329ef1..d67b486 100644
--- a/Transceiver52M/radioInterface.cpp
+++ b/Transceiver52M/radioInterface.cpp
@@ -106,23 +106,27 @@ double RadioInterface::fullScaleOutputValue(void) {
return mRadio->fullScaleOutputValue();
}
-
-void RadioInterface::setPowerAttenuation(double atten, size_t chan)
+int RadioInterface::setPowerAttenuation(int atten, size_t chan)
{
double rfGain, digAtten;
if (chan >= mChans) {
LOG(ALERT) << "Invalid channel requested";
- return;
+ return -1;
}
- rfGain = mRadio->setTxGain(mRadio->maxTxGain() - atten, chan);
- digAtten = atten - mRadio->maxTxGain() + rfGain;
+ if (atten < 0.0)
+ atten = 0.0;
+
+ rfGain = mRadio->setTxGain(mRadio->maxTxGain() - (double) atten, chan);
+ digAtten = (double) atten - mRadio->maxTxGain() + rfGain;
if (digAtten < 1.0)
powerScaling[chan] = 1.0;
else
powerScaling[chan] = 1.0 / sqrt(pow(10, digAtten / 10.0));
+
+ return atten;
}
int RadioInterface::radioifyVector(signalVector &wVector,