Subversion Repositories FlightCtrl

Rev

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

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


#ifndef _FC_H
#define _FC_H

typedef struct
{
        uint8_t Hight_D;
        uint8_t MaxHight;
        uint8_t Hight_P;
        uint8_t Hight_ACC_Effect;
        uint8_t CompassYawEffect;
        uint8_t Gyro_P;
        uint8_t Gyro_I;
        uint8_t Gier_P;
        uint8_t I_Factor;
        uint8_t UserParam1;
        uint8_t UserParam2;
        uint8_t UserParam3;
        uint8_t UserParam4;
        uint8_t UserParam5;
        uint8_t UserParam6;
        uint8_t UserParam7;
        uint8_t UserParam8;
        uint8_t ServoPitchControl;
        uint8_t LoopThrustLimit;
        uint8_t Yaw_PosFeedback;
        uint8_t Yaw_NegFeedback;
        uint8_t DynamicStability;
} fc_param_t;

extern fc_param_t FCParam;

extern volatile uint16_t I2CTimeout;

// attitude
extern volatile int32_t IntegralPitch, IntegralRoll, IntegralYaw;
extern volatile int16_t Reading_GyroPitch, Reading_GyroRoll, Reading_GyroYaw;

// offsets
extern volatile int16_t AdNeutralPitch, AdNeutralRoll, AdNeutralYaw;
extern volatile int16_t NeutralAccX, NeutralAccY;
extern volatile float NeutralAccZ;


extern volatile int32_t Reading_Integral_Top; // calculated in analog.c

// compass navigation
extern volatile int16_t  CompassHeading;
extern volatile int16_t  CompassCourse;
extern volatile int16_t  CompassOffCourse;

// hight control
extern int ReadingHight;
extern int SetPointHight;

// mean accelarations
extern volatile int16_t Mean_AccPitch, Mean_AccRoll, Mean_AccTop;

// looping params
extern long TurnOver180Pitch, TurnOver180Roll;

// external control
extern int16_t ExternStickPitch, ExternStickRoll, ExternStickYaw;


void MotorControl(void);
void SendMotorData(void);
void CalibMean(void);
void Mean(void);
void SetNeutral(void);
void Beep(uint8_t numbeeps);


//extern unsigned char h,m,s;

extern int16_t  Poti1, Poti2, Poti3, Poti4;

// setpoints for motors
extern volatile uint8_t Motor_Front, Motor_Rear, Motor_Right, Motor_Left; //used by twimaster isr

extern int16_t StickPitch, StickRoll, StickYaw;
extern uint8_t MotorsOn;


#endif //_FC_H