Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1965 → Rev 1967

/branches/dongfang_FC_rewrite/analog.c
105,7 → 105,7
 
volatile sensorOffset_t gyroOffset;
volatile sensorOffset_t accOffset;
volatile sensorOffset_t DACValues;
volatile sensorOffset_t gyroAmplifierOffset;
 
/*
* This allows some experimentation with the gyro filters.
281,6 → 281,7
for (uint8_t axis=0; axis<2; axis++) {
tempGyro = rawGyroSum[axis] = sensorInputs[AD_GYRO_PITCH-axis];
/*
* Process the gyro data for the PID controller.
*/
342,9 → 343,9
else
yawGyro = sensorInputs[AD_GYRO_YAW] - gyroOffset.offsets[YAW];
 
debugOut.analog[3] = gyro_ATT[PITCH];
debugOut.analog[4] = gyro_ATT[ROLL];
debugOut.analog[5] = yawGyro;
debugOut.analog[3] = rawGyroSum[0];
debugOut.analog[4] = rawGyroSum[1];
debugOut.analog[5] = rawGyroSum[2];
}
 
void analog_updateAccelerometers(void) {
471,6 → 472,11
}
 
void analog_setNeutral() {
if (gyroAmplifierOffset_readFromEEProm()) {
printf("gyro amp invalid, you must recalibrate.");
gyro_loadOffsets(1);
}
 
if (gyroOffset_readFromEEProm()) {
printf("gyro offsets invalid, you must recalibrate.");
gyroOffset.offsets[PITCH] = gyroOffset.offsets[ROLL] = 512 * GYRO_SUMMATION_FACTOR_PITCHROLL;
492,7 → 498,7
// Setting offset values has an influence in the analog.c ISR
// Therefore run measurement for 100ms to achive stable readings
delay_ms_Mess(100);
delay_ms_with_adc_measurement(100);
 
// Rough estimate. Hmm no nothing happens at calibration anyway.
// airPressureSum = simpleAirPressure * (AIRPRESSURE_SUMMATION_FACTOR/2);
507,7 → 513,7
// determine gyro bias by averaging (requires that the copter does not rotate around any axis!)
for (i = 0; i < GYRO_OFFSET_CYCLES; i++) {
delay_ms_Mess(20);
delay_ms_with_adc_measurement(20);
for (axis = PITCH; axis <= YAW; axis++) {
offsets[axis] += rawGyroSum[axis];
}
534,7 → 540,7
int16_t filteredDelta;
for (i = 0; i < ACC_OFFSET_CYCLES; i++) {
delay_ms_Mess(10);
delay_ms_with_adc_measurement(10);
for (axis = PITCH; axis <= YAW; axis++) {
deltaOffset[axis] += acc[axis];
}