From 212da151a6efbee6caaff028a7bd13e1dfedfb34 Mon Sep 17 00:00:00 2001
From: Luca Erbetta <luca.erbetta105@gmail.com>
Date: Sun, 31 Mar 2019 15:33:16 +0200
Subject: [PATCH] [MPU9255] 16g FSR

---
 src/shared/Sensors/MPU9255.cpp | 4 +++-
 src/shared/Sensors/MPU9255.h   | 5 +++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/shared/Sensors/MPU9255.cpp b/src/shared/Sensors/MPU9255.cpp
index 6089e4e..71c11a0 100644
--- a/src/shared/Sensors/MPU9255.cpp
+++ b/src/shared/Sensors/MPU9255.cpp
@@ -27,11 +27,13 @@ bool MPU9255::init()
 {
     bool result = true;
     i2cInit();
+    Thread::sleep(10);
+    
     if (!i2cReadIDTest())
     {
         return false;
     }
-    axelInit(AFS_4G);  // inizializzo l'acceleromerto
+    axelInit(AFS_16G);  // inizializzo l'acceleromerto
     tempInit();
     result = result && gyroInit(GFS_2000DPS);  // inizializzo il giroscopio
     configPassThrough();  // Necessario per accedere direttamente al
diff --git a/src/shared/Sensors/MPU9255.h b/src/shared/Sensors/MPU9255.h
index d642b39..3ad3ea6 100644
--- a/src/shared/Sensors/MPU9255.h
+++ b/src/shared/Sensors/MPU9255.h
@@ -174,11 +174,12 @@ private:
     bool initialized = false;
 
     // CALIBRATION VALUES
-    const float sensor_fsr = 32767.0;
+    const float sensor_fsr = 32768.0f;
     // ACCELEROMETER
     const float axel_x_offset = 0;     // offset in g, it's to be filled by hand
     const float axel_y_offset = 0;     // offset in g, it's to be filled by hand
-    const float axel_z_offset = 0.11;  // offset in g, it's to be filled by hand
+    const float axel_z_offset = 0;     // offset in g, it's to be filled by hand
+
     // GYROSCOPE
     const float gyro_x_offset = 0;  // default offset in LSB, it will be
                                     // overwritten at every start, with the new
-- 
GitLab