Subversion Repositories FlightCtrl

Rev

Rev 703 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 703 Rev 711
Line 18... Line 18...
18
volatile int16_t Current_Pitch = 0, Current_Roll = 0, Current_Yaw = 0;
18
volatile int16_t Current_Pitch = 0, Current_Roll = 0, Current_Yaw = 0;
19
volatile int16_t Current_AccX = 0, Current_AccY = 0, Current_AccZ = 0;
19
volatile int16_t Current_AccX = 0, Current_AccY = 0, Current_AccZ = 0;
20
volatile int16_t UBat = 100;
20
volatile int16_t UBat = 100;
21
volatile int16_t AdValueGyrPitch = 0, AdValueGyrRoll = 0, AdValueGyrYaw = 0;
21
volatile int16_t AdValueGyrPitch = 0, AdValueGyrRoll = 0, AdValueGyrYaw = 0;
22
volatile int16_t AdValueAccRoll = 0, AdValueAccPitch = 0, AdValueAccTop = 0;
22
volatile int16_t AdValueAccRoll = 0, AdValueAccPitch = 0, AdValueAccTop = 0;
23
volatile uint8_t messanzahl_AccHoch = 0;
-
 
24
volatile int32_t AirPressure = 32000;
23
volatile int32_t AirPressure = 32000;
25
volatile int16_t StartAirPressure;
24
volatile int16_t StartAirPressure;
26
volatile uint16_t ReadingAirPressure = 1023;
25
volatile uint16_t ReadingAirPressure = 1023;
27
uint8_t DruckOffsetSetting;
26
uint8_t PressureSensorOffset;
28
volatile int16_t HightD = 0;
27
volatile int16_t HightD = 0;
29
volatile int16_t tmpAirPressure;
28
volatile int16_t tmpAirPressure;
30
volatile uint16_t ZaehlMessungen = 0;
29
volatile uint16_t MeasurementCounter = 0;
Line 31... Line 30...
31
 
30
 
32
/*****************************************************/
31
/*****************************************************/
33
/*     Initialize Analog Digital Converter           */
32
/*     Initialize Analog Digital Converter           */
34
/*****************************************************/
33
/*****************************************************/
Line 73... Line 72...
73
  Delay_ms_Mess(50);
72
  Delay_ms_Mess(50);
74
  printf(".");
73
  printf(".");
75
  if(ReadingAirPressure < 900) break;
74
  if(ReadingAirPressure < 900) break;
76
  }
75
  }
77
 SetParamByte(PID_LAST_OFFSET, off);
76
 SetParamByte(PID_LAST_OFFSET, off);
78
 DruckOffsetSetting = off;
77
 PressureSensorOffset = off;
79
 Delay_ms_Mess(300);
78
 Delay_ms_Mess(300);
80
}
79
}
Line 81... Line 80...
81
 
80
 
Line 94... Line 93...
94
    switch(state++)
93
    switch(state++)
95
        {
94
        {
96
        case 0:
95
        case 0:
97
            yaw1 = ADC; // get Gyro Yaw Voltage 1st sample
96
            yaw1 = ADC; // get Gyro Yaw Voltage 1st sample
98
            adc_channel = 1; // set next channel to ADC1 = ROLL GYRO
97
            adc_channel = 1; // set next channel to ADC1 = ROLL GYRO
99
            ZaehlMessungen++; // increment total measurement counter
98
            MeasurementCounter++; // increment total measurement counter
100
            break;
99
            break;
101
        case 1:
100
        case 1:
102
            roll1 = ADC; // get Gyro Roll Voltage 1st sample
101
            roll1 = ADC; // get Gyro Roll Voltage 1st sample
103
            adc_channel = 2; // set next channel to ADC2 = PITCH GYRO
102
            adc_channel = 2; // set next channel to ADC2 = PITCH GYRO
104
            break;
103
            break;
Line 149... Line 148...
149
             }
148
             }
150
             else if(AdValueAccTop < -1)
149
             else if(AdValueAccTop < -1)
151
             {
150
             {
152
              if(NeutralAccZ > 600) NeutralAccZ-= 0.02;
151
              if(NeutralAccZ > 600) NeutralAccZ-= 0.02;
153
             }
152
             }
154
            messanzahl_AccHoch = 1;
-
 
155
            Current_AccZ = ADC;
153
            Current_AccZ = ADC;
156
            Reading_Integral_Top += AdValueAccTop;      // Integrieren
154
            Reading_Integral_Top += AdValueAccTop;      // Integrieren
157
            Reading_Integral_Top -= Reading_Integral_Top / 1024; // dämfen
155
            Reading_Integral_Top -= Reading_Integral_Top / 1024; // dämfen
158
                adc_channel = 3; // set next channel to ADC3 = air pressure
156
                adc_channel = 3; // set next channel to ADC3 = air pressure
159
            break;
157
            break;