aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/Transceiver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Transceiver52M/Transceiver.cpp')
-rw-r--r--Transceiver52M/Transceiver.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 33d22ad..3e2f838 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -429,7 +429,7 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, int &RSSI,
float toa, pow, max = -1.0, avg = 0.0;
int max_i = -1;
signalVector *burst;
- SoftVector *bits;
+ SoftVector *bits = NULL;
/* Blocking FIFO read */
radioVector *radio_burst = mReceiveFIFO[chan]->read();
@@ -463,9 +463,8 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, int &RSSI,
/* Average noise on diversity paths and update global levels */
burst = radio_burst->getVector(max_i);
- avg = avg / radio_burst->chans();
+ avg = sqrt(avg / radio_burst->chans());
mNoiseLev = mNoises.avg();
- avg = sqrt(avg);
/* Detect normal or RACH bursts */
if (type == TSC)
@@ -483,7 +482,9 @@ SoftVector *Transceiver::pullRadioVector(GSM::Time &wTime, int &RSSI,
if (equalize && (type != TSC))
equalize = false;
- bits = demodulate(&mStates[chan], *burst, amp, toa, time.TN(), equalize);
+ if (avg - mNoiseLev > 0.0)
+ bits = demodulate(&mStates[chan], *burst, amp, toa, time.TN(), equalize);
+
wTime = time;
RSSI = (int) floor(20.0 * log10(rxFullScale / avg));
timingOffset = (int) round(toa * 256.0 / mSPSRx);