/branches/dongfang_FC_rewrite/analog.c |
---|
447,7 → 447,7 |
// Battery. The measured value is: (V * 1k/11k)/3v * 1024 = 31.03 counts per volt (max. measurable is 33v). |
// This is divided by 3 --> 10.34 counts per volt. |
UBat = (3 * UBat + sensorInputs[AD_UBAT] / 3) / 4; |
DebugOut.Analog[11] = HIRES_GYRO_INTEGRATION_FACTOR;//UBat; |
DebugOut.Analog[11] = UBat; |
analogDataReady = 1; // mark |
ADCycleCount++; |
// Stop the sampling. Cycle is over. |
493,9 → 493,8 |
} |
for (axis = PITCH; axis <= YAW; axis++) { |
gyroOffset[axis] = (deltaOffsets[axis] + GYRO_OFFSET_CYCLES / 2) |
/ GYRO_OFFSET_CYCLES; |
DebugOut.Analog[20 + axis] = gyroOffset[axis]; |
gyroOffset[axis] = (deltaOffsets[axis] + GYRO_OFFSET_CYCLES / 2) / GYRO_OFFSET_CYCLES; |
// DebugOut.Analog[20 + axis] = gyroOffset[axis]; |
} |
// Noise is relative to offset. So, reset noise measurements when changing offsets. |
/branches/dongfang_FC_rewrite/attitude.c |
---|
230,6 → 230,10 |
int16_t cosroll = int_cos(angle[ROLL]); |
int16_t sinroll = int_sin(angle[ROLL]); |
int16_t tanpitch = int_tan(angle[PITCH]); |
int16_t test; |
#define ANTIOVF 512 |
ACRate[PITCH] = ((int32_t) rate_ATT[PITCH] * cosroll - (int32_t) yawRate |
* sinroll) / (int32_t) MATH_UNIT_FACTOR; |
236,6 → 240,13 |
ACRate[ROLL] = rate_ATT[ROLL] + (((int32_t) rate_ATT[PITCH] * sinroll |
/ ANTIOVF * tanpitch + (int32_t) yawRate * int_cos(angle[ROLL]) / ANTIOVF |
* tanpitch) / ((int32_t) MATH_UNIT_FACTOR / ANTIOVF * MATH_UNIT_FACTOR)); |
test = rate_ATT[ROLL] + |
(((rate_ATT[PITCH] * sinroll + yawRate * cosroll) >> 14) * tanpitch) >> 14; |
DebugOut.Analog[20] = ACRate[ROLL]; |
DebugOut.Analog[21] = test; |
ACYawRate = ((int32_t) rate_ATT[PITCH] * sinroll) / cospitch |
+ ((int32_t) yawRate * cosroll) / cospitch; |
} |
/branches/dongfang_FC_rewrite/uart0.c |
---|
143,8 → 143,8 |
"0th O Corr roll ", |
"DriftCompDelta P", |
"DriftCompDelta R", |
"ADPitchGyroOffs ", //20 |
"ADRollGyroOffs ", |
"ACRollRate1 ", //20 |
"ACRollRate2 ", |
"M1 ", |
"M2 ", |
"M3 ", |