Transceiver52M: Use independent noise vectors for each channel
Each ARFCN channel may be independently configureted and possibly on
separate hardware, so don't share a single vector for noise estimate
calculations. Allow a non-pointer based iterator so we can get away
with using the default copy constructor.
Signed-off-by: Thomas Tsou <tom@tsou.cc>
diff --git a/Transceiver52M/radioVector.cpp b/Transceiver52M/radioVector.cpp
index ead4481..d6fb742 100644
--- a/Transceiver52M/radioVector.cpp
+++ b/Transceiver52M/radioVector.cpp
@@ -74,10 +74,9 @@
return true;
}
-noiseVector::noiseVector(size_t n)
+noiseVector::noiseVector(size_t size)
+ : std::vector<float>(size), itr(0)
{
- this->resize(n);
- it = this->begin();
}
float noiseVector::avg()
@@ -95,10 +94,10 @@
if (!size())
return false;
- if (it == this->end())
- it = this->begin();
+ if (itr >= this->size())
+ itr = 0;
- *it++ = val;
+ (*this)[itr++] = val;
return true;
}