Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1685 → Rev 1686

/beta/Code Redesign killagreg/eeprom.c
163,6 → 163,7
ParamSet.GyroI = 150;
ParamSet.GyroYawP = 80;
ParamSet.GyroYawI = 150;
ParamSet.GyroStability = 6; // Value : 1-8
ParamSet.LowVoltageWarning = 33; // auto cell detection for values < 50
ParamSet.EmergencyGas = 35;
ParamSet.EmergencyGasDuration = 60;
270,6 → 271,7
ParamSet.GyroI = 120;
ParamSet.GyroYawP = 90;
ParamSet.GyroYawI = 120;
ParamSet.GyroStability = 6; // Value : 1-8
ParamSet.LowVoltageWarning = 33; // auto cell detection for values < 50
ParamSet.EmergencyGas = 35;
ParamSet.EmergencyGasDuration = 60;
377,6 → 379,7
ParamSet.GyroI = 120;
ParamSet.GyroYawP = 100;
ParamSet.GyroYawI = 120;
ParamSet.GyroStability = 6; // Value : 1-8
ParamSet.LowVoltageWarning = 33; // auto cell detection for values < 50
ParamSet.EmergencyGas = 35;
ParamSet.EmergencyGasDuration = 60;
/beta/Code Redesign killagreg/eeprom.h
4,6 → 4,11
#include <inttypes.h>
#include "twimaster.h"
 
 
#define EEPARAM_REVISION 84 // is count up, if paramater stucture has changed (compatibility)
#define EEMIXER_REVISION 1 // is count up, if mixer stucture has changed (compatibility)
#define EEBLCONFIG_REVISON 35 // is count up, if blconfig stucture has changed (compatibility to BLs!)
 
#define EEPROM_ADR_PARAM_BEGIN 0
#define PID_EE_REVISION 1 // byte
#define PID_ACTIVE_SET 2 // byte
90,9 → 95,6
#define CH_POTI7 10
#define CH_POTI8 11
 
#define EEPARAM_REVISION 83 // is count up, if paramater stucture has changed (compatibility)
#define EEMIXER_REVISION 1 // is count up, if mixer stucture has changed (compatibility)
#define EEBLCONFIG_REVISON 35 // is count up, if blconfig stucture has changed (compatibility to BLs!)
 
// values above 247 representing poti1 to poti8
// poti1 = 255
131,6 → 133,7
uint8_t GyroD; // Value : 0-247
uint8_t GyroYawP; // Value : 10-247
uint8_t GyroYawI; // Value : 0-247
uint8_t GyroStability; // Value : 0-16
uint8_t LowVoltageWarning; // Value : 0-247
uint8_t EmergencyGas; // Value : 0-247 //Gaswert bei Empängsverlust
uint8_t EmergencyGasDuration; // Value : 0-247 // Zeitbis auf EmergencyGas geschaltet wird, wg. Rx-Problemen
/beta/Code Redesign killagreg/fc.c
101,6 → 101,8
int16_t TrimNick, TrimRoll;
 
 
int32_t IPartNick = 0, IPartRoll = 0;
 
// attitude gyro integrals
int32_t IntegralGyroNick = 0,IntegralGyroNick2 = 0;
int32_t IntegralGyroRoll = 0,IntegralGyroRoll2 = 0;
699,8 → 701,8
// PID controller variables
int16_t DiffNick, DiffRoll;
int16_t PDPartNick, PDPartRoll, PDPartYaw, PPartNick, PPartRoll;
static int32_t IPartNick = 0, IPartRoll = 0;
 
 
static int16_t SetPointYaw = 0; // yawing derived from yaw stick value
static int32_t IntegralGyroNickError = 0, IntegralGyroRollError = 0;
static int32_t CorrectionNick, CorrectionRoll;
1519,7 → 1521,8
PDPartYaw = (int32_t)(GyroYaw * 2 * (int32_t)GyroYawPFactor) / (256L / STICK_GAIN) + (int32_t)(IntegralGyroYaw * GyroYawIFactor) / (2 * (44000 / STICK_GAIN));
 
// limit control feedback
#define SENSOR_LIMIT (4096 * 4)
//#define SENSOR_LIMIT (4096 * STICK_GAIN)
#define SENSOR_LIMIT 4096
LIMIT_MIN_MAX(PDPartNick, -SENSOR_LIMIT, SENSOR_LIMIT);
LIMIT_MIN_MAX(PDPartRoll, -SENSOR_LIMIT, SENSOR_LIMIT);
LIMIT_MIN_MAX(PDPartYaw, -SENSOR_LIMIT, SENSOR_LIMIT);
1899,7 → 1902,6
tmp_int1 = ParamSet.GasMax * STICK_GAIN;
LIMIT_MIN_MAX(YawMixFraction, -(tmp_int1 - GasMixFraction), (tmp_int1 - GasMixFraction));
 
#define ATTENUATE_PD 2
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Nick-Axis
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1908,7 → 1910,7
else IPartNick += DiffNick; // I-part for head holding
LIMIT_MIN_MAX(IPartNick, -(STICK_GAIN * 16000L), (STICK_GAIN * 16000L));
if(FCParam.UserParam5 > 50)
NickMixFraction = DiffNick/ATTENUATE_PD + (IPartNick / Ki); // PID-controller for nick
NickMixFraction = (ParamSet.GyroStability * DiffNick)/8 + (IPartNick / Ki); // PID-controller for nick
else
NickMixFraction = DiffNick + (IPartNick / Ki); // PID-controller for nick
 
1920,7 → 1922,7
else IPartRoll += DiffRoll; // I-part for head holding
LIMIT_MIN_MAX(IPartRoll, -(STICK_GAIN * 16000L), (STICK_GAIN * 16000L));
if(FCParam.UserParam5 > 50)
RollMixFraction = DiffRoll/ATTENUATE_PD + (IPartRoll / Ki); // PID-controller for roll
RollMixFraction = (ParamSet.GyroStability * DiffRoll)/8 + (IPartRoll / Ki); // PID-controller for roll
else
RollMixFraction = DiffRoll + (IPartRoll / Ki); // PID-controller for roll
 
/beta/Code Redesign killagreg/fc.h
136,6 → 136,8
extern int8_t VarioCharacter;
extern uint16_t ModelIsFlying;
 
extern int32_t IPartNick;
extern int32_t IPartRoll;
 
// FCFlags
#define FCFLAG_MOTOR_RUN 0x01
/beta/Code Redesign killagreg/libfc1284.a
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/beta/Code Redesign killagreg/makefile
6,7 → 6,7
#-------------------------------------------------------------------
VERSION_MAJOR = 0
VERSION_MINOR = 79
VERSION_PATCH = 10
VERSION_PATCH = 11
 
VERSION_SERIAL_MAJOR = 11 # Serial Protocol Major Version
VERSION_SERIAL_MINOR = 0 # Serial Protocol Minor Version
/beta/Code Redesign killagreg/uart0.c
771,16 → 771,19
SendOutData('D', FC_ADDRESS, 1,(uint8_t *) &DebugOut, sizeof(DebugOut));
DebugData_Timer = SetDelay(DebugData_Interval);
Request_DebugData = FALSE;
}
else if( (((Data3D_Interval > 0) && CheckDelay(Data3D_Timer)) || Request_Data3D) && txd_complete)
}
else if( (((Data3D_Interval > 0) && CheckDelay(Data3D_Timer)) || Request_Data3D) && txd_complete)
{
SendOutData('C', FC_ADDRESS, 1,(uint8_t *) &Data3D, sizeof(Data3D));
Data3D.AngleNick = (int16_t)((10 * IntegralGyroNick) / GYRO_DEG_FACTOR); // convert to multiple of 0.1°
Data3D.AngleRoll = (int16_t)((10 * IntegralGyroRoll) / GYRO_DEG_FACTOR); // convert to multiple of 0.1°
Data3D.Heading = (int16_t)((10 * YawGyroHeading) / GYRO_DEG_FACTOR); // convert to multiple of 0.1°
Data3D.Centroid[0] = IPartNick >> 9;
Data3D.Centroid[1] = IPartRoll >> 9;
Data3D.Centroid[2] = IntegralGyroYaw >> 9;
SendOutData('C', FC_ADDRESS, 1,(uint8_t *) &Data3D, sizeof(Data3D));
Data3D_Timer = SetDelay(Data3D_Interval);
Request_Data3D = FALSE;
}
}
else if(Request_ExternalControl && txd_complete)
{
SendOutData('G', FC_ADDRESS, 1,(uint8_t *) &ExternControl, sizeof(ExternControl));
/beta/Code Redesign killagreg/uart0.h
41,7 → 41,8
int16_t AngleNick; // in 0.1 deg
int16_t AngleRoll; // in 0.1 deg
int16_t Heading; // in 0.1 deg
uint8_t reserve[8];
int8_t Centroid[3];
uint8_t reserve[5];
} __attribute__((packed)) Data3D_t;
 
 
/beta/Code Redesign killagreg/version.txt
410,10 → 410,14
- Piepen, wenn NC-Kommunikation wegfällt
- Da kann man mit UserParameter5 wieder das Verhalten der 0.79b herstellen
0.79l H.Buss
- Schwerpunktanzeige in den 3D-Daten
- Gyro Stability
- EEPROM-Kompatibilität auf 84
 
 
Anpassungen bzgl. V0.79j
G.Stobrawa 24.6.2010
Anpassunge n bzgl. V0.79l
G.Stobrawa 26.6.2010
 
- Code stärker modularisiert und restrukturiert
- viele Kommentare zur Erklärug eingefügt