Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 2101 → Rev 2102

/branches/dongfang_FC_fixedwing/analog.c
7,6 → 7,7
#include "attitude.h"
#include "sensors.h"
#include "printf_P.h"
#include "isqrt.h"
 
// for Delay functions
#include "timer0.h"
44,8 → 45,8
int16_t gyroD[3];
int16_t gyroDWindow[2][GYRO_D_WINDOW_LENGTH];
uint8_t gyroDWindowIdx = 0;
int16_t dHeight;
uint32_t gyroActivity;
//int16_t dHeight;
//uint32_t gyroActivity;
 
/*
* Offset values. These are the raw gyro and acc. meter sums when the copter is
116,6 → 117,7
* Airspeed
*/
uint16_t simpleAirPressure;
uint16_t airspeedVelocity;
 
// Value of AIRPRESSURE_OVERSAMPLING samples, with range, filtered.
// int32_t filteredAirPressure;
375,12 → 377,6
gyro_ATT[PITCH] = tempOffsetGyro[PITCH];
gyro_ATT[ROLL] = tempOffsetGyro[ROLL];
 
/*
measureGyroActivity(gyroD[PITCH]);
measureGyroActivity(gyroD[ROLL]);
measureGyroActivity(yawGyro);
*/
 
if (++gyroDWindowIdx >= IMUConfig.gyroDWindowLength) {
gyroDWindowIdx = 0;
}
389,6 → 385,7
void analog_updateAirPressure(void) {
uint16_t rawAirPressure = sensorInputs[AD_AIRPRESSURE];
simpleAirPressure = rawAirPressure;
airspeedVelocity = isqrt16(simpleAirPressure);
}
 
void analog_updateBatteryVoltage(void) {
417,14 → 414,6
gyroOffset.offsets[YAW] = 512 * GYRO_OVERSAMPLING;
}
 
/*
if (accOffset_readFromEEProm()) {
printf("acc. meter offsets invalid%s",recal);
accOffset.offsets[PITCH] = accOffset.offsets[ROLL] = 512 * ACC_OVERSAMPLING_XY;
accOffset.offsets[Z] = 717 * ACC_OVERSAMPLING_Z;
}
*/
 
// Noise is relative to offset. So, reset noise measurements when changing offsets.
for (uint8_t i=PITCH; i<=YAW; i++) {
gyroNoisePeak[i] = 0;
437,7 → 426,7
// Therefore run measurement for 100ms to achive stable readings
delay_ms_with_adc_measurement(100, 0);
 
gyroActivity = 0;
// gyroActivity = 0;
}
 
void analog_calibrateGyros(void) {