by **dpackham** » Sun Jul 03, 2011 4:47 am

652,656c621,622

< accADC[PITCH] = - (((rawADC_BMA180[1]<<8) | (rawADC_BMA180[0]))>>2)/10; // AeroQuad Orientation

< accADC[ROLL] = + (((rawADC_BMA180[3]<<8) | (rawADC_BMA180[2]))>>2)/10; // AeroQuad Orientation

---

> accADC[ROLL] = - (((rawADC_BMA180[1]<<8) | (rawADC_BMA180[0]))>>2)/10; // opie settings: + ; FFIMU: -

> accADC[PITCH] = - (((rawADC_BMA180[3]<<8) | (rawADC_BMA180[2]))>>2)/10;

729c695

< i2c_rep_start(0XD2+0); // I2C write direction

---

> i2c_rep_start(0XD0+0); // I2C write direction

742c708

< i2c_rep_start(0XD2); // I2C write direction

---

> i2c_rep_start(0XD0); // I2C write direction

744c710

< i2c_rep_start(0XD2 +1); // I2C read direction => 1

---

> i2c_rep_start(0XD0 +1); // I2C read direction => 1

749,753c715,716

< gyroADC[ROLL] = + ((rawADC_ITG3200[0]<<8) | rawADC_ITG3200[1]); // AeroQuad Orientation

< gyroADC[PITCH] = + ((rawADC_ITG3200[2]<<8) | rawADC_ITG3200[3]); // AeroQuad Orientation

---

> gyroADC[ROLL] = + ((rawADC_ITG3200[2]<<8) | rawADC_ITG3200[3]);

> gyroADC[PITCH] = - ((rawADC_ITG3200[0]<<8) | rawADC_ITG3200[1]);

786,792c749,751

< magADC[XAXIS] = ((rawADC_HMC5843[0]<<8) | rawADC_HMC5843[1]);

< magADC[YAXIS] = - ((rawADC_HMC5843[2]<<8) | rawADC_HMC5843[3]);

< magADC[ZAXIS] = - ((rawADC_HMC5843[4]<<8) | rawADC_HMC5843[5]);

---

> magADC[ROLL] = ((rawADC_HMC5843[0]<<8) | rawADC_HMC5843[1]);

> magADC[PITCH] = ((rawADC_HMC5843[2]<<8) | rawADC_HMC5843[3]);

> magADC[YAW] = - ((rawADC_HMC5843[4]<<8) | rawADC_HMC5843[5]);

1095,1097c1054,1055

< for (axis=0;axis<3;axis++) accSmooth[axis] =(accSmooth[axis]*7+accADC[axis])/8;

---

> for (axis=0;axis<3;axis++) accSmooth[axis] =(accSmooth[axis]*7+accADC[axis]+4)/8;

>

1128,1134c1086,1088

< mag[XAXIS] = magADC[XAXIS]*cos_[PITCH]+magADC[YAXIS]*A[ROLL]*A[PITCH]+magADC[ZAXIS]*cos_[ROLL]*A[PITCH];

< mag[YAXIS] = magADC[YAXIS]*cos_[ROLL]-magADC[ZAXIS]*A[ROLL];

< heading = degrees(atan2(-mag[YAXIS],mag[XAXIS]));

---

> mag[PITCH] = -magADC[PITCH]*cos_[PITCH]+magADC[ROLL]*A[ROLL]*A[PITCH]+magADC[YAW]*cos_[ROLL]*A[PITCH];

> mag[ROLL] = magADC[ROLL]*cos_[ROLL]-magADC[YAW]*A[ROLL];

> heading = degrees(atan2(mag[PITCH],mag[ROLL]));

Last edited by

dpackham on Sun Jul 03, 2011 5:29 am, edited 1 time in total.