From ad9f2a4f954f7d868fe48ae700fb9242469a61df Mon Sep 17 00:00:00 2001 From: "Ben V. Brown" Date: Mon, 4 Jan 2021 21:02:24 +1100 Subject: [PATCH] Link MSA301 into normal MOV handler --- .../TS100/Core/BSP/Miniware/Model_Config.h | 1 + workspace/TS100/Core/Threads/MOVThread.cpp | 30 +++++++++++-------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/workspace/TS100/Core/BSP/Miniware/Model_Config.h b/workspace/TS100/Core/BSP/Miniware/Model_Config.h index f7beb79e..664208ad 100644 --- a/workspace/TS100/Core/BSP/Miniware/Model_Config.h +++ b/workspace/TS100/Core/BSP/Miniware/Model_Config.h @@ -36,6 +36,7 @@ #ifdef MODEL_TS80P #define ACCEL_LIS +#define ACCEL_MSA #define POW_PD #define POW_QC #define TEMP_NTC diff --git a/workspace/TS100/Core/Threads/MOVThread.cpp b/workspace/TS100/Core/Threads/MOVThread.cpp index 84ff386e..2705e72d 100755 --- a/workspace/TS100/Core/Threads/MOVThread.cpp +++ b/workspace/TS100/Core/Threads/MOVThread.cpp @@ -10,6 +10,7 @@ #include "I2C_Wrapper.hpp" #include "LIS2DH12.hpp" #include "MMA8652FC.hpp" +#include "MSA301.h" #include "QC3.h" #include "Settings.h" #include "TipThermoModel.h" @@ -24,36 +25,41 @@ uint8_t accelInit = 0; TickType_t lastMovementTime = 0; void detectAccelerometerVersion() { + PCBVersion = 99; #ifdef ACCEL_MMA if (MMA8652FC::detect()) { - PCBVersion = 1; - if (!MMA8652FC::initalize()) { - PCBVersion = 99; + + if (MMA8652FC::initalize()) { + PCBVersion = 1; } } else #endif #ifdef ACCEL_LIS if (LIS2DH12::detect()) { - PCBVersion = 2; // Setup the ST Accelerometer - if (!LIS2DH12::initalize()) { - PCBVersion = 99; + if (LIS2DH12::initalize()) { + PCBVersion = 2; } } else #endif #ifdef ACCEL_BMA if (BMA223::detect()) { - PCBVersion = 3; // Setup the ST Accelerometer - if (!BMA223::initalize()) { - PCBVersion = 99; + if (BMA223::initalize()) { + PCBVersion = 3; + } + } else +#endif +#ifdef ACCEL_MSA + if (MSA301::detect()) { + // Setup the MSA301 Accelerometer + if (MSA301::initalize()) { + PCBVersion = 4; } } else #endif { - PCBVersion = 99; - systemSettings.SleepTime = 0; - systemSettings.ShutdownTime = 0; // No accel -> disable sleep + //disable imu sensitivity systemSettings.sensitivity = 0; }