Rev 2309 | Rev 2354 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2309 | Rev 2346 | ||
---|---|---|---|
Line 58... | Line 58... | ||
58 | volatile unsigned int tim_main; |
58 | volatile unsigned int tim_main; |
59 | volatile unsigned char UpdateMotor = 0; |
59 | volatile unsigned char UpdateMotor = 0; |
60 | volatile unsigned int cntKompass = 0; |
60 | volatile unsigned int cntKompass = 0; |
61 | volatile unsigned int beeptime = 0; |
61 | volatile unsigned int beeptime = 0; |
62 | volatile unsigned char SendSPI = 0, ServoActive = 0, CalculateServoSignals = 1; |
62 | volatile unsigned char SendSPI = 0, ServoActive = 0, CalculateServoSignals = 1; |
- | 63 | unsigned char JustMK3MagConnected = 0; |
|
63 | uint16_t RemainingPulse = 0; |
64 | uint16_t RemainingPulse = 0; |
64 | volatile int16_t ServoNickOffset = (255 / 2) * MULTIPLYER * 16; // initial value near center positon |
65 | volatile int16_t ServoNickOffset = (255 / 2) * MULTIPLYER * 16; // initial value near center positon |
65 | volatile int16_t ServoRollOffset = (255 / 2) * MULTIPLYER * 16; // initial value near center positon |
66 | volatile int16_t ServoRollOffset = (255 / 2) * MULTIPLYER * 16; // initial value near center positon |
Line 66... | Line 67... | ||
66 | 67 | ||
Line 83... | Line 84... | ||
83 | }; |
84 | }; |
Line 84... | Line 85... | ||
84 | 85 | ||
85 | 86 | ||
86 | ISR(TIMER0_OVF_vect) // 9,7kHz |
87 | ISR(TIMER0_OVF_vect) // 9,7kHz |
87 | { |
88 | { |
88 | static unsigned char cnt_1ms = 1,cnt = 0, compass_active = 0; |
89 | static unsigned char cnt_1ms = 1,cnt = 0; |
89 | unsigned char pieper_ein = 0; |
90 | unsigned char pieper_ein = 0; |
90 | if(SendSPI) SendSPI--; |
91 | if(SendSPI) SendSPI--; |
91 | if(SpektrumTimer) SpektrumTimer--; |
92 | if(SpektrumTimer) SpektrumTimer--; |
Line 95... | Line 96... | ||
95 | CountMilliseconds++; |
96 | CountMilliseconds++; |
96 | cnt_1ms++; |
97 | cnt_1ms++; |
97 | cnt_1ms %= 2; |
98 | cnt_1ms %= 2; |
Line 98... | Line 99... | ||
98 | 99 | ||
99 | if(!cnt_1ms) UpdateMotor = 1; |
100 | if(!cnt_1ms) UpdateMotor = 1; |
Line 100... | Line 101... | ||
100 | if(!(PINC & 0x10)) compass_active = 1; |
101 | if(!(PINC & 0x10)) JustMK3MagConnected = 1; |
101 | 102 | ||
102 | if(beeptime) |
103 | if(beeptime) |
103 | { |
104 | { |
Line 127... | Line 128... | ||
127 | if(PlatinenVersion == 10) PORTD &= ~(1<<2); |
128 | if(PlatinenVersion == 10) PORTD &= ~(1<<2); |
128 | else PORTC &= ~(1<<7); |
129 | else PORTC &= ~(1<<7); |
129 | } |
130 | } |
130 | #endif |
131 | #endif |
131 | } |
132 | } |
132 | if(compass_active && !NaviDataOkay && Parameter_GlobalConfig & CFG_KOMPASS_AKTIV) |
133 | if(JustMK3MagConnected && !NaviDataOkay && Parameter_GlobalConfig & CFG_KOMPASS_AKTIV) |
133 | { |
134 | { |
134 | if(PINC & 0x10) |
135 | if(PINC & 0x10) |
135 | { |
136 | { |
136 | if(++cntKompass > 1000) compass_active = 0; |
137 | if(++cntKompass > 1000) JustMK3MagConnected = 0; |
137 | } |
138 | } |
138 | else |
139 | else |
139 | { |
140 | { |
140 | if((cntKompass) && (cntKompass < 362)) |
141 | if((cntKompass) && (cntKompass < 362)) |
141 | { |
142 | { |