Subversion Repositories FlightCtrl

Rev

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

Rev 108 Rev 136
Line 4... Line 4...
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
int ServoValue = 0;
8
int ServoValue = 0;
-
 
9
//Salvo 8.9.2007
-
 
10
volatile unsigned int Kompass_Neuer_Wert= 0;
-
 
11
volatile unsigned int Kompass_Value_Old = 0;
9
 
12
// Salvo End
10
enum {
13
enum {
11
  STOP             = 0,
14
  STOP             = 0,
12
  CK               = 1,
15
  CK               = 1,
13
  CK8              = 2,
16
  CK8              = 2,
14
  CK64             = 3,
17
  CK64             = 3,
Line 40... Line 43...
40
        PORTD |= (1<<2);
43
        PORTD |= (1<<2);
41
        }
44
        }
42
     else  
45
     else  
43
        PORTD &= ~(1<<2);
46
        PORTD &= ~(1<<2);
Line 44... Line 47...
44
 
47
 
45
 if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV)
48
// if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV)
46
 {
49
 {
47
  if(PINC & 0x10)
50
  if(PINC & 0x10)
48
   {
51
   {
49
    cntKompass++;
52
    cntKompass++;
50
   }
53
   }
51
  else
54
  else
52
   {
55
   {
53
    if((cntKompass) && (cntKompass < 4000))
56
    if((cntKompass) && (cntKompass < 4000))
54
    {
57
    {
-
 
58
// Salvo Kompassoffset 30.8.2007 ***********
55
// Salvo Kompassoffset 30.8.2007 ***********
59
        Kompass_Value_Old       =       KompassValue;
Line 56... Line 60...
56
     KompassValue = cntKompass -KOMPASS_OFFSET;
60
     KompassValue = cntKompass -KOMPASS_OFFSET;
57
 
61
 
58
         if (KompassValue < 0)
62
         if (KompassValue < 0)
Line 66... Line 70...
66
 // Salvo End  
70
 // Salvo End  
67
    }
71
    }
68
//     if(cntKompass < 10) cntKompass = 10;
72
//     if(cntKompass < 10) cntKompass = 10;
69
//     KompassValue = (unsigned long)((unsigned long)(cntKompass-10)*720L + 1L) / 703L;
73
//     KompassValue = (unsigned long)((unsigned long)(cntKompass-10)*720L + 1L) / 703L;
70
     KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
74
     KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180;
-
 
75
         Kompass_Neuer_Wert     = 1;
71
    cntKompass = 0;
76
     cntKompass = 0;
72
   }
77
   }
73
 }
78
 }
74
}
79
}