Subversion Repositories FlightCtrl

Rev

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

Rev 1 Rev 173
Line 3... Line 3...
3
volatile unsigned int CountMilliseconds = 0;
3
volatile unsigned int CountMilliseconds = 0;
4
volatile static unsigned int tim_main;
4
volatile static unsigned int tim_main;
5
volatile unsigned char UpdateMotor = 0;
5
volatile unsigned char UpdateMotor = 0;
6
volatile unsigned int cntKompass = 0;
6
volatile unsigned int cntKompass = 0;
7
volatile unsigned int beeptime = 0;
7
volatile unsigned int beeptime = 0;
-
 
8
unsigned int BeepMuster = 0xffff;
8
int ServoValue = 0;
9
int ServoValue = 0;
Line 9... Line 10...
9
 
10
 
10
enum {
11
enum {
11
  STOP             = 0,
12
  STOP             = 0,
Line 20... Line 21...
20
 
21
 
21
 
22
 
22
SIGNAL (SIG_OVERFLOW0)    // 8kHz
23
SIGNAL (SIG_OVERFLOW0)    // 8kHz
-
 
24
{
23
{
25
    static unsigned char cnt_1ms = 1,cnt = 0;
Line 24... Line 26...
24
    static unsigned char cnt_1ms = 1,cnt = 0;
26
    unsigned char pieper_ein = 0;
25
//    TCNT0 -= 250;//TIMER_RELOAD_VALUE;
27
//    TCNT0 -= 250;//TIMER_RELOAD_VALUE;
26
 
28
 
27
   if(!cnt--)
29
   if(!cnt--)
28
    {
30
    {
29
     cnt = 9;
31
     cnt = 9;
30
     cnt_1ms++;
32
     cnt_1ms++;
31
     cnt_1ms %= 2;
-
 
32
     if(!cnt_1ms) UpdateMotor = 1;
33
     cnt_1ms %= 2;
Line 33... Line 34...
33
     CountMilliseconds++;
34
     if(!cnt_1ms) UpdateMotor = 1;
34
     if(Timeout) Timeout--;
35
     CountMilliseconds++;
35
     }  
36
     }  
-
 
37
 
-
 
38
     if(beeptime > 1)
36
 
39
        {
-
 
40
        beeptime--;      
-
 
41
        if(beeptime & BeepMuster)
37
     if(beeptime > 1)
42
         {
38
        {
43
          pieper_ein = 1;
-
 
44
         }
-
 
45
         else pieper_ein = 0;
39
        beeptime--;
46
        }
-
 
47
     else
-
 
48
      {
Line -... Line 49...
-
 
49
       pieper_ein = 0;
-
 
50
       BeepMuster = 0xffff;
-
 
51
      }
-
 
52
 
-
 
53
 
-
 
54
     if(pieper_ein)
-
 
55
        {
-
 
56
          if(PlatinenVersion == 10) PORTD |= (1<<2); // Speaker an PORTD.2
-
 
57
          else                      PORTC |= (1<<7); // Speaker an PORTC.7
-
 
58
        }
-
 
59
     else  
40
        PORTD |= (1<<2);
60
        {
41
        }
61
         if(PlatinenVersion == 10) PORTD &= ~(1<<2);
42
     else  
62
         else                      PORTC &= ~(1<<7);
43
        PORTD &= ~(1<<2);
63
        }
44
 
64
 
Line 125... Line 145...
125
     else ServoValue -= ((long) EE_Parameter.ServoNickComp * (IntegralNick / 128)) / 512;
145
     else ServoValue -= ((long) EE_Parameter.ServoNickComp * (IntegralNick / 128)) / 512;
Line 126... Line 146...
126
     
146
     
127
     if(ServoValue < EE_Parameter.ServoNickMin) ServoValue = EE_Parameter.ServoNickMin;
147
     if(ServoValue < EE_Parameter.ServoNickMin) ServoValue = EE_Parameter.ServoNickMin;
Line 128... Line -...
128
     else if(ServoValue > EE_Parameter.ServoNickMax) ServoValue = EE_Parameter.ServoNickMax;
-
 
129
 
148
     else if(ServoValue > EE_Parameter.ServoNickMax) ServoValue = EE_Parameter.ServoNickMax;
130
     DebugOut.Analog[10] = ServoValue;    
149
 
131
     OCR2A = ServoValue;// + 75;
150
     OCR2A = ServoValue;// + 75;
132
     timer = EE_Parameter.ServoNickRefresh;
151
     timer = EE_Parameter.ServoNickRefresh;
133
    }
152
    }