Transceiver: Avoid noise calculation formula in 2 branches in pullRadioVector

Makes code easier to follow and will help in forthcoming refactoring
once idle frames are supported.

Change-Id: I56c84e9684ca460efd6c983d7e95d8e455bcac69
This commit is contained in:
Pau Espin Pedrol
2019-07-03 15:00:56 +02:00
parent b9d2515704
commit be9cd66020

View File

@@ -631,19 +631,18 @@ bool Transceiver::pullRadioVector(size_t chan, struct trx_ul_burst_ind *bi)
burst = radio_burst->getVector(max_i);
avg = sqrt(avg / radio_burst->chans());
bi->rssi = 20.0 * log10(rxFullScale / avg) + rssiOffset;
if (type == IDLE) {
/* Update noise levels */
state->mNoises.insert(avg);
state->mNoiseLev = state->mNoises.avg();
bi->noise = 20.0 * log10(rxFullScale / state->mNoiseLev) + rssiOffset;
}
bi->rssi = 20.0 * log10(rxFullScale / avg) + rssiOffset;
bi->noise = 20.0 * log10(rxFullScale / state->mNoiseLev) + rssiOffset;
if (type == IDLE) {
delete radio_burst;
return false;
} else {
/* Do not update noise levels */
bi->noise = 20.0 * log10(rxFullScale / state->mNoiseLev) + rssiOffset;
}
unsigned max_toa = (type == RACH || type == EXT_RACH) ?