From fac5dd83ada71ee77055d329fc902350e45f17c7 Mon Sep 17 00:00:00 2001
From: Federico Mandelli <federico.mandelli@skywarder.eu>
Date: Mon, 29 Jul 2024 11:31:44 +0200
Subject: [PATCH] [Sensors] Fixed magnetometer wrong sampling rate

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

diff --git a/src/boards/Parafoil/Configs/SensorsConfig.h b/src/boards/Parafoil/Configs/SensorsConfig.h
index 105e3aef6..43599a6d2 100644
--- a/src/boards/Parafoil/Configs/SensorsConfig.h
+++ b/src/boards/Parafoil/Configs/SensorsConfig.h
@@ -48,7 +48,7 @@ constexpr Boardcore::BMX160Config::OutputDataRate BMX160_ACC_GYRO_ODR_ENUM =
     Boardcore::BMX160Config::OutputDataRate::HZ_200;
 constexpr unsigned int BMX160_MAG_ODR = 100;
 constexpr Boardcore::BMX160Config::OutputDataRate BMX160_MAG_ODR_ENUM =
-    Boardcore::BMX160Config::OutputDataRate::HZ_200;
+    Boardcore::BMX160Config::OutputDataRate::HZ_100;
 
 constexpr unsigned int BMX160_TEMP_DIVIDER = 1000;
 
diff --git a/src/boards/Parafoil/Sensors/Sensors.cpp b/src/boards/Parafoil/Sensors/Sensors.cpp
index a9d3e9b7c..ca8ac9555 100644
--- a/src/boards/Parafoil/Sensors/Sensors.cpp
+++ b/src/boards/Parafoil/Sensors/Sensors.cpp
@@ -123,9 +123,7 @@ Sensors::Sensors(TaskScheduler* sched) : scheduler(sched), sensorsCounter(0) {}
 bool Sensors::start()
 {
     // Read the magnetometer calibration from predefined file
-    miosix::GpioPin cs(GPIOG_BASE, 7);
-    cs.mode(miosix::Mode::OUTPUT);
-    cs.high();
+
     // Init all the sensors
     bmx160Init();
     bmx160WithCorrectionInit();
@@ -133,7 +131,7 @@ bool Sensors::start()
     h3lisInit();
     lps22Init();
     ubxGpsInit();
-    ads131Init();
+    // ads131Init();
     internalADCInit();
     batteryVoltageInit();
 
-- 
GitLab