Rev 1868 | Rev 1870 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1868 | Rev 1869 | ||
---|---|---|---|
Line 214... | Line 214... | ||
214 | LCD_Clear(); |
214 | LCD_Clear(); |
Line 215... | Line 215... | ||
215 | 215 | ||
Line 216... | Line 216... | ||
216 | I2CTimeout = 5000; |
216 | I2CTimeout = 5000; |
217 | 217 | ||
218 | while (1) { |
218 | while (1) { |
Line -... | Line 219... | ||
- | 219 | if (runFlightControl) { // control interval |
|
- | 220 | runFlightControl = 0; // reset Flag, is enabled every 2 ms by ISR of timer0 |
|
- | 221 | ||
- | 222 | DebugOut.Digital[0] &= ~DEBUG_MAINLOOP_TIMER; |
|
219 | if (runFlightControl && analogDataReady) { // control interval |
223 | DebugOut.Digital[1] &= ~DEBUG_MAINLOOP_TIMER; |
220 | runFlightControl = 0; // reset Flag, is enabled every 2 ms by ISR of timer0 |
224 | |
221 | 225 | if (analogDataReady) { |
|
Line 222... | Line 226... | ||
222 | //J4HIGH; |
226 | J4HIGH; |
223 | flight_control(); |
227 | flight_control(); |
224 | //J4LOW; |
228 | J4LOW; |
225 | 229 | ||
Line 273... | Line 277... | ||
273 | } |
277 | } |
Line 274... | Line 278... | ||
274 | 278 | ||
275 | // Allow Serial Data Transmit if motors must not updated or motors are not running |
279 | // Allow Serial Data Transmit if motors must not updated or motors are not running |
276 | if (!runFlightControl || !(MKFlags & MKFLAG_MOTOR_RUN)) { |
280 | if (!runFlightControl || !(MKFlags & MKFLAG_MOTOR_RUN)) { |
- | 281 | usart0_TransmitTxData(); |
|
- | 282 | } else { |
|
277 | usart0_TransmitTxData(); |
283 | DebugOut.Digital[1] |= DEBUG_MAINLOOP_TIMER; |
Line 278... | Line 284... | ||
278 | } |
284 | } |
Line 279... | Line 285... | ||
279 | 285 | ||
Line 304... | Line 310... | ||
304 | // and therefore the time of transmission of a complete spi-packet (32 bytes) is 32*4/9.765 kHz = 13.1 ms. |
310 | // and therefore the time of transmission of a complete spi-packet (32 bytes) is 32*4/9.765 kHz = 13.1 ms. |
305 | SPI_TransmitByte(); |
311 | SPI_TransmitByte(); |
306 | } |
312 | } |
307 | #endif |
313 | #endif |
308 | } |
314 | } |
- | 315 | } |
|
309 | return (1); |
316 | return (1); |
310 | } |
317 | } |