Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 2024 → Rev 2025

/branches/dongfang_FC_fixedwing/ADXRS610_FC2.0.c
3,9 → 3,10
 
const uint8_t GYRO_QUADRANT = 3;
//const uint8_t ACC_QUADRANT = 0;
const uint8_t YAW_REVERSED = 0;
const uint8_t GYROS_REVERSED = 0;
 
const uint8_t YAW_GYRO_REVERSED = 0;
const uint8_t PR_GYROS_ORIENTATION_REVERSED = 0;
 
const uint8_t Z_ACC_REVERSED = 0;
 
void gyro_calibrate(void) {
14,7 → 15,7
void gyro_setDefaults(void) {
staticParams.DriftComp = 0;
staticParams.GyroAccFactor = 1;
staticParams.GyroAccTrim = 0;
staticParams.GyroAccTrim = 1;
}
 
/*
/branches/dongfang_FC_fixedwing/ENC-03_FC1.3.c
6,9 → 6,9
#define PITCHROLL_MINLIMIT GYRO_SUMMATION_FACTOR_PITCHROLL * 510
#define PITCHROLL_MAXLIMIT GYRO_SUMMATION_FACTOR_PITCHROLL * 515
 
const uint8_t GYROS_REVERSED = 0;
const uint8_t PR_GYROS_ORIENTATION_REVERSED = 0;
const uint8_t GYRO_QUADRANT = 0;
const uint8_t YAW_REVERSED = 1;
const uint8_t YAW_GYRO_REVERSED = 1;
const uint8_t Z_ACC_REVERSED = 0;
 
// void gyro_init(void) {}
65,7 → 65,7
}
 
void gyro_setDefaults(void) {
staticParams.DriftComp = 200;
staticParams.GyroAccFactor = 25;
staticParams.GyroAccTrim = 1;
staticParams.zerothOrderGyroCorrectionFactorx1000 = 25;
staticParams.secondOrderGyroCorrectionDivisor = 1;
staticParams.secondOrderGyroCorrectionLimit = 200;
}
/branches/dongfang_FC_fixedwing/configuration.c
6,7 → 6,8
#include "uart0.h"
 
int16_t variables[8] = {0,0,0,0,0,0,0,0};
dynamicParam_t dynamicParams;// = {48,251,16,58,64,8,150,150,2,10,{0,0,0,0,0,0,0,0},100,70,90,65,64,100,0,0,0};
 
dynamicParam_t dynamicParams;
uint8_t CPUType = ATMEGA644;
uint8_t BoardRelease = 13;
 
35,7 → 36,7
for (i=0; i<sizeof(staticParams.UserParams); i++) {
SET_POT(dynamicParams.UserParams[i],staticParams.UserParams[i]);
}
 
SET_POT_MM(dynamicParams.J16Timing,staticParams.J16Timing,1,255);
SET_POT_MM(dynamicParams.J17Timing,staticParams.J17Timing,1,255);
 
/branches/dongfang_FC_fixedwing/configuration.h
10,7 → 10,6
/*PMM*/uint8_t HeightP;
/* P */uint8_t Height_ACC_Effect;
/* P */uint8_t CompassYawEffect;
/* P */uint8_t unnused;
 
/* P */uint8_t GyroPitchP;
/* P */uint8_t GyroRollP;
23,23 → 22,9
/* P */uint8_t GyroRollD; // AxisCoupling1 in tool
/* P */uint8_t GyroYawD; // AxisCoupling2 in tool
 
/* P */uint8_t AxisCouplingYawCorrection;
/* P */uint8_t DynamicStability;
/* P */uint8_t ExternalControl;
/*PMM*/uint8_t J16Timing;
/*PMM*/uint8_t J17Timing;
/* P */uint8_t NaviGpsModeControl;
/* P */uint8_t NaviGpsGain;
/* P */uint8_t NaviGpsP;
/* P */uint8_t NaviGpsI;
/* P */uint8_t NaviGpsD;
/* P */uint8_t NaviGpsACC;
/*PMM*/uint8_t NaviOperatingRadius;
/* P */uint8_t NaviWindCorrection;
/* P */uint8_t NaviSpeedCompensation;
int8_t KalmanK;
int8_t KalmanMaxDrift;
int8_t KalmanMaxFusion;
} dynamicParam_t;
extern dynamicParam_t dynamicParams;
 
63,31 → 48,39
uint8_t Height_Gain; // Value : 0-50
uint8_t Height_ACC_Effect; // Value : 0-250
 
uint8_t StickElevatorP; // StickP in tool.
uint8_t StickAileronsP; // StickD in tool.
uint8_t StickRudderP; // StickYawP in tool.
uint8_t StickElevatorP;
uint8_t StickAileronsP;
uint8_t StickRudderP;
 
uint8_t GyroAccFactor; // Value : 1-64
uint8_t CompassYawEffect; // Value : 0-32
uint8_t PIDGyroFilter;// Value: 1-8
uint8_t DGyroFilter; // Value: 1-8
uint8_t attitudeGyroFilter; // Value: 1-8
 
uint8_t GyroPitchP; // GyroP in tool
uint8_t GyroRollP; // GyroI in tool
uint8_t GyroYawP; // GyroD in tool
uint8_t accFilter;
 
uint8_t GyroPitchP;
uint8_t GyroRollP;
uint8_t GyroYawP;
 
uint8_t UserParams[8]; // Value : 0-250
 
uint8_t LowVoltageWarning; // Value : 0-250
 
uint8_t ControlSigns;
uint8_t servoDirections;
uint8_t ServoRefresh; // Value: 0-250 // Refreshrate of servo pwm output
 
uint8_t GyroPitchD; // LoopGasLimit in tool
uint8_t GyroRollD; // loopThreshold in tool
uint8_t GyroYawD; // loopHysteresis in tool
uint8_t GyroPitchD;
uint8_t GyroRollD;
uint8_t GyroYawD;
 
uint8_t GyroAccTrim; // 1/k (Koppel_ACC_Wirkung)
uint8_t DriftComp; // limit for gyrodrift compensation
uint8_t zerothOrderGyroCorrectionZAccLimit;
uint8_t zerothOrderGyroCorrectionFactorx1000;
 
uint8_t secondOrderGyroCorrectionDivisor;
uint8_t secondOrderGyroCorrectionLimit;
uint8_t CompassYawEffect; // Value : 0-32
 
uint8_t J16Bitmask; // for the J16 Output
uint8_t J16Timing; // for the J16 Output
uint8_t J17Bitmask; // for the J17 Output
94,12 → 87,6
uint8_t J17Timing; // for the J17 Output
 
uint8_t ExternalControl; // for serial Control
uint8_t BitConfig; // see upper defines for bitcoding
 
uint8_t accCorrectionZAccLimit;
uint8_t sensorFilterSettings;
uint8_t Reserved[4];
} paramset_t;
 
#define PARAMSET_STRUCT_LEN sizeof(paramset_t)
134,12 → 121,10
#define CFG_AXIS_COUPLING_ACTIVE (1<<6)
#define CFG_ROTARY_RATE_LIMITER (1<<7)
 
// bit mask for staticParams.BitConfig
#define CFG_LOOP_UP (1<<0)
#define CFG_LOOP_DOWN (1<<1)
#define CFG_LOOP_LEFT (1<<2)
#define CFG_LOOP_RIGHT (1<<3)
#define CFG_HEIGHT_3SWITCH (1<<4)
// bit mask for staticParams.ServoDirections
#define SERVO_DIRECTION_ELEVATOR (1<<0)
#define SERVO_DIRECTION_AILERONS (1<<1)
#define SERVO_DIRECTION_RUDDER (1<<2)
 
#define ATMEGA644 0
#define ATMEGA644P 1
/branches/dongfang_FC_fixedwing/eeprom.c
76,12 → 76,13
 
staticParams.LowVoltageWarning = 105;
staticParams.ServoRefresh = 7;
staticParams.BitConfig = 0;
 
staticParams.J16Bitmask = 95;
staticParams.J17Bitmask = 243;
staticParams.J16Timing = 15;
staticParams.J17Timing = 15;
staticParams.ControlSigns = 2;
staticParams.servoDirections = 2;
}
 
void setDefaults(void) {
/branches/dongfang_FC_fixedwing/flight.c
61,7 → 61,6
#define CONTROL_CONFIG_SCALE 10
 
void flight_setNeutral() {
MKFlags |= MKFLAG_CALIBRATE;
// not really used here any more.
controlMixer_initVariables();
}
159,9 → 158,9
IPart[PITCH] = error[PITCH]; // * some factor configurable.
IPart[ROLL] = error[ROLL];
// TODO: Add ipart. Or add/subtract depending, not sure.
term[PITCH] = control[CONTROL_ELEVATOR] + (staticParams.ControlSigns & 1 ? PDPart[PITCH] : -PDPart[PITCH]);
term[ROLL] = control[CONTROL_AILERONS] + (staticParams.ControlSigns & 2 ? PDPart[ROLL] : -PDPart[ROLL]);
yawTerm = control[CONTROL_RUDDER] + (staticParams.ControlSigns & 4 ? PDPartYaw : -PDPartYaw);
term[PITCH] = control[CONTROL_ELEVATOR] + (staticParams.servoDirections & SERVO_DIRECTION_ELEVATOR ? PDPart[PITCH] : -PDPart[PITCH]);
term[ROLL] = control[CONTROL_AILERONS] + (staticParams.servoDirections & SERVO_DIRECTION_AILERONS ? PDPart[ROLL] : -PDPart[ROLL]);
yawTerm = control[CONTROL_RUDDER] + (staticParams.servoDirections & SERVO_DIRECTION_RUDDER ? PDPartYaw : -PDPartYaw);
 
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Universal Mixer
/branches/dongfang_FC_fixedwing/invenSense.c
8,9 → 8,7
* Configuration for my prototype board with InvenSense gyros.
* The FC 1.3 board is installed upside down, therefore Z acc is reversed but not roll.
*/
const uint8_t GYRO_REVERSED[3] = { 0, 0, 0 };
const uint8_t ACC_REVERSED[3] = { 0, 0, 1 };
const uint8_t AXIS_TRANSFORM = 0;
PR_GYROS_ORIENTATION_REVERSED = 0;
 
#define AUTOZERO_PORT PORTD
#define AUTOZERO_DDR DDRD
34,7 → 32,7
}
 
void gyro_setDefaults(void) {
staticParams.GyroAccFactor = 1;
staticParams.DriftComp = 3;
staticParams.GyroAccTrim = 2;
staticParams.zerothOrderGyroCorrectionFactorx1000 = 1;
staticParams.secondOrderGyroCorrectionDivisor = 2;
staticParams.secondOrderGyroCorrectionLimit = 3;
}