Quad X Type Multicopter

Dependencies:   IAP

config.h

Committer:
komaida424
Date:
2014-02-13
Revision:
3:27407c4984cf
Parent:
2:59ac9df97701
Child:
4:4060309b9cc0

File content as of revision 3:27407c4984cf:

#ifndef CONFIG_H
#define CONFIG_H

//#define SERIAL_LCD
//#define SOFT_PWM
//#define LPCXpresso
//#define LocalFileOut

#define TX_TYPE 0               // 0:FM 1:IR
#define Thro_Zero 30
#define Thro_Lo 75
#define Thro_Hi 950
#define Pulse_Min 1000
#define Pulse_Max 2000
#define Stick_Limit 350
#define M1 M[0]
#define M2 M[1]
#define M3 M[2]
#define M4 M[3]
#define M5 M[4]
#define M6 M[5]
#define THR CH[0]
#define AIL CH[1]
#define ELE CH[2]
#define RUD CH[3]
#define AUX CH[4]
#define _ITG3200  0x00
#define _L3GD20   0x01
#define TICK_TIME 0.05
#define GYRO_ADJUST 2

//enum PortNum{Port_THR=1,Port_AIL=3,Port_ELE=5,Port_RUD=7,Port_AUX=6};
enum IRNum{IR_THR=1,IR_AIL,IR_ELE,IR_RUD,IR_AUX};       //Input Pulse Sequence
enum channel{ROL=0,PIT,YAW,COL,GAIN};

struct config {
    float Revision;
    int Struct_Size;
    char StartMode;              //'c':config mode  'f':flight mode
    int Stick_Ref[5];            //Stick Neutral Position
    float Stick_Mix[3];               //Mixing ratio of stick operation
    signed char Gyro_Dir[4];
    float Gyro_Gain[6];
    signed char Accel_Dir[4];
    float Accel_Ref[3];
    float Accel_Gain[3];
    int Gyro_Gain_Setting;
    float PID_Interval;
    float Cutoff_Freq;
    int Flight_Time;
    int LCD_Contrast;
    int PWM_Mode;
    int ESC_Low;
    int PWM_Interval; 
//    int Accel_Rang;
//    int Accel_Rate;
//    int PWM_Resolution;
    char Angle_Control;
    float kp[3];
    float ki[3];
    float kd[3];
    float PID_Limit;
    float Differential_Limit;
public:
    config() {
        Revision = 1.30;
        Struct_Size = sizeof(config);
        Stick_Ref[0] = 1500;
        Stick_Ref[1] = 1500;
        Stick_Ref[2] = 1500;
        Stick_Ref[3] = 1100;
        Stick_Ref[4] = 1500;
        Stick_Mix[0] = 0.3;
        Stick_Mix[1] = 0.3;
        Stick_Mix[2] = 0.65;
        Gyro_Dir[0] = -1;
        Gyro_Dir[1] = -1;
        Gyro_Dir[2] = 1;
        Gyro_Dir[3] = -1;
        Gyro_Gain[0] = 0.40;
        Gyro_Gain[1] = 0.40;
        Gyro_Gain[2] = 0.40;
        Gyro_Gain[3] = 0.00;
        Gyro_Gain[4] = 0.00;
        Gyro_Gain[5] = 0.00;
        Accel_Dir[0] = 1;
        Accel_Dir[1] = 1;
        Accel_Dir[2] = 1;
        Accel_Dir[3] = 1;
        Accel_Ref[0] = 0;
        Accel_Ref[1] = 0;
        Accel_Ref[2] = 0;
        Accel_Gain[0] = 0.50;
        Accel_Gain[1] = 0.50;
        Accel_Gain[2] = 0.50;
        Gyro_Gain_Setting = -1;
        Cutoff_Freq=0.15;
        Flight_Time=360;
        LCD_Contrast = 60;
        PWM_Mode = 1;
        ESC_Low= 1080;
        PWM_Interval = 2200; 
//        Accel_Rang = 2;
//        Accel_Rate = 14;
//        PWM_Resolution = 0;
        StartMode = 'C';
        Angle_Control = 'H';    // H:horizn  A:angle
        kp[0] = 1.5;
        kp[1] = 1.5;
        kp[2] = 1.5;
        ki[0] = 0.0;
        ki[1] = 0.0;
        ki[2] = 0.0;
        kd[0] = 0.8;
        kd[1] = 0.8;
        kd[2] = 0.8;
        PID_Limit = 350;
        Differential_Limit = 200;
        PID_Interval = 0.003;
    }
};
#endif