Hoernchen has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-trx/+/30411 )
Change subject: rename noisevector class -> avgvector ...................................................................... rename noisevector class -> avgvector The vectors feature is averaging, and not adding noise. Change-Id: I05def8ab9ea7a2cece8db09c36c303e13ef40927 --- M Transceiver52M/Transceiver.h M Transceiver52M/radioVector.cpp M Transceiver52M/radioVector.h 3 files changed, 9 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/11/30411/1 diff --git a/Transceiver52M/Transceiver.h b/Transceiver52M/Transceiver.h index 45a4159..0389e60 100644 --- a/Transceiver52M/Transceiver.h +++ b/Transceiver52M/Transceiver.h @@ -80,7 +80,7 @@ /* Received noise energy levels */ float mNoiseLev; - noiseVector mNoises; + avgVector mNoises; /* Shadowed downlink attenuation */ int mPower; diff --git a/Transceiver52M/radioVector.cpp b/Transceiver52M/radioVector.cpp index 68e42c5..acefc97 100644 --- a/Transceiver52M/radioVector.cpp +++ b/Transceiver52M/radioVector.cpp @@ -76,22 +76,25 @@ return true; } -noiseVector::noiseVector(size_t size) +avgVector::avgVector(size_t size) : std::vector<float>(size), itr(0) { } -float noiseVector::avg() const +float avgVector::avg() const { float val = 0.0; + if (!size()) + return 0.0f; + for (size_t i = 0; i < size(); i++) val += (*this)[i]; return val / (float) size(); } -bool noiseVector::insert(float val) +bool avgVector::insert(float val) { if (!size()) return false; diff --git a/Transceiver52M/radioVector.h b/Transceiver52M/radioVector.h index 84e3987..90db626 100644 --- a/Transceiver52M/radioVector.h +++ b/Transceiver52M/radioVector.h @@ -48,9 +48,9 @@ GSM::Time mTime; }; -class noiseVector : std::vector<float> { +class avgVector : std::vector<float> { public: - noiseVector(size_t size = 0); + avgVector(size_t size = 0); bool insert(float val); float avg() const; -- To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/30411 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Change-Id: I05def8ab9ea7a2cece8db09c36c303e13ef40927 Gerrit-Change-Number: 30411 Gerrit-PatchSet: 1 Gerrit-Owner: Hoernchen <ew...@sysmocom.de> Gerrit-MessageType: newchange