From 336c8a495e792088d4d1d94bdf894877a8eb2bdc Mon Sep 17 00:00:00 2001
From: Federico Mandelli <federico.mandelli@skywarder.eu>
Date: Sun, 30 Jun 2024 12:35:21 +0200
Subject: [PATCH] [SensorConfig] Update BMX160_WITH_CORRECTION_SAMPLE_PERIOD to
 10ms

---
 src/boards/Parafoil/Configs/SensorsConfig.h | 4 ++--
 src/boards/Parafoil/Sensors/Sensors.cpp     | 3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/boards/Parafoil/Configs/SensorsConfig.h b/src/boards/Parafoil/Configs/SensorsConfig.h
index 88d628e9e..fbc26d236 100644
--- a/src/boards/Parafoil/Configs/SensorsConfig.h
+++ b/src/boards/Parafoil/Configs/SensorsConfig.h
@@ -120,8 +120,8 @@ constexpr float BATTERY_VOLTAGE_COEFF = (150 + 40.2) / 40.2;
 constexpr unsigned int BMX160_SAMPLE_PERIOD =
     BMX160_FIFO_FILL_TIME * (BMX160_FIFO_WATERMARK + 30) * 4 / 1024;  // [ms]
 // BMX160_WITH_CORRECTION_SAMPLE_PERIOD should be lower than the
-// BMX160_SAMPLE_PERIOD and faster then the NAS
-constexpr unsigned int BMX160_WITH_CORRECTION_SAMPLE_PERIOD = 100;  // [ms]
+// BMX160_SAMPLE_PERIOD and faster then the NAS update period.
+constexpr unsigned int BMX160_WITH_CORRECTION_SAMPLE_PERIOD = 10;  // [ms] 100Hz
 
 constexpr unsigned int LIS3MDL_SAMPLE_PERIOD       = 15;
 constexpr unsigned int INTERNAL_ADC_SAMPLE_PERIOD  = 1000;  // [ms]
diff --git a/src/boards/Parafoil/Sensors/Sensors.cpp b/src/boards/Parafoil/Sensors/Sensors.cpp
index 761cd429b..a6a3b393b 100644
--- a/src/boards/Parafoil/Sensors/Sensors.cpp
+++ b/src/boards/Parafoil/Sensors/Sensors.cpp
@@ -244,8 +244,7 @@ void Sensors::bmx160WithCorrectionInit()
     bmx160WithCorrection =
         new BMX160WithCorrection(bmx160, BMX160_AXIS_ROTATION);
 
-    SensorInfo info("BMX160WithCorrection",
-                    BMX160_WITH_CORRECTION_SAMPLE_PERIOD,
+    SensorInfo info("BMX160WithCorrection", BMX160_SAMPLE_PERIOD,
                     bind(&Sensors::bmx160WithCorrectionCallback, this));
 
     sensorMap.emplace(make_pair(bmx160WithCorrection, info));
-- 
GitLab