-
Notifications
You must be signed in to change notification settings - Fork 86
Description
I believe the code activating too much Data_ready an Motion Event (but the more can do the leas).
I explain :
// Now we know androidSensor is valid, reconstruct the value for DATA_OUT_CTL1 from _enabled_Android_0 and _enabled_Android_0
delta = 0; // Clear delta
for (int i = 0; i < 32; i++)
{
androidSensorAsBitMask = 1L << i;
if ((pdev->_enabled_Android_0 & androidSensorAsBitMask) > 0) // Check if the Android sensor (0-31) is enabled
{
delta |= inv_androidSensor_to_control_bits[i]; // If it is, or the required bits into delta
}
if ((pdev->_enabled_Android_1 & androidSensorAsBitMask) > 0) // Check if the Android sensor (32-) is enabled
{
delta |= inv_androidSensor_to_control_bits[i + 32]; // If it is, or the required bits into delta
}
// Also check which bits need to be set in the Data Ready Status and Motion Event Control registers
// Compare to INV_NEEDS_ACCEL_MASK, INV_NEEDS_GYRO_MASK and INV_NEEDS_COMPASS_MASKif (((androidSensorAsBitMask & INV_NEEDS_ACCEL_MASK) > 0) || ((androidSensorAsBitMask & INV_NEEDS_ACCEL_MASK1) > 0))
{
data_rdy_status |= DMP_Data_ready_Accel;
inv_event_control |= DMP_Motion_Event_Control_Accel_Calibr;
}
for i = 0 to 32 will check all the time every bits for INV_NEEDS_ACCEL_MASK (not null) so data will always be activated.
I believe the correct test should be
if (((pdev->_enabled_Android_0 & androidSensorAsBitMask & INV_NEEDS_ACCEL_MASK) > 0) || ((pdev->_enabled_Android_1 & androidSensorAsBitMask & INV_NEEDS_ACCEL_MASK1) > 0))