mpu6050 usermod: allow to disable usermod
* added usermod config information (so it can be disabled) * check that "INTERRUPT_PIN" does support interrupts (MM specific) * expose "dmpReady" in public interface * adjusted games usermod to switch to "simulation" in case mpu6050 is not active Still toDo: 1. add interrupt PIN and errormessages to settings page. 2. de-alloc intPin when disabled (and disable interrupt) 3. usermod is still destroying DEBUG_PRINT macros. 4. temporarily disable MPU interrupt when onUpdateBegin(true)
This commit is contained in:
@@ -183,7 +183,7 @@ uint16_t mode_IMUTest(void) {
|
||||
|
||||
uint8_t y = 0;
|
||||
|
||||
if (IMU != nullptr) {
|
||||
if ((IMU != nullptr) && (IMU->dmpReady)) {
|
||||
SEGMENT.setPixelColorXY(SEGMENT.virtualWidth() * (IMU->aa.x+INT16_MAX)/(2*INT16_MAX), y+=1, BLUE);
|
||||
SEGMENT.setPixelColorXY(SEGMENT.virtualWidth() * (IMU->aa.y+INT16_MAX)/(2*INT16_MAX), y+=1, BLUE);
|
||||
SEGMENT.setPixelColorXY(SEGMENT.virtualWidth() * (IMU->aa.z+INT16_MAX)/(2*INT16_MAX), y+=1, BLUE);
|
||||
@@ -280,7 +280,7 @@ uint16_t mode_3DIMUCube(void) {
|
||||
float roll = 0;
|
||||
|
||||
#ifdef USERMOD_MPU6050_IMU
|
||||
if (IMU != nullptr) {
|
||||
if ((IMU != nullptr) && (IMU->dmpReady)) {
|
||||
yaw = -IMU->ypr[0];
|
||||
pitch = IMU->ypr[1];
|
||||
roll = IMU->ypr[2];
|
||||
|
||||
Reference in New Issue
Block a user