1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-11-20 17:14:55 +00:00

Make the carrier smoothing parameter an integer

This commit is contained in:
Carles Fernandez
2020-02-11 19:34:21 +01:00
parent dfc02b2e5c
commit 207b01a6c0
5 changed files with 21 additions and 10 deletions

View File

@@ -19,7 +19,6 @@
#include "gnss_sdr_flags.h"
#include <cstdint>
#include <iostream>
#include <string>
@@ -71,7 +70,7 @@ DEFINE_double(dll_bw_hz, 0.0, "If defined, bandwidth of the DLL low pass filter,
DEFINE_double(pll_bw_hz, 0.0, "If defined, bandwidth of the PLL low pass filter, in Hz (overrides the configuration file).");
DEFINE_double(carrier_smoothing_factor, DEFAULT_CARRIER_SMOOTHING_FACTOR, "Sets carrier smoothing factor M");
DEFINE_int32(carrier_smoothing_factor, DEFAULT_CARRIER_SMOOTHING_FACTOR, "Sets carrier smoothing factor M (overrides the configuration file)");
#if GFLAGS_GREATER_2_0
@@ -215,6 +214,19 @@ static bool ValidatePllBw(const char* flagname, double value)
return false;
}
static bool ValidateCarrierSmoothingFactor(const char* flagname, int32_t value)
{
const int32_t min_value = 1;
if (value >= min_value)
{ // value is ok
return true;
}
std::cout << "Invalid value for flag -" << flagname << ": " << value << ". Allowed range is 1 <= " << flagname << "." << std::endl;
std::cout << "GNSS-SDR program ended." << std::endl;
return false;
}
DEFINE_validator(c, &ValidateC);
DEFINE_validator(config_file, &ValidateConfigFile);
DEFINE_validator(s, &ValidateS);
@@ -227,6 +239,6 @@ DEFINE_validator(max_lock_fail, &ValidateMaxLockFail);
DEFINE_validator(carrier_lock_th, &ValidateCarrierLockTh);
DEFINE_validator(dll_bw_hz, &ValidateDllBw);
DEFINE_validator(pll_bw_hz, &ValidatePllBw);
DEFINE_validator(carrier_smoothing_factor, &ValidateCarrierSmoothingFactor);
#endif

View File

@@ -22,6 +22,7 @@
#include <gflags/gflags.h>
#include <cstdint>
DECLARE_string(c); //!< Path to the configuration file.
DECLARE_string(config_file); //!< Path to the configuration file.
@@ -47,8 +48,8 @@ DECLARE_double(dll_bw_hz); //!< Bandwidth of the DLL low pass filter
DECLARE_double(pll_bw_hz); //!< Bandwidth of the PLL low pass filter, in Hz (overrides the configuration file).
// Declare flags for observables block
DECLARE_double(carrier_smoothing_factor); //!< Sets carrier smoothing factor M (overrides the configuration file).
const double DEFAULT_CARRIER_SMOOTHING_FACTOR = 200.0;
DECLARE_int32(carrier_smoothing_factor); //!< Sets carrier smoothing factor M (overrides the configuration file).
const int32_t DEFAULT_CARRIER_SMOOTHING_FACTOR = 200;
// Declare flags for PVT
DECLARE_string(RINEX_version); //!< If defined, specifies the RINEX version (2.11 or 3.02). Overrides the configuration file.