mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-10-12 02:31:51 +00:00
Prevent invalid C/N0 smoother initialization
This commit is contained in:
@@ -63,7 +63,6 @@ void Exponential_Smoother::reset()
|
||||
{
|
||||
initializing_ = true;
|
||||
init_counter_ = 0;
|
||||
init_attempts_ = 0;
|
||||
init_buffer_.clear();
|
||||
}
|
||||
|
||||
@@ -93,10 +92,9 @@ float Exponential_Smoother::smooth(float raw)
|
||||
if (init_counter_ >= samples_for_initialization_)
|
||||
{
|
||||
old_value_ = std::accumulate(std::begin(init_buffer_), std::end(init_buffer_), 0.0F) / static_cast<float>(init_buffer_.size());
|
||||
if (old_value_ < (min_value_ + offset_) && init_attempts_ < max_init_attempts_)
|
||||
if (old_value_ < (min_value_ + offset_))
|
||||
{
|
||||
// flush buffer and start again
|
||||
init_attempts_++;
|
||||
init_counter_ = 0;
|
||||
init_buffer_.clear();
|
||||
}
|
||||
|
||||
@@ -35,12 +35,6 @@
|
||||
*
|
||||
* The length of the initialization can be controlled with
|
||||
* set_samples_for_initialization(int num_samples)
|
||||
*
|
||||
* If the average of an initialization window falls below
|
||||
* min_value + offset, the window is discarded and initialization
|
||||
* starts again, up to a maximum number of attempts; after that, the
|
||||
* smoother engages with the last window average so that weak but valid
|
||||
* signals still get smoothed.
|
||||
*/
|
||||
class Exponential_Smoother
|
||||
{
|
||||
@@ -68,8 +62,6 @@ private:
|
||||
float offset_{12.0};
|
||||
int samples_for_initialization_{200};
|
||||
int init_counter_{0};
|
||||
int init_attempts_{0};
|
||||
int max_init_attempts_{3};
|
||||
bool initializing_{true};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user