Rev 2380 | Rev 2403 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2380 | Rev 2386 | ||
---|---|---|---|
Line 57... | Line 57... | ||
57 | volatile unsigned int CountMilliseconds = 0; |
57 | volatile unsigned int CountMilliseconds = 0; |
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 BytegapSPI = 0, ServoActive = 0, CalculateServoSignals = 1; |
63 | unsigned char JustMK3MagConnected = 0; |
63 | unsigned char JustMK3MagConnected = 0; |
64 | uint16_t RemainingPulse = 0; |
64 | uint16_t RemainingPulse = 0; |
65 | 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 |
66 | 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 86... | Line 86... | ||
86 | 86 | ||
87 | ISR(TIMER0_OVF_vect) // 9,7kHz |
87 | ISR(TIMER0_OVF_vect) // 9,7kHz |
88 | { |
88 | { |
89 | static unsigned char cnt_1ms = 1,cnt = 0; |
89 | static unsigned char cnt_1ms = 1,cnt = 0; |
90 | unsigned char pieper_ein = 0; |
90 | unsigned char pieper_ein = 0; |
91 | if(SendSPI) SendSPI--; |
91 | if(BytegapSPI) BytegapSPI--; |
92 | if(SpektrumTimer) SpektrumTimer--; |
92 | if(SpektrumTimer) SpektrumTimer--; |
93 | if(!cnt--) |
93 | if(!cnt--) |
94 | { |
94 | { |
95 | cnt = 9; |
95 | cnt = 9; |
96 | CountMilliseconds++; |
96 | CountMilliseconds++; |
97 | cnt_1ms++; |
97 | cnt_1ms++; |
Line 98... | Line 98... | ||
98 | cnt_1ms %= 2; |
98 | cnt_1ms %= 2; |
99 | 99 | ||
Line 100... | Line 100... | ||
100 | if(!cnt_1ms) UpdateMotor = 1; |
100 | if(!cnt_1ms) if(UpdateMotor < 4) UpdateMotor++; |
101 | if(!(PINC & 0x10)) JustMK3MagConnected = 1; |
101 | if(!(PINC & 0x10)) JustMK3MagConnected = 1; |
102 | 102 |