Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 2159 → Rev 2160

/branches/dongfang_FC_rewrite/analog.c
306,17 → 306,24
}
 
void measureGyroActivity(int16_t newValue) {
gyroActivity += (uint32_t)((int32_t)newValue * newValue);
gyroActivity += newValue * newValue;
// abs(newValue); // (uint32_t)((int32_t)newValue * newValue);
}
 
#define GADAMPING 6
void dampenGyroActivity(void) {
static uint8_t cnt = 0;
 
if (++cnt >= IMUConfig.gyroActivityDamping) {
cnt = 0;
gyroActivity *= (uint32_t)((1L<<GADAMPING)-1);
gyroActivity >>= GADAMPING;
}
 
/*
if (gyroActivity >= 10) gyroActivity -= 10;
else if (gyroActivity <=- 10) gyroActivity += 10;
*/
}
 
void analog_updateGyros(void) {
469,8 → 476,8
// Even if the sample is off-range, use it.
simpleAirPressure = getSimplePressure(rawAirPressure);
debugOut.analog[6] = rawAirPressure;
debugOut.analog[7] = simpleAirPressure;
// debugOut.analog[6] = rawAirPressure;
// debugOut.analog[7] = simpleAirPressure;
if (simpleAirPressure < MIN_RANGES_EXTRAPOLATION * rangewidth) {
// Danger: pressure near lower end of range. If the measurement saturates, the