USRPDevice: Return previous txGain if setting value failed
Change-Id: I0d8fd51586ef01141d4e5896f0fc3029a22743f8
diff --git a/Transceiver52M/device/usrp1/USRPDevice.cpp b/Transceiver52M/device/usrp1/USRPDevice.cpp
index ef3f92a..03a4f80 100644
--- a/Transceiver52M/device/usrp1/USRPDevice.cpp
+++ b/Transceiver52M/device/usrp1/USRPDevice.cpp
@@ -71,6 +71,7 @@
decimRate = (unsigned int) round(masterClockRate/((GSMRATE) * (double) tx_sps));
actualSampleRate = masterClockRate/decimRate;
rxGain = 0;
+ txGain = 0;
/*
* Undetermined delay b/w ping response timestamp and true
@@ -279,10 +280,11 @@
if (!m_dbTx->set_gain(dB))
LOGC(DDEV, ERR) << "Error setting TX gain";
-
+ else
+ txGain = dB;
writeLock.unlock();
- return dB;
+ return txGain;
}
diff --git a/Transceiver52M/device/usrp1/USRPDevice.h b/Transceiver52M/device/usrp1/USRPDevice.h
index 4123c7d..734b361 100644
--- a/Transceiver52M/device/usrp1/USRPDevice.h
+++ b/Transceiver52M/device/usrp1/USRPDevice.h
@@ -80,6 +80,7 @@
unsigned long lastPktTimestamp;
double rxGain;
+ double txGain;
#ifdef SWLOOPBACK
short loopbackBuffer[1000000];