Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 2052 → Rev 2055

/branches/dongfang_FC_rewrite/attitude.c
201,8 → 201,6
 
headingError += ACYawRate;
 
debugOut.analog[27] = heading / 100;
 
/*
* Pitch axis integration and range boundary wrap.
*/
268,7 → 266,7
*/
for (axis = PITCH; axis <= ROLL; axis++) {
accDerived = getAngleEstimateFromAcc(axis);
debugOut.analog[9 + axis] = accDerived / (GYRO_DEG_FACTOR_PITCHROLL / 10);
//debugOut.analog[9 + axis] = accDerived / (GYRO_DEG_FACTOR_PITCHROLL / 10);
// 1000 * the correction amount that will be added to the gyro angle in next line.
temp = attitude[axis];
attitude[axis] = ((int32_t) (1000L - permilleAcc) * temp
276,8 → 274,6
correctionSum[axis] += attitude[axis] - temp;
}
} else {
debugOut.analog[9] = 0;
debugOut.analog[10] = 0;
// experiment: Kill drift compensation updates when not flying smooth.
// correctionSum[PITCH] = correctionSum[ROLL] = 0;
debugOut.digital[0] |= DEBUG_ACC0THORDER;
357,7 → 353,7
int32_t error;
 
if (commands_isCalibratingCompass()) {
debugOut.analog[29] = 1;
//debugOut.analog[29] = 1;
return;
}
 
368,13 → 364,13
 
// Compass is invalid, skip.
if (magneticHeading < 0) {
debugOut.analog[29] = 2;
//debugOut.analog[29] = 2;
return;
}
 
// Spinning fast, skip
if (abs(yawRate) > 128) {
debugOut.analog[29] = 3;
//debugOut.analog[29] = 3;
return;
}
 
381,7 → 377,7
// Otherwise invalidated, skip
if (ignoreCompassTimer) {
ignoreCompassTimer--;
debugOut.analog[29] = 4;
//debugOut.analog[29] = 4;
return;
}
 
396,7 → 392,7
if(abs(error) < GYRO_DEG_FACTOR_YAW) return;
 
int32_t correction = (error * staticParams.compassYawCorrection) >> 8;
debugOut.analog[30] = correction;
//debugOut.analog[30] = correction;
 
// The correction is added both to current heading (the direction in which the copter thinks it is pointing)
// and to the target heading (the direction to which it maneuvers to point). That means, this correction has
409,7 → 405,7
// when the compass corrects the heading - it only corrects numbers!) we want to add:
// This will however cause drift to remain uncorrected!
// headingError += correction;
debugOut.analog[29] = 0;
//debugOut.analog[29] = 0;
}
#endif