Subversion Repositories FlightCtrl

Rev

Rev 470 | Blame | Last modification | View Log | RSS feed

/*#######################################################################################
Flight Control
#######################################################################################*/


#ifndef _FC_H
#define _FC_H

extern volatile unsigned char Timeout;
extern unsigned char Sekunde,Minute;
extern long IntegralNick,IntegralNick2;
extern long IntegralRoll,IntegralRoll2;
extern long Integral_Gier;
extern volatile long Mess_IntegralNick,Mess_IntegralNick2;
extern volatile long Mess_IntegralRoll,Mess_IntegralRoll2;
extern volatile long Mess_Integral_Hoch;
extern volatile long Mess_Integral_Gier,Mess_Integral_Gier2;
extern int KompassValue;
extern int KompassStartwert;
extern int KompassRichtung;
extern int HoehenWert;
extern int SollHoehe;
extern int MesswertNick,MesswertRoll,MesswertGier;
extern int Mittelwert_AccNick, Mittelwert_AccRoll,Mittelwert_AccHoch;

extern volatile int AdNeutralNick,AdNeutralRoll,AdNeutralGier;
extern volatile int NeutralAccX, NeutralAccY;
extern volatile float NeutralAccZ;


void MotorRegler(void);
void SendMotorData(void);
void CalibrierMittelwert(void);
void Mittelwert(void);
void SetNeutral(void);
void Piep(unsigned char Anzahl);
void DefaultKonstanten1(void);
void DefaultKonstanten2(void);

unsigned char h,m,s;
volatile unsigned char Timeout;


int DiffNick,DiffRoll;
extern int  Poti1, Poti2, Poti3, Poti4;
volatile unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links;
unsigned char MotorWert[5];
volatile unsigned char SenderOkay;
int StickNick,StickRoll,StickGier;
char MotorenEin;
extern void DefaultKonstanten(void);


struct mk_param_struct
 {
   unsigned char Kanalbelegung[8];        // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3
   unsigned char GlobalConfig;            // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv
   unsigned char Hoehe_MinGas;            // Wert : 0-100
   unsigned char Luftdruck_D;             // Wert : 0-250
   unsigned char MaxHoehe;                // Wert : 0-32
   unsigned char Hoehe_P;                 // Wert : 0-32
   unsigned char Hoehe_Verstaerkung;      // Wert : 0-50
   unsigned char Hoehe_ACC_Wirkung;      // Wert : 0-250
   unsigned char Stick_P;                // Wert : 1-6
   unsigned char Stick_D;                // Wert : 0-64
   unsigned char Gier_P;                 // Wert : 1-20
   unsigned char Gas_Min;                // Wert : 0-32
   unsigned char Gas_Max;                // Wert : 33-250
   unsigned char GyroAccFaktor;          // Wert : 1-64
   unsigned char KompassWirkung;         // Wert : 0-32
   unsigned char Gyro_P;                 // Wert : 10-250
   unsigned char Gyro_I;                 // Wert : 0-250
   unsigned char UnterspannungsWarnung;  // Wert : 0-250
   unsigned char NotGas;                 // Wert : 0-250     //Gaswert bei Empängsverlust
   unsigned char NotGasZeit;             // Wert : 0-250     // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen
   unsigned char UfoAusrichtung;         // X oder + Formation
   unsigned char I_Faktor;               // Wert : 0-250
   unsigned char UserParam1;             // Wert : 0-250
   unsigned char UserParam2;             // Wert : 0-250
   unsigned char UserParam3;             // Wert : 0-250
   unsigned char UserParam4;             // Wert : 0-250
   unsigned char ServoNickControl;       // Wert : 0-250     // Stellung des Servos
   unsigned char ServoNickComp;          // Wert : 0-250     // Einfluss Gyro/Servo
   unsigned char ServoNickMin;           // Wert : 0-250     // Anschlag
   unsigned char ServoNickMax;           // Wert : 0-250     // Anschlag
   unsigned char ServoNickRefresh;       // Wert : 0-250     // Richtung Einfluss Gyro/Servo
   unsigned char ServoNickCompInvert;    // Wert : 0-250     // Richtung Einfluss Gyro/Servo
   unsigned char Reserved[7];
   char Name[12];
 };

struct acc_neutral_struct
{
        volatile int X;
        volatile int Y;
        volatile float Z;
};

extern struct acc_neutral_struct acc_neutral;
extern void calib_acc(void);


extern struct mk_param_struct EE_Parameter;

extern unsigned char Parameter_Luftdruck_D;
extern unsigned char Parameter_MaxHoehe;
extern unsigned char Parameter_Hoehe_P;
extern unsigned char Parameter_Hoehe_ACC_Wirkung;
extern unsigned char Parameter_KompassWirkung;
extern unsigned char Parameter_Gyro_P;
extern unsigned char Parameter_Gyro_I;
extern unsigned char Parameter_Gier_P;
extern unsigned char Parameter_ServoNickControl;

#endif //_FC_H