TauLabs/TauLabs — pull request #751 by peabody124 (2013-07-18 16:36:27+00:00)
Title: Sparky MPU9150 initialization fix

Some of the time when powering Sparky with a battery it would not start running reliably and the sensors would go to an error state. This didn't cause any crashes since this blocked arming and a power cycle would restore normal functionality.

I managed to track this down to the IRQ line not toggling (and the check for that being insufficient). This fixes the check and adds a specific panic code (1 flash) when the IRQ line is not pulsing so we don't even get to the point of thinking it should work.

In addition the initialization code uses a robust method to set the register values which attempts up to 10 times.

With this code I have not been able to reproduce the original problem. However, it's still possible it is a subtle race condition since I couldn't confirm it was a register failing to write either.

Also this slips in adding adjustable filter rates for the MPU9150 on Sparky which is useful for brushless gimbal control.