Subversion Repositories FlightCtrl

Rev

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

Rev 1232 Rev 1320
Line 1... Line 1...
1
#include "main.h"
1
#include "main.h"
-
 
2
#include "spectrum.h"
Line 2... Line 3...
2
 
3
 
3
volatile unsigned int CountMilliseconds = 0;
4
volatile unsigned int CountMilliseconds = 0;
4
volatile static unsigned int tim_main;
5
volatile static unsigned int tim_main;
5
volatile unsigned char UpdateMotor = 0;
6
volatile unsigned char UpdateMotor = 0;
Line 28... Line 29...
28
 
29
 
29
SIGNAL (SIG_OVERFLOW0)    // 8kHz
30
SIGNAL (SIG_OVERFLOW0)    // 8kHz
30
{
31
{
31
    static unsigned char cnt_1ms = 1,cnt = 0;
32
    static unsigned char cnt_1ms = 1,cnt = 0;
32
    unsigned char pieper_ein = 0;
-
 
33
//    TCNT0 -= 250;//TIMER_RELOAD_VALUE;
33
    unsigned char pieper_ein = 0;
-
 
34
   if(SendSPI) SendSPI--;
-
 
35
   if(SpektrumTimer) SpektrumTimer--;
34
   if(SendSPI) SendSPI--;
36
 
35
   if(!cnt--)
37
   if(!cnt--)
36
    {
38
    {
37
     cnt = 9;
39
     cnt = 9;
38
     cnt_1ms++;
40
     cnt_1ms++;
Line 78... Line 80...
78
    if((cntKompass) && (cntKompass < 362))
80
    if((cntKompass) && (cntKompass < 362))
79
    {
81
    {
80
     cntKompass += cntKompass / 41;
82
     cntKompass += cntKompass / 41;
81
     if(cntKompass > 10) KompassValue = cntKompass - 10; else KompassValue = 0;
83
     if(cntKompass > 10) KompassValue = cntKompass - 10; else KompassValue = 0;
82
    }
84
    }
83
//     if(cntKompass < 10) cntKompass = 10;
85
//     if(cntKompass < 10) cntKompass =r 10;
84
//     KompassValue = (unsigned long)((unsigned long)(cntKompass-10)*720L + 1L) / 703L;
86
//     KompassValue = (unsigned long)((unsigned long)(cntKompass-10)*720L + 1L) / 703L;
85
     KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
87
     KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
86
    cntKompass = 0;
88
    cntKompass = 0;
87
   }
89
   }
88
 }
90
 }
-
 
91
 
89
}
92
}
Line 90... Line 93...
90
 
93