diff --git a/src/boards/Parafoil/Configs/SensorsConfig.h b/src/boards/Parafoil/Configs/SensorsConfig.h index 6806eda589bae85e5ae4d8c0d54a3b0d1cdee63e..3cd7c0277f0c5877d965d8f8751a7392728d62ec 100644 --- a/src/boards/Parafoil/Configs/SensorsConfig.h +++ b/src/boards/Parafoil/Configs/SensorsConfig.h @@ -75,8 +75,10 @@ constexpr Boardcore::LPS22DF::ODR LPS22DF_ODR = Boardcore::LPS22DF::ODR_100; constexpr uint32_t LPS22DF_PERIOD = 20; // [ms] 50Hz // UBXGPS -constexpr uint8_t UBXGPS_SAMPLE_RATE = 10; -constexpr uint32_t UBXGPS_PERIOD = 1000 / UBXGPS_SAMPLE_RATE; // [ms] +constexpr uint8_t UBXGPS_SAMPLE_RATE = 5; +// The +5 is needed because GPS data must be read faster than it is produced (to +// not cause delays) +constexpr uint32_t UBXGPS_PERIOD = 1000 / (UBXGPS_SAMPLE_RATE + 5); // [ms] // ADS constexpr Boardcore::ADS131M08Defs::OversamplingRatio @@ -84,7 +86,6 @@ constexpr Boardcore::ADS131M08Defs::OversamplingRatio Boardcore::ADS131M08Defs::OversamplingRatio::OSR_8192; constexpr bool ADS131M08_GLOBAL_CHOP_MODE = true; constexpr uint32_t ADS131M08_PERIOD = 10; // [ms] 100Hz -// // UNUSED - How many bytes go into the fifo each second constexpr unsigned int BMX160_FIFO_FILL_RATE = @@ -109,7 +110,7 @@ constexpr Boardcore::LIS3MDL::FullScale MAG_LIS_FULLSCALE = constexpr Boardcore::InternalADC::Channel ADC_BATTERY_VOLTAGE = Boardcore::InternalADC::Channel::CH5; // Internal ADC voltage divider -constexpr float BATTERY_VOLTAGE_COEFF = (150+40.2)/40.2; +constexpr float BATTERY_VOLTAGE_COEFF = (150 + 40.2) / 40.2; // Sampling periods [ms] diff --git a/src/boards/Parafoil/Sensors/Sensors.cpp b/src/boards/Parafoil/Sensors/Sensors.cpp index 9084ff87dd3410dcbf87904661e1ce8829cbe55b..60155a96c67f37d81da593d0a69556fbf914dd09 100644 --- a/src/boards/Parafoil/Sensors/Sensors.cpp +++ b/src/boards/Parafoil/Sensors/Sensors.cpp @@ -347,7 +347,7 @@ void Sensors::ubxGpsInit() // Create sensor instance with configured parameters ubxGps = new UBXGPSSpi(modules.get<Buses>()->spi1, - miosix::sensors::ubxgps::cs::getPin(), config, 5); + miosix::sensors::ubxgps::cs::getPin(), config, UBXGPS_SAMPLE_RATE); // Emplace the sensor inside the map SensorInfo info("UBXGPS", UBXGPS_PERIOD,