19,6 → 19,7 |
|
int16_t main(void) { |
uint16_t timer; |
static uint8_t profileTimer; |
|
// disable interrupts global |
cli(); |
115,6 → 116,7 |
while (1) { |
if (runFlightControl) { // control interval |
runFlightControl = 0; // reset Flag, is enabled every 2 ms by ISR of timer0 |
|
if (!analogDataReady) { |
// Analog data should have been ready but is not!! |
debugOut.digital[0] |= DEBUG_MAINLOOP_TIMER; |
156,7 → 158,7 |
#ifdef DO_PROFILE |
stopProfileTimer(FLIGHT); |
#endif |
|
|
// Allow Serial Data Transmit if motors must not updated or motors are not running |
if (!runFlightControl || !isFlying) { |
usart0_transmitTxData(); |
174,26 → 176,18 |
beepBatteryAlarm(); |
} |
} |
calculateFeaturedServoValues(); |
timer = setDelay(20); // every 20 ms |
} |
|
output_update(); |
|
if (runFlightControl) { // Time for the next iteration was up before the current finished. Signal error. |
debugOut.digital[1] |= DEBUG_MAINLOOP_TIMER; |
} else { |
debugOut.digital[1] &= ~DEBUG_MAINLOOP_TIMER; |
} |
} |
|
calculateFeaturedServoValues(); |
|
if (runFlightControl) { // Time for the next iteration was up before the current finished. Signal error. |
debugOut.digital[1] |= DEBUG_MAINLOOP_TIMER; |
} else { |
debugOut.digital[1] &= ~DEBUG_MAINLOOP_TIMER; |
} |
|
#ifdef DO_PROFILE |
static uint8_t profileTimer; |
if (profileTimer++ == 0) { |
debugProfileTimers(24); |
} |
#endif |
|
} |
return (1); |
} |