Rev 1870 | Rev 1887 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1870 | Rev 1872 | ||
---|---|---|---|
Line 216... | Line 216... | ||
216 | I2CTimeout = 5000; |
216 | I2CTimeout = 5000; |
Line 217... | Line 217... | ||
217 | 217 | ||
218 | while (1) { |
218 | while (1) { |
219 | if (runFlightControl) { // control interval |
219 | if (runFlightControl) { // control interval |
- | 220 | runFlightControl = 0; // reset Flag, is enabled every 2 ms by ISR of timer0 |
|
- | 221 | if (!analogDataReady) { |
|
- | 222 | DebugOut.Digital[0] |= DEBUG_MAINLOOP_TIMER; |
|
- | 223 | } else { |
|
Line 220... | Line -... | ||
220 | runFlightControl = 0; // reset Flag, is enabled every 2 ms by ISR of timer0 |
- | |
221 | - | ||
222 | DebugOut.Digital[0] &= ~DEBUG_MAINLOOP_TIMER; |
- | |
223 | DebugOut.Digital[1] &= ~DEBUG_MAINLOOP_TIMER; |
- | |
224 | 224 | DebugOut.Digital[0] &= ~DEBUG_MAINLOOP_TIMER; |
|
225 | if (analogDataReady) { |
225 | |
226 | // J4HIGH; |
226 | J4HIGH; |
Line 227... | Line -... | ||
227 | flight_control(); |
- | |
228 | // J4LOW; |
- | |
229 | - | ||
230 | /* |
- | |
231 | * If the motors are running (MKFlags & MKFLAG_MOTOR_RUN in flight.c), transmit |
- | |
232 | * the throttle vector just computed. Otherwise, if motor test is engaged, transmit |
- | |
233 | * the test throttle vector. If no testing, stop all motors. |
- | |
234 | */ |
- | |
235 | // Obsoleted. |
- | |
236 | // transmitMotorThrottleData(); |
- | |
237 | - | ||
238 | RED_OFF; |
- | |
239 | - | ||
240 | /* |
- | |
241 | Does not belong here. Instead, external control should be ignored in |
- | |
242 | controlMixer if there was no new data from there for some time. |
- | |
243 | if(externalControlActive) externalControlActive--; |
- | |
244 | else { |
- | |
245 | externalControl.config = 0; |
- | |
246 | externalStickPitch = 0; |
- | |
247 | externalStickRoll = 0; |
- | |
248 | externalStickYaw = 0; |
- | |
249 | } |
- | |
250 | */ |
- | |
251 | - | ||
252 | /* |
- | |
253 | Does not belong here. |
- | |
254 | if(RC_Quality) RC_Quality--; |
- | |
255 | */ |
- | |
256 | - | ||
257 | /* Does not belong here. Well since we are not supporting navi right now anyway, leave out. |
- | |
258 | #ifdef USE_NAVICTRL |
- | |
259 | if(NCDataOkay) { |
- | |
260 | if(--NCDataOkay == 0) // no data from NC |
- | |
261 | { // set gps control sticks neutral |
- | |
262 | GPSStickPitch = 0; |
- | |
263 | GPSStickRoll = 0; |
- | |
264 | NCSerialDataOkay = 0; |
- | |
265 | } |
- | |
266 | } |
227 | flight_control(); |
267 | #endif |
228 | J4LOW; |
268 | */ |
229 | |
269 | if (!--I2CTimeout || missingMotor) { // try to reset the i2c if motor is missing ot timeout |
230 | if (!--I2CTimeout || missingMotor) { // try to reset the i2c if motor is missing or timeout |
270 | RED_ON; |
231 | RED_ON; |
271 | if (!I2CTimeout) { |
232 | if (!I2CTimeout) { |
Line 277... | Line 238... | ||
277 | } |
238 | } |
Line 278... | Line 239... | ||
278 | 239 | ||
279 | // Allow Serial Data Transmit if motors must not updated or motors are not running |
240 | // Allow Serial Data Transmit if motors must not updated or motors are not running |
280 | if (!runFlightControl || !(MKFlags & MKFLAG_MOTOR_RUN)) { |
241 | if (!runFlightControl || !(MKFlags & MKFLAG_MOTOR_RUN)) { |
281 | usart0_TransmitTxData(); |
- | |
282 | } else { |
- | |
283 | DebugOut.Digital[1] |= DEBUG_MAINLOOP_TIMER; |
242 | usart0_TransmitTxData(); |
Line 284... | Line 243... | ||
284 | } |
243 | } |
Line 285... | Line 244... | ||
285 | 244 |