Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 1871 → Rev 1872

/branches/dongfang_FC_rewrite/main.c
218,55 → 218,16
while (1) {
if (runFlightControl) { // control interval
runFlightControl = 0; // reset Flag, is enabled every 2 ms by ISR of timer0
if (!analogDataReady) {
DebugOut.Digital[0] |= DEBUG_MAINLOOP_TIMER;
} else {
DebugOut.Digital[0] &= ~DEBUG_MAINLOOP_TIMER;
 
DebugOut.Digital[0] &= ~DEBUG_MAINLOOP_TIMER;
DebugOut.Digital[1] &= ~DEBUG_MAINLOOP_TIMER;
 
if (analogDataReady) {
// J4HIGH;
J4HIGH;
flight_control();
// J4LOW;
J4LOW;
 
/*
* If the motors are running (MKFlags & MKFLAG_MOTOR_RUN in flight.c), transmit
* the throttle vector just computed. Otherwise, if motor test is engaged, transmit
* the test throttle vector. If no testing, stop all motors.
*/
// Obsoleted.
// transmitMotorThrottleData();
 
RED_OFF;
 
/*
Does not belong here. Instead, external control should be ignored in
controlMixer if there was no new data from there for some time.
if(externalControlActive) externalControlActive--;
else {
externalControl.config = 0;
externalStickPitch = 0;
externalStickRoll = 0;
externalStickYaw = 0;
}
*/
 
/*
Does not belong here.
if(RC_Quality) RC_Quality--;
*/
 
/* Does not belong here. Well since we are not supporting navi right now anyway, leave out.
#ifdef USE_NAVICTRL
if(NCDataOkay) {
if(--NCDataOkay == 0) // no data from NC
{ // set gps control sticks neutral
GPSStickPitch = 0;
GPSStickRoll = 0;
NCSerialDataOkay = 0;
}
}
#endif
*/
if (!--I2CTimeout || missingMotor) { // try to reset the i2c if motor is missing ot timeout
if (!--I2CTimeout || missingMotor) { // try to reset the i2c if motor is missing or timeout
RED_ON;
if (!I2CTimeout) {
I2C_Reset();
279,8 → 240,6
// Allow Serial Data Transmit if motors must not updated or motors are not running
if (!runFlightControl || !(MKFlags & MKFLAG_MOTOR_RUN)) {
usart0_TransmitTxData();
} else {
DebugOut.Digital[1] |= DEBUG_MAINLOOP_TIMER;
}
 
usart0_ProcessRxData();