Rev 2263 | Rev 2316 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2263 | Rev 2309 | ||
---|---|---|---|
Line 79... | Line 79... | ||
79 | // WinkelOut.CalcState = 0; // in Uart.c |
79 | // WinkelOut.CalcState = 0; // in Uart.c |
80 | beeptime = 1000; |
80 | beeptime = 1000; |
81 | } |
81 | } |
82 | else Piep(WinkelOut.CalcState,150); |
82 | else Piep(WinkelOut.CalcState,150); |
83 | } |
83 | } |
84 | DebugOut.Analog[19] = WinkelOut.CalcState; |
- | |
85 | } |
84 | } |
Line 86... | Line 85... | ||
86 | 85 | ||
87 | 86 | ||
Line 118... | Line 117... | ||
118 | { |
117 | { |
119 | unsigned int timer,i,timer2 = 0, timerPolling; |
118 | unsigned int timer,i,timer2 = 0, timerPolling; |
Line 120... | Line 119... | ||
120 | 119 | ||
121 | DDRB = 0x00; |
120 | DDRB = 0x00; |
- | 121 | PORTB = 0x00; |
|
- | 122 | DDRD = 0x0A; // UART & J3 J4 J5 |
|
122 | PORTB = 0x00; |
123 | PORTD = 0x5F; // PPM-Input & UART |
123 | for(timer = 0; timer < 1000; timer++); // verzögern |
124 | for(timer = 0; timer < 1000; timer++); // verzögern |
- | 125 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
|
124 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
126 | if(PINB & 0x02) |
125 | 127 | { |
|
- | 128 | if(PIND & 0x10) PlatinenVersion = 21; // No Bridge from J4 to GND |
|
- | 129 | else { PlatinenVersion = 22; ACC_AltitudeControl = 1;}; |
|
126 | if(PINB & 0x02) PlatinenVersion = 21; |
130 | } |
127 | else |
131 | else |
128 | { |
132 | { |
129 | PlatinenVersion = 22; |
- | |
130 | // ACC_AMPLIFY = 7; // der ACC-Sensor hat etwa 16% weniger Ausschlag |
133 | PlatinenVersion = 23; ACC_AltitudeControl = 1; |
Line 131... | Line 134... | ||
131 | } |
134 | } |
132 | 135 | ||
133 | #else |
136 | #else |
Line 137... | Line 140... | ||
137 | else PlatinenVersion = 11; |
140 | else PlatinenVersion = 11; |
138 | } |
141 | } |
139 | else |
142 | else |
140 | { |
143 | { |
141 | if(PINB & 0x02) PlatinenVersion = 20; |
144 | if(PINB & 0x02) PlatinenVersion = 20; |
- | 145 | else |
|
- | 146 | { |
|
142 | else PlatinenVersion = 10; |
147 | PlatinenVersion = 10; |
- | 148 | DDRD = 0x3E; // Speaker & TXD & J3 J4 J5 |
|
- | 149 | PORTD = 0x47; // |
|
143 | } |
150 | } |
- | 151 | } |
|
- | 152 | ||
144 | #endif |
153 | #endif |
145 | DDRC = 0x81; // SCL |
154 | DDRC = 0x81; // I2C, Spaker |
146 | DDRC |=0x40; // HEF4017 Reset |
155 | DDRC |=0x40; // HEF4017 Reset |
147 | PORTC = 0xff; // Pullup SDA |
156 | PORTC = 0xff; // Pullup SDA |
148 | DDRB = 0x1B; // LEDs und Druckoffset |
157 | DDRB = 0x1B; // LEDs und Druckoffset |
149 | PORTB = 0x01; // LED_Rot |
158 | PORTB = 0x01; // LED_Rot |
150 | DDRD = 0x3E; // Speaker & TXD & J3 J4 J5 |
- | |
151 | PORTD = 0x47; // LED |
- | |
- | 159 | ||
152 | HEF4017Reset_ON; |
160 | HEF4017Reset_ON; |
153 | MCUSR &=~(1<<WDRF); |
161 | MCUSR &=~(1<<WDRF); |
154 | WDTCSR |= (1<<WDCE)|(1<<WDE); |
162 | WDTCSR |= (1<<WDCE)|(1<<WDE); |
155 | WDTCSR = 0; |
163 | WDTCSR = 0; |
Line 166... | Line 174... | ||
166 | rc_sum_init(); |
174 | rc_sum_init(); |
167 | ADC_Init(); |
175 | ADC_Init(); |
168 | I2C_Init(1); |
176 | I2C_Init(1); |
169 | SPI_MasterInit(); |
177 | SPI_MasterInit(); |
170 | Capacity_Init(); |
178 | Capacity_Init(); |
171 | LIBFC_Init(); |
179 | LIBFC_Init(LIB_FC_COMPATIBLE); |
172 | GRN_ON; |
180 | GRN_ON; |
173 | sei(); |
181 | sei(); |
174 | ParamSet_Init(); |
182 | ParamSet_Init(); |
Line 175... | Line -... | ||
175 | - | ||
176 | 183 | ||
177 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
184 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
178 | // + Check connected BL-Ctrls |
185 | // + Check connected BL-Ctrls |
179 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
186 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
180 | // Check connected BL-Ctrls |
187 | // Check connected BL-Ctrls |
Line 399... | Line 406... | ||
399 | // Sekundentakt |
406 | // Sekundentakt |
400 | if(++second == 49) |
407 | if(++second == 49) |
401 | { |
408 | { |
402 | second = 0; |
409 | second = 0; |
403 | if(FC_StatusFlags & FC_STATUS_FLY) FlugSekunden++; |
410 | if(FC_StatusFlags & FC_STATUS_FLY) FlugSekunden++; |
- | 411 | else timer2 = 1450; // 0,5 Minuten aufrunden |
|
404 | else |
412 | if(modell_fliegt < 1024) |
405 | { |
413 | { |
406 | timer2 = 1450; // 0,5 Minuten aufrunden |
- | |
407 | if(StartLuftdruck < Luftdruck) StartLuftdruck++; |
414 | if(StartLuftdruck < Luftdruck) StartLuftdruck += 5; |
408 | else |
415 | else |
409 | if(StartLuftdruck > Luftdruck) StartLuftdruck--; |
416 | if(StartLuftdruck > Luftdruck) StartLuftdruck -= 5; |
410 | } |
417 | } |
411 | } |
418 | } |
412 | // +++++++++++++++++++++++++++++++++ |
419 | // +++++++++++++++++++++++++++++++++ |
413 | if(++timer2 == 2930) // eine Minute |
420 | if(++timer2 == 2930) // eine Minute |
414 | { |
421 | { |