Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1873 → Rev 1874

/branches/dongfang_FC_rewrite/ADXRS610_FC2.0.c
9,11 → 9,7
 
void gyro_setDefaults(void) {
staticParams.GyroD = 5;
staticParams.DriftComp = 10;
staticParams.DriftComp = 3;
staticParams.GyroAccFactor = 1;
staticParams.GyroAccTrim = 5;
 
// Not used.
staticParams.AngleTurnOverPitch = 78;
staticParams.AngleTurnOverRoll = 78;
}
/branches/dongfang_FC_rewrite/ENC-03_FC1.3.c
68,8 → 68,4
staticParams.DriftComp = 200;
staticParams.GyroAccFactor = 25;
staticParams.GyroAccTrim = 1;
 
// Not used.
// staticParams.AngleTurnOverPitch = 85;
// staticParams.AngleTurnOverRoll = 85;
}
/branches/dongfang_FC_rewrite/analog.h
94,7 → 94,7
* noticeable). 4 is fine for the default filtering.
* Experiment: Set it to 1.
*/
#define GYRO_FACTOR_PITCHROLL 4
#define GYRO_FACTOR_PITCHROLL 1
 
/*
* How many samples are summed in one ADC loop, for pitch&roll and yaw,
/branches/dongfang_FC_rewrite/attitude.c
204,8 → 204,8
uint8_t axis;
 
for (axis = PITCH; axis <= ROLL; axis++) {
rate_PID[axis] = gyro_PID[axis] / HIRES_GYRO_INTEGRATION_FACTOR + driftComp[axis];
rate_ATT[axis] = gyro_ATT[axis] / HIRES_GYRO_INTEGRATION_FACTOR + driftComp[axis];
rate_PID[axis] = gyro_PID[axis] /* / HIRES_GYRO_INTEGRATION_FACTOR */ + driftComp[axis];
rate_ATT[axis] = gyro_ATT[axis] /* / HIRES_GYRO_INTEGRATION_FACTOR */ + driftComp[axis];
differential[axis] = gyroD[axis];
averageAcc[axis] += acc[axis];
}
362,9 → 362,6
int16_t round;
uint8_t axis;
 
DebugOut.Analog[6] = (DRIFTCORRECTION_TIME + DRIFTCORRECTION_TIME/2) / DRIFTCORRECTION_TIME;
DebugOut.Analog[7] = (-DRIFTCORRECTION_TIME + DRIFTCORRECTION_TIME/2) / DRIFTCORRECTION_TIME;
 
if (!--timer) {
timer = DRIFTCORRECTION_TIME;
for (axis = PITCH; axis <= ROLL; axis++) {
/branches/dongfang_FC_rewrite/attitude.h
36,7 → 36,8
* Will be about 4 for InvenSense, 8 for FC1.3 and 8 for ADXRS610.
* The number 1250 is derived from the original code: It has about 225000 = 1250 * 180 for 180 degrees.
*/
#define HIRES_GYRO_INTEGRATION_FACTOR (int)((GYRO_RATE_FACTOR_PITCHROLL * INTEGRATION_FREQUENCY * GYRO_PITCHROLL_CORRECTION) / 1250)
#define HIRES_GYRO_INTEGRATION_FACTOR 1
// (int)((GYRO_RATE_FACTOR_PITCHROLL * INTEGRATION_FREQUENCY * GYRO_PITCHROLL_CORRECTION) / 1250)
 
/*
* Constant for deriving an attitude angle from acceleration measurement.
/branches/dongfang_FC_rewrite/eeprom.c
114,7 → 114,7
staticParams.ChannelAssignment[CH_POTS + 1] = 6;
staticParams.ChannelAssignment[CH_POTS + 2] = 7;
staticParams.ChannelAssignment[CH_POTS + 3] = 8;
staticParams.GlobalConfig = CFG_AXIS_COUPLING_ACTIVE | CFG_HEADING_HOLD; // CFG_COMPASS_ACTIVE | CFG_GPS_ACTIVE;//CFG_HEIGHT_CONTROL | CFG_HEIGHT_SWITCH | CFG_COMPASS_FIX;
staticParams.GlobalConfig = /* CFG_AXIS_COUPLING_ACTIVE | */ CFG_HEADING_HOLD; // CFG_COMPASS_ACTIVE | CFG_GPS_ACTIVE;//CFG_HEIGHT_CONTROL | CFG_HEIGHT_SWITCH | CFG_COMPASS_FIX;
staticParams.HeightMinGas = 30;
staticParams.MaxHeight = 251;
staticParams.HeightP = 10;
178,7 → 178,10
gyro_setDefaults();
setDefaultUserParams();
staticParams.GlobalConfig = CFG_ROTARY_RATE_LIMITER
| CFG_AXIS_COUPLING_ACTIVE;
/* | CFG_AXIS_COUPLING_ACTIVE*/;
staticParams.EmergencyGasDuration = 200;
staticParams.J16Timing = 10;
staticParams.J17Timing = 10;
memcpy(staticParams.Name, "Sport\0", 6);
}
 
190,8 → 193,9
gyro_setDefaults();
setDefaultUserParams();
staticParams.GlobalConfig = CFG_ROTARY_RATE_LIMITER
| CFG_AXIS_COUPLING_ACTIVE;
/* | CFG_AXIS_COUPLING_ACTIVE*/ ;
staticParams.Height_Gain = 3;
staticParams.EmergencyGasDuration = 200;
staticParams.J16Timing = 20;
staticParams.J17Timing = 20;
memcpy(staticParams.Name, "Normal\0", 7);
205,10 → 209,9
gyro_setDefaults();
setDefaultUserParams();
staticParams.GlobalConfig = CFG_ROTARY_RATE_LIMITER
| CFG_AXIS_COUPLING_ACTIVE;
/* | CFG_AXIS_COUPLING_ACTIVE */;
staticParams.Height_Gain = 3;
staticParams.EmergencyGasDuration = 20;
staticParams.AxisCouplingYawCorrection = 70;
staticParams.EmergencyGasDuration = 200;
staticParams.J16Timing = 30;
staticParams.J17Timing = 30;
memcpy(staticParams.Name, "Beginner\0", 9);
/branches/dongfang_FC_rewrite/flight.c
436,13 → 436,13
DebugOut.Analog[15] = throttleTerm;
 
for (i = 0; i < MAX_MOTORS; i++) {
int16_t tmp;
int32_t tmp;
if (MKFlags & MKFLAG_MOTOR_RUN && Mixer.Motor[i][MIX_THROTTLE] > 0) {
tmp = (int32_t)throttleTerm * Mixer.Motor[i][MIX_THROTTLE] / 64L;
tmp += (int32_t)term[PITCH] * Mixer.Motor[i][MIX_PITCH] / 64L;
tmp += (int32_t)term[ROLL] * Mixer.Motor[i][MIX_ROLL] / 64L;
tmp += (int32_t)yawTerm * Mixer.Motor[i][MIX_YAW] / 64L;
// tmp = tmp >> 6;
tmp = (int32_t)throttleTerm * Mixer.Motor[i][MIX_THROTTLE];
tmp += (int32_t)term[PITCH] * Mixer.Motor[i][MIX_PITCH];
tmp += (int32_t)term[ROLL] * Mixer.Motor[i][MIX_ROLL];
tmp += (int32_t)yawTerm * Mixer.Motor[i][MIX_YAW];
tmp = tmp >> 6;
motorFilters[i] = motorFilter(tmp, motorFilters[i]);
// Now we scale back down to a 0..255 range.
tmp = motorFilters[i] / MOTOR_SCALING;
476,6 → 476,9
DebugOut.Analog[1] = (10 * angle[ROLL]) / GYRO_DEG_FACTOR_PITCHROLL; // in 0.1 deg
DebugOut.Analog[2] = yawGyroHeading / GYRO_DEG_FACTOR_YAW;
 
DebugOut.Analog[6] = 64 >> 4;
DebugOut.Analog[7] = -64 >> 4;
 
/*
DebugOut.Analog[23] = (yawRate * 2 * (int32_t)yawPFactor) / (256L / CONTROL_SCALING);
DebugOut.Analog[24] = controlYaw;
/branches/dongfang_FC_rewrite/invenSense.c
35,9 → 35,6
void gyro_setDefaults(void) {
staticParams.GyroD = 3;
staticParams.GyroAccFactor = 1;
staticParams.DriftComp = 10;
 
// Not used.
staticParams.AngleTurnOverPitch = 85;
staticParams.AngleTurnOverRoll = 85;
staticParams.DriftComp = 3;
staticParams.GyroAccTrim = 2;
}
/branches/dongfang_FC_rewrite/makefile
25,8 → 25,8
GYRO=ENC-03_FC1.3
GYRO_HW_NAME=ENC
GYRO_HW_FACTOR=1.304f
GYRO_PITCHROLL_CORRECTION=0.9f
GYRO_YAW_CORRECTION=0.80f
GYRO_PITCHROLL_CORRECTION=1.0f
GYRO_YAW_CORRECTION=1.0f
 
#GYRO=ADXRS610_FC2.0
#GYRO_HW_NAME=ADXR
37,12 → 37,9
#GYRO=invenSense
#GYRO_HW_NAME=Isense
#GYRO_HW_FACTOR=0.6827f
#GYRO_PITCHROLL_CORRECTION=0.93f
#GYRO_YAW_CORRECTION=0.97f
#GYRO_PITCHROLL_CORRECTION=1.0f
#GYRO_YAW_CORRECTION=1.0f
 
#GYRO=
#GYRO=invenSense
 
#-------------------------------------------------------------------
# get SVN revision
REV=0001
/branches/dongfang_FC_rewrite/output.h
16,7 → 16,7
#define J5TOGGLE PORTD ^= (1<<PORTD3)
 
// invert means: An "1" bit in digital debug data make a LOW on the output.
#define DIGITAL_DEBUG_INVERT 0
#define DIGITAL_DEBUG_INVERT 1
 
#define OUTPUT_HIGH(num) {PORTC |= (4 << (num));}
#define OUTPUT_LOW(num) {PORTC &= ~(4 << (num));}
/branches/dongfang_FC_rewrite/uart0.c
129,8 → 129,8
"GyroPitch(PID) ",
"GyroRoll(PID) ",
"GyroYaw ", //5
"plusround ",
"minusround ",
"GYRO_RATE_FACTOR",
"GYRO_RATE_FACTOR",
"unused ",
"AccPitch (angle)",
"AccRoll (angle) ", //10