Rev 1002 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1002 | Rev 1003 | ||
---|---|---|---|
Line 8... | Line 8... | ||
8 | volatile unsigned char SendSPI = 0; |
8 | volatile unsigned char SendSPI = 0; |
9 | volatile unsigned int ServoState = 40; |
9 | volatile unsigned int ServoState = 40; |
Line 10... | Line 10... | ||
10 | 10 | ||
11 | unsigned int BeepMuster = 0xffff; |
11 | unsigned int BeepMuster = 0xffff; |
- | 12 | unsigned int ServoValue = 0; |
|
- | 13 | //Salvo 8.9.2007 |
|
- | 14 | volatile uint8_t Kompass_Neuer_Wert= 0; |
|
- | 15 | volatile unsigned int Kompass_Value_Old = 0; |
|
- | 16 | // Salvo End |
|
- | 17 | //Salvo 21.9.2007 |
|
12 | unsigned int ServoValue = 0; |
18 | short unsigned int Kompass_present= 0; //>0 bedeutet dass der Kompass vorhanden ist |
13 | 19 | // Salvo End |
|
14 | enum { |
20 | enum { |
15 | STOP = 0, |
21 | STOP = 0, |
16 | CK = 1, |
22 | CK = 1, |
17 | CK8 = 2, |
23 | CK8 = 2, |
Line 20... | Line 26... | ||
20 | CK1024 = 5, |
26 | CK1024 = 5, |
21 | T0_FALLING_EDGE = 6, |
27 | T0_FALLING_EDGE = 6, |
22 | T0_RISING_EDGE = 7 |
28 | T0_RISING_EDGE = 7 |
23 | }; |
29 | }; |
Line -... | Line 30... | ||
- | 30 | ||
- | 31 | // Aenderungen von Peter Muehlenbrock ("Salvo") Stand 24.12.2007 |
|
- | 32 | /* |
|
24 | 33 | Ersatzkompass abgeleitet aus Magnetkompass und Giergyro fuer nahezu neigungsubhaengige Kompassfunktion |
|
25 | 34 | */ |
|
26 | SIGNAL (SIG_OVERFLOW0) // 8kHz |
35 | SIGNAL (SIG_OVERFLOW0) // 8kHz |
27 | { |
36 | { |
28 | static unsigned char cnt_1ms = 1,cnt = 0; |
37 | static unsigned char cnt_1ms = 1,cnt = 0; |
29 | unsigned char pieper_ein = 0; |
38 | unsigned char pieper_ein = 0; |
30 | // TCNT0 -= 250;//TIMER_RELOAD_VALUE; |
39 | // TCNT0 -= 250;//TIMER_RELOAD_VALUE; |
31 | if(SendSPI) SendSPI--; |
40 | if(SendSPI) SendSPI--; |
32 | if(!cnt--) |
41 | if(!cnt--) |
- | 42 | { |
|
33 | { |
43 | if (Kompass_present > 0) Kompass_present--; //Runterzaehlen. Wenn 0 ist der Kompass nicht vorhanden |
34 | cnt = 9; |
44 | cnt = 9; |
35 | cnt_1ms++; |
45 | cnt_1ms++; |
36 | cnt_1ms %= 2; |
46 | cnt_1ms %= 2; |
37 | if(!cnt_1ms) UpdateMotor = 1; |
47 | if(!cnt_1ms) UpdateMotor = 1; |
Line 63... | Line 73... | ||
63 | { |
73 | { |
64 | if(PlatinenVersion == 10) PORTD &= ~(1<<2); |
74 | if(PlatinenVersion == 10) PORTD &= ~(1<<2); |
65 | else PORTC &= ~(1<<7); |
75 | else PORTC &= ~(1<<7); |
66 | } |
76 | } |
Line 67... | Line 77... | ||
67 | 77 | ||
68 | if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV) |
78 | if(EE_Parameter.GlobalConfig & CFG_KOMPASS_AKTIV) //Salvo 25.10.2008 |
69 | { |
79 | { |
70 | if(PINC & 0x10) |
80 | if(PINC & 0x10) |
71 | { |
81 | { |
72 | cntKompass++; |
82 | cntKompass++; |
Line 75... | Line 85... | ||
75 | { |
85 | { |
76 | if((cntKompass) && (cntKompass < 362)) |
86 | if((cntKompass) && (cntKompass < 362)) |
77 | { |
87 | { |
78 | cntKompass += cntKompass / 41; |
88 | cntKompass += cntKompass / 41; |
79 | if(cntKompass > 10) KompassValue = cntKompass - 10; else KompassValue = 0; |
89 | if(cntKompass > 10) KompassValue = cntKompass - 10; else KompassValue = 0; |
- | 90 | // Salvo Kompassoffset 23.12.2007 *********** |
|
- | 91 | Kompass_present = 255; |
|
- | 92 | // Kompass_Value_Old = KompassValue; |
|
- | 93 | if (KOMPASS_OFFSET > 0) KompassValue = cntKompass -KOMPASS_OFFSET; |
|
- | 94 | else KompassValue = cntKompass - ((int) (Parameter_UserParam4*2)); |
|
- | 95 | ||
- | 96 | if (KompassValue < 0) |
|
- | 97 | { |
|
- | 98 | KompassValue += 360; |
|
- | 99 | } |
|
- | 100 | if (KompassValue >= 360) |
|
- | 101 | { |
|
- | 102 | KompassValue -= 360; |
|
- | 103 | } |
|
- | 104 | // Salvo End |
|
80 | } |
105 | } |
81 | // if(cntKompass < 10) cntKompass = 10; |
106 | // if(cntKompass < 10) cntKompass = 10; |
82 | // KompassValue = (unsigned long)((unsigned long)(cntKompass-10)*720L + 1L) / 703L; |
107 | // KompassValue = (unsigned long)((unsigned long)(cntKompass-10)*720L + 1L) / 703L; |
83 | KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180; |
108 | KompassRichtung = ((540 + KompassValue - KompassStartwert) % 360) - 180; |
- | 109 | //Salvo 13.9.2007 Ok Erkennung des Magnetkompasses |
|
- | 110 | Kompass_Neuer_Wert = 1; |
|
- | 111 | // Salvo End |
|
84 | cntKompass = 0; |
112 | cntKompass = 0; |
85 | } |
113 | } |
86 | } |
114 | } |
87 | } |
115 | } |
Line 88... | Line 116... | ||
88 | 116 |