Rev 2323 | Rev 2333 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2323 | Rev 2330 | ||
---|---|---|---|
Line 114... | Line 114... | ||
114 | //Hauptprogramm |
114 | //Hauptprogramm |
115 | int main (void) |
115 | int main (void) |
116 | //############################################################################ |
116 | //############################################################################ |
117 | { |
117 | { |
118 | unsigned int timer,i,timer2 = 0, timerPolling; |
118 | unsigned int timer,i,timer2 = 0, timerPolling; |
119 | - | ||
120 | DDRB = 0x00; |
119 | DDRB = 0x00; |
121 | PORTB = 0x00; |
120 | PORTB = 0x00; |
122 | DDRD = 0x0A; // UART & J3 J4 J5 |
121 | DDRD = 0x0A; // UART & J3 J4 J5 |
123 | PORTD = 0x5F; // PPM-Input & UART |
122 | PORTD = 0x5F; // PPM-Input & UART |
124 | - | ||
125 | if(GetParamByte(PID_EE_REVISION) == EEPARAM_REVISION - 50) SetParamByte(PID_EE_REVISION,EEPARAM_REVISION); // remove the EEPARAM_REVISION_SUB from Version 0.90g |
- | |
126 | - | ||
127 | for(timer = 0; timer < 1000; timer++); // verzögern |
123 | for(timer = 0; timer < 1000; timer++); // verzögern |
128 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
124 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
129 | if(PINB & 0x02) |
125 | if(PINB & 0x02) |
130 | { |
126 | { |
131 | if(PIND & 0x10) PlatinenVersion = 21; // No Bridge from J4 to GND |
127 | if(PIND & 0x10) PlatinenVersion = 21; // No Bridge from J4 to GND |
Line 133... | Line 129... | ||
133 | } |
129 | } |
134 | else |
130 | else |
135 | { |
131 | { |
136 | PlatinenVersion = 23; ACC_AltitudeControl = 1; |
132 | PlatinenVersion = 23; ACC_AltitudeControl = 1; |
137 | } |
133 | } |
138 | if(PlatinenVersion != GetParamByte(PID_HARDWARE_VERSION)) |
- | |
139 | { |
- | |
140 | SetParamByte(PID_EE_REVISION,0x00); // reset the Settings if the Version changed |
- | |
141 | SetParamByte(PID_HARDWARE_VERSION,PlatinenVersion); // Remember the Version number |
- | |
142 | } |
- | |
143 | #else |
134 | #else |
144 | if(PINB & 0x01) |
135 | if(PINB & 0x01) |
145 | { |
136 | { |
146 | if(PINB & 0x02) PlatinenVersion = 13; |
137 | if(PINB & 0x02) PlatinenVersion = 13; |
147 | else PlatinenVersion = 11; |
138 | else PlatinenVersion = 11; |
Line 184... | Line 175... | ||
184 | SPI_MasterInit(); |
175 | SPI_MasterInit(); |
185 | Capacity_Init(); |
176 | Capacity_Init(); |
186 | LIBFC_Init(LIB_FC_COMPATIBLE); |
177 | LIBFC_Init(LIB_FC_COMPATIBLE); |
187 | GRN_ON; |
178 | GRN_ON; |
188 | sei(); |
179 | sei(); |
- | 180 | ||
- | 181 | if(GetParamByte(PID_EE_REVISION) == EEPARAM_REVISION - 50) SetParamByte(PID_EE_REVISION,EEPARAM_REVISION); // remove the EEPARAM_REVISION_SUB from Version 0.90g |
|
- | 182 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
|
- | 183 | if(PlatinenVersion != GetParamByte(PID_HARDWARE_VERSION)) |
|
- | 184 | { |
|
- | 185 | if(GetParamByte(PID_HARDWARE_VERSION) == 21) SetParamByte(PID_EE_REVISION,0); // reset the Settings if the Version changed to V2.2 |
|
- | 186 | SetParamByte(PID_HARDWARE_VERSION,PlatinenVersion); // Remember the Version number |
|
- | 187 | wdt_enable(WDTO_15MS); // Reset-Commando |
|
- | 188 | printf("\n\r--> Hardware Version Byte Changed <--"); |
|
- | 189 | while(1); |
|
- | 190 | } |
|
- | 191 | #endif |
|
189 | ParamSet_Init(); |
192 | ParamSet_Init(); |
Line 190... | Line 193... | ||
190 | 193 | ||
191 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
194 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
192 | // + Check connected BL-Ctrls |
195 | // + Check connected BL-Ctrls |
Line 272... | Line 275... | ||
272 | 275 | ||
273 | Debug(ANSI_CLEAR "FC-Start!\n\rFlugzeit: %d min", FlugMinutenGesamt); // Note: this won't waste flash memory, if #DEBUG is not active |
276 | Debug(ANSI_CLEAR "FC-Start!\n\rFlugzeit: %d min", FlugMinutenGesamt); // Note: this won't waste flash memory, if #DEBUG is not active |
274 | DebugOut.Status[0] = 0x01 | 0x02; |
277 | DebugOut.Status[0] = 0x01 | 0x02; |
275 | JetiBeep = 0; |
278 | JetiBeep = 0; |
276 | if(EE_Parameter.ExtraConfig & CFG_NO_RCOFF_BEEPING) DisableRcOffBeeping = 1; |
279 | if(EE_Parameter.ExtraConfig & CFG_NO_RCOFF_BEEPING) DisableRcOffBeeping = 1; |
277 | while (1) |
280 | while(1) |
278 | { |
281 | { |
279 | if(ReceiverUpdateModeActive) while (1) PORTC &= ~(1<<7); // Beeper off |
- | |
- | 282 | if(ReceiverUpdateModeActive) while (1) PORTC &= ~(1<<7); // Beeper off |
|
280 | 283 | EEAR = EE_DUMMY; // Set the EEPROM Address pointer to an unused space |
|
281 | //GRN_ON; |
284 | //GRN_ON; |
282 | if(UpdateMotor && AdReady) // ReglerIntervall |
285 | if(UpdateMotor && AdReady) // ReglerIntervall |
283 | { |
286 | { |
284 | //GRN_OFF; |
287 | //GRN_OFF; |