mirror of
https://github.com/SlimeVR/SlimeVR-Tracker-ESP.git
synced 2026-04-06 02:01:57 +02:00
Better support for different Bosch sensors, easy swap between 055/080/085 with one define, added compilation error just in case
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "BNO080.h"
|
||||
#include "sensor.h"
|
||||
#include "udpclient.h"
|
||||
#include "defines.h"
|
||||
|
||||
void BNO080Sensor::motionSetup(DeviceConfig * config)
|
||||
{
|
||||
@@ -39,7 +40,10 @@ void BNO080Sensor::motionSetup(DeviceConfig * config)
|
||||
}
|
||||
Serial.println("Connected to BNO08X");
|
||||
Wire.setClock(400000);
|
||||
imu.enableARVRStabilizedGameRotationVector(10);
|
||||
if(BNO_HASARVR_STABILIZATION)
|
||||
imu.enableARVRStabilizedGameRotationVector(10);
|
||||
else
|
||||
imu.enableGameRotationVector(10);
|
||||
}
|
||||
|
||||
void BNO080Sensor::motionLoop()
|
||||
|
||||
@@ -24,14 +24,29 @@
|
||||
#define IMU_MPU9250 1
|
||||
#define IMU_MPU6500 2
|
||||
#define IMU_BNO080 3
|
||||
#define IMU_BNO085 4
|
||||
#define IMU_BNO055 5
|
||||
|
||||
#define IMU IMU_BNO080
|
||||
#define IMU IMU_BNO085
|
||||
|
||||
#if IMU == IMU_BNO080
|
||||
#if IMU == IMU_BNO085
|
||||
#define IMU_NAME "BNO085"
|
||||
#define IMU_HAS_ACCELL true
|
||||
#define IMU_HAS_GYRO true
|
||||
#define IMU_HAS_MAG true
|
||||
#define BNO_HASARVR_STABILIZATION true
|
||||
#elif IMU == IMU_BNO080
|
||||
#define IMU_NAME "BNO080"
|
||||
#define IMU_HAS_ACCELL true
|
||||
#define IMU_HAS_GYRO true
|
||||
#define IMU_HAS_MAG true
|
||||
#define BNO_HASARVR_STABILIZATION false
|
||||
#elif IMU == IMU_BNO055
|
||||
#define IMU_NAME "BNO055"
|
||||
#define IMU_HAS_ACCELL true
|
||||
#define IMU_HAS_GYRO true
|
||||
#define IMU_HAS_MAG true
|
||||
#define BNO_HASARVR_STABILIZATION false
|
||||
#elif IMU == IMU_MPU9250
|
||||
#define IMU_NAME "MPU9250"
|
||||
#define IMU_HAS_ACCELL true
|
||||
@@ -42,6 +57,8 @@
|
||||
#define IMU_HAS_ACCELL true
|
||||
#define IMU_HAS_GYRO true
|
||||
#define IMU_HAS_MAG false
|
||||
#else
|
||||
#error Select IMU in defines.h
|
||||
#endif
|
||||
|
||||
//Debug information
|
||||
|
||||
@@ -29,12 +29,14 @@
|
||||
#include "defines.h"
|
||||
#include "credentials.h"
|
||||
|
||||
#if IMU == IMU_BNO080
|
||||
#if IMU == IMU_BNO080 || IMU == IMU_BNO085 || IMU == IMU_BNO055
|
||||
BNO080Sensor sensor{};
|
||||
#elif IMU == IMU_MPU9250
|
||||
MPU9250Sensor sensor{};
|
||||
#elif IMU == IMU_MPU6500
|
||||
MPU6050Sensor sensor{};
|
||||
#else
|
||||
#error Unsupported IMU
|
||||
#endif
|
||||
DeviceConfig config{};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user