Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1616 → Rev 1617

/branches/dongfang_FC_rewrite/analog.h
2,8 → 2,8
#define _ANALOG_H
#include <inttypes.h>
 
//#include "invenSense.h"
#include "ENC-03_FC1.3.h"
#include "invenSense.h"
// #include "ENC-03_FC1.3.h"
 
 
/*
/branches/dongfang_FC_rewrite/attitude.c
268,9 → 268,9
int16_t sinroll = int_sin(rollAngle);
int16_t tanpitch = int_tan(pitchAngle);
#define ANTIOVF 1024
ACPitchRate = ((int32_t)pitchRate * cosroll + (int32_t)yawRate * sinroll) / (int32_t)MATH_UNIT_FACTOR;
ACRollRate = rollRate + (((int32_t)pitchRate * sinroll / ANTIOVF * tanpitch - (int32_t)yawRate * int_cos(rollAngle) / ANTIOVF * tanpitch) / ((int32_t)MATH_UNIT_FACTOR / ANTIOVF * MATH_UNIT_FACTOR));
ACYawRate = (-(int32_t)pitchRate * sinroll) / cospitch + ((int32_t)yawRate * cosroll) / cospitch;
ACPitchRate = ((int32_t)pitchRate * cosroll - (int32_t)yawRate * sinroll) / (int32_t)MATH_UNIT_FACTOR;
ACRollRate = rollRate + (((int32_t)pitchRate * sinroll / ANTIOVF * tanpitch + (int32_t)yawRate * int_cos(rollAngle) / ANTIOVF * tanpitch) / ((int32_t)MATH_UNIT_FACTOR / ANTIOVF * MATH_UNIT_FACTOR));
ACYawRate = ((int32_t)pitchRate * sinroll) / cospitch + ((int32_t)yawRate * cosroll) / cospitch;
}
 
void integrate(void) {
305,10 → 305,17
* Calculate yaw gyro integral (~ to rotation angle)
* Limit yawGyroHeading proportional to 0 deg to 360 deg
*/
yawGyroHeading += ACYawRate;
 
// Why is yawAngle not wrapped 'round?
yawAngle += ACYawRate;
if(yawGyroHeading >= YAWOVER360) yawGyroHeading -= YAWOVER360; // 360 deg. wrap
else if(yawGyroHeading < 0) yawGyroHeading += YAWOVER360;
if(yawGyroHeading >= YAWOVER360) {
yawGyroHeading -= YAWOVER360; // 360 deg. wrap
} else if(yawGyroHeading < 0) {
yawGyroHeading += YAWOVER360;
}
 
/*
* Pitch axis integration and range boundary wrap.
/branches/dongfang_FC_rewrite/externalControl.c
52,10 → 52,6
}
 
uint8_t EC_getSignalQuality(void) {
if (!(externalControl.config & 0x01 && dynamicParams.ExternalControl > 128))
// External control is not even configured.
return NO_SIGNAL;
 
if (externalControlActive > 100)
// Configured and heard from recently
return SIGNAL_GOOD;
64,6 → 60,10
// Configured and heard from
return SIGNAL_OK;
 
if (!(externalControl.config & 0x01 && dynamicParams.ExternalControl > 128))
// External control is not even configured.
return NO_SIGNAL;
 
// Configured but expired.
return SIGNAL_LOST;
}
/branches/dongfang_FC_rewrite/makefile
22,9 → 22,9
RC = DSL
#RC = SPECTRUM
 
GYRO=ENC-03_FC1.3
#GYRO=ENC-03_FC1.3
#GYRO=ADXRS610_FC2.0
#GYRO=invenSense
GYRO=invenSense
 
#-------------------------------------------------------------------
# get SVN revision
/branches/dongfang_FC_rewrite
Property changes:
Added: svn:ignore
+*.d
+*.lst
+*.eep
+*.elf
+*.lss
+*.map
+*.sym
+.project