Subversion Repositories FlightCtrl

Rev

Rev 683 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 683 Rev 685
Line 2... Line 2...
2
// + Copyright (c) 04.2007 Holger Buss
2
// + Copyright (c) 04.2007 Holger Buss
3
// + only for non-profit use
3
// + only for non-profit use
4
// + www.MikroKopter.com
4
// + www.MikroKopter.com
5
// + see the File "License.txt" for further Informations
5
// + see the File "License.txt" for further Informations
6
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7
 
-
 
-
 
7
#include "analog.h"
8
#include "main.h"
8
#include "main.h"
-
 
9
#include "timer0.h"
-
 
10
#include "fc.h"
-
 
11
#include "printf_P.h"
Line 9... Line 12...
9
 
12
 
10
volatile int16_t Current_Nick = 0, Current_Roll = 0, Current_Gier = 0;
13
volatile int16_t Current_Nick = 0, Current_Roll = 0, Current_Gier = 0;
11
volatile int16_t Current_AccX = 0, Current_AccY = 0, Current_AccZ = 0;
14
volatile int16_t Current_AccX = 0, Current_AccY = 0, Current_AccZ = 0;
12
volatile int16_t UBat = 100;
15
volatile int16_t UBat = 100;
Line 16... Line 19...
16
volatile int32_t Luftdruck = 32000;
19
volatile int32_t Luftdruck = 32000;
17
volatile int16_t StartLuftdruck;
20
volatile int16_t StartLuftdruck;
18
volatile uint16_t MessLuftdruck = 1023;
21
volatile uint16_t MessLuftdruck = 1023;
19
uint8_t DruckOffsetSetting;
22
uint8_t DruckOffsetSetting;
20
volatile int16_t HoeheD = 0;
23
volatile int16_t HoeheD = 0;
21
volatile int16_t  tmpLuftdruck;
24
volatile int16_t tmpLuftdruck;
22
volatile uint16_t ZaehlMessungen = 0;
25
volatile uint16_t ZaehlMessungen = 0;
Line 23... Line 26...
23
 
26
 
24
/*****************************************************/
27
/*****************************************************/
25
/*     Initialize Analog Digital Converter           */
28
/*     Initialize Analog Digital Converter           */
Line 113... Line 116...
113
            AdValueAccNick =  Current_AccX;
116
            AdValueAccNick =  Current_AccX;
114
                    adc_channel = 0; // set next channel to ADC7 = GIER GYRO
117
                    adc_channel = 0; // set next channel to ADC7 = GIER GYRO
115
            break;
118
            break;
116
        case 6:
119
        case 6:
117
                // average over two samples to create current ADValueGier
120
                // average over two samples to create current ADValueGier
118
            if(PlatinenVersion == 10)  AdValueGyrGier = (ADC + gier1) / 2;
121
            if(BoardRelease == 10)  AdValueGyrGier = (ADC + gier1) / 2;
119
                        else                                       AdValueGyrGier = ADC + gier1; // gain is 2 times lower on FC 1.1
122
                        else                                       AdValueGyrGier = ADC + gier1; // gain is 2 times lower on FC 1.1
120
            adc_channel = 1; // set next channel to ADC7 = ROLL GYRO
123
            adc_channel = 1; // set next channel to ADC7 = ROLL GYRO
121
            break;
124
            break;
122
        case 7:
125
        case 7:
123
                // average over two samples to create current ADValueRoll
126
                // average over two samples to create current ADValueRoll
124
            if(PlatinenVersion == 10)  AdValueGyrRoll = (ADC + roll1) / 2;
127
            if(BoardRelease == 10)  AdValueGyrRoll = (ADC + roll1) / 2;
125
                        else                                       AdValueGyrRoll = ADC + roll1; // gain is 2 times lower on FC 1.1
128
                        else                                       AdValueGyrRoll = ADC + roll1; // gain is 2 times lower on FC 1.1
126
            adc_channel = 2; // set next channel to ADC2 = NICK GYRO
129
            adc_channel = 2; // set next channel to ADC2 = NICK GYRO
127
            break;
130
            break;
128
        case 8:
131
        case 8:
129
                // average over two samples to create current ADValueNick
132
                // average over two samples to create current ADValueNick
130
            if(PlatinenVersion == 10)  AdValueGyrNick = (ADC + nick1) / 2;
133
            if(BoardRelease == 10)  AdValueGyrNick = (ADC + nick1) / 2;
131
                        else                                       AdValueGyrNick = ADC + nick1; // gain is 2 times lower on FC 1.1
134
                        else                                       AdValueGyrNick = ADC + nick1; // gain is 2 times lower on FC 1.1
132
            adc_channel = 5; // set next channel to ADC5 = ACC_Z
135
            adc_channel = 5; // set next channel to ADC5 = ACC_Z
133
            break;
136
            break;
134
       case 9:
137
       case 9:
135
                // get z acceleration
138
                // get z acceleration