Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 2119 → Rev 2122

/branches/dongfang_FC_fixedwing/analog.c
163,12 → 163,12
AD_GYRO_ROLL,
AD_GYRO_YAW,
 
AD_AIRPRESSURE,
 
AD_GYRO_PITCH,
AD_GYRO_ROLL,
AD_GYRO_YAW,
 
AD_AIRPRESSURE,
 
AD_UBAT,
 
AD_GYRO_PITCH,
175,11 → 175,11
AD_GYRO_ROLL,
AD_GYRO_YAW,
AD_AIRPRESSURE,
AD_GYRO_PITCH,
AD_GYRO_ROLL,
AD_GYRO_YAW
AD_GYRO_YAW,
 
AD_AIRPRESSURE
};
 
// Feature removed. Could be reintroduced later - but should work for all gyro types then.
405,12 → 405,12
}
 
void analog_calibrate(void) {
#define OFFSET_CYCLES 250
#define OFFSET_CYCLES 120
uint8_t i, axis;
int32_t offsets[4] = { 0, 0, 0, 0 };
gyro_calibrate();
// determine gyro bias by averaging (requires that the copter does not rotate around any axis!)
// determine gyro bias by averaging (requires that the aircraft does not rotate around any axis!)
for (i = 0; i < OFFSET_CYCLES; i++) {
delay_ms_with_adc_measurement(2, 1);
for (axis = PITCH; axis <= YAW; axis++) {
420,7 → 420,7
}
for (axis = PITCH; axis <= YAW; axis++) {
gyroOffset.offsets[axis] = (offsets[axis] /*+ OFFSET_CYCLES/2 */) / OFFSET_CYCLES;
gyroOffset.offsets[axis] = (offsets[axis] + OFFSET_CYCLES/2) / OFFSET_CYCLES;
int16_t min = (512-200) * GYRO_OVERSAMPLING;
int16_t max = (512+200) * GYRO_OVERSAMPLING;
if(gyroOffset.offsets[axis] < min || gyroOffset.offsets[axis] > max)
427,7 → 427,7
versionInfo.hardwareErrors[0] |= FC_ERROR0_GYRO_PITCH << axis;
}
 
airpressureOffset = (offsets[3] /* + OFFSET_CYCLES/2 */) / OFFSET_CYCLES;
airpressureOffset = (offsets[3] + OFFSET_CYCLES/2) / OFFSET_CYCLES;
int16_t min = 200;
int16_t max = 1024-200;
if(airpressureOffset < min || airpressureOffset > max)