From a0d1b00adeb22261da867b04dce452470d79a20b Mon Sep 17 00:00:00 2001 From: James Cotton Date: Fri, 13 Apr 2012 19:37:30 -0500 Subject: [PATCH 1/2] Cover an edge condition for the MPU6000 IRQ not firing --- flight/Modules/Sensors/sensors.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flight/Modules/Sensors/sensors.c b/flight/Modules/Sensors/sensors.c index 929cab662..cdd332da9 100644 --- a/flight/Modules/Sensors/sensors.c +++ b/flight/Modules/Sensors/sensors.c @@ -317,6 +317,11 @@ static void SensorsTask(void *parameters) gyro_samples ++; accel_samples ++; } + + if (gyro_samples == 0) { + error = true; + continue; + } gyro_scaling = PIOS_MPU6000_GetScale(); accel_scaling = PIOS_MPU6000_GetAccelScale(); From b0ef456ccb6cbd39ddba80b95822e834895b9d49 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Fri, 13 Apr 2012 20:29:41 -0500 Subject: [PATCH 2/2] Kickstart MPU6000 if there is no data --- flight/Modules/Sensors/sensors.c | 1 + 1 file changed, 1 insertion(+) diff --git a/flight/Modules/Sensors/sensors.c b/flight/Modules/Sensors/sensors.c index cdd332da9..2e097d0c6 100644 --- a/flight/Modules/Sensors/sensors.c +++ b/flight/Modules/Sensors/sensors.c @@ -319,6 +319,7 @@ static void SensorsTask(void *parameters) } if (gyro_samples == 0) { + PIOS_MPU6000_ReadGyros(&mpu6000_data); error = true; continue; }