128,7 → 128,8 |
|
int16_t main (void) |
{ |
unsigned int timer; |
uint16_t timer; |
uint8_t i; |
|
// disable interrupts global |
cli(); |
173,6 → 174,7 |
// enable interrupts global |
sei(); |
|
printf("\n\r==================================="); |
printf("\n\rFlightControl"); |
printf("\n\rHardware: %d.%d", BoardRelease/10, BoardRelease%10); |
if(CPUType == ATMEGA644P) |
180,12 → 182,34 |
else |
printf("\r\n CPU: Atmega644"); |
printf("\n\rSoftware: V%d.%d%c",VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH + 'a'); |
printf("\n\r=============================="); |
printf("\n\r==================================="); |
GRN_ON; |
|
// Parameter Set handling |
ParamSet_Init(); |
|
// Check connected BL-Ctrls |
printf("\n\rFound BL-Ctrl: "); |
motor_read = 0; |
UpdateMotor = 0; |
SendMotorData(); |
while(!UpdateMotor); |
motor_read = 0; // read the first I2C-Data |
for(i = 0; i < MAX_MOTORS; i++) |
{ |
UpdateMotor = 0; |
SendMotorData(); |
while(!UpdateMotor); |
if(Motor[i].Present) printf("%d ",i+1); |
} |
for(i = 0; i < MAX_MOTORS; i++) |
{ |
if(!Motor[i].Present && Mixer.Motor[i][MIX_GAS] > 0) printf("\n\r\n\r!! MISSING BL-CTRL: %d !!",i+1); |
Motor[i].Error = 0; |
} |
printf("\n\r==================================="); |
|
|
if(GetParamWord(PID_ACC_NICK) > 1023) |
{ |
printf("\n\rACC not calibrated!"); |
238,7 → 262,7 |
|
printf("\n\rControl: "); |
if (ParamSet.GlobalConfig & CFG_HEADING_HOLD) printf("HeadingHold"); |
else printf("Neutral"); |
else printf("Neutral (ACC-Mode)"); |
|
printf("\n\n\r"); |
|
269,10 → 293,27 |
ExternStickYaw = 0; |
} |
if(RC_Quality) RC_Quality--; |
if(!I2CTimeout) |
|
#ifdef USE_NAVICTRL |
if(NCDataOkay) |
{ |
I2CTimeout = 5; |
I2C_Reset(); |
if(--NCDataOkay == 0) // no data from NC |
{ // set gps control sticks neutral |
GPSStickNick = 0; |
GPSStickRoll = 0; |
NCSerialDataOkay = 0; |
} |
} |
#endif |
|
if(!--I2CTimeout || MissingMotor) // try to reset the i2c if motor is missing ot timeout |
{ |
RED_ON; |
if(!I2CTimeout) |
{ |
I2C_Reset(); |
I2CTimeout = 5; |
} |
if((BeepModulation == 0xFFFF) && (MKFlags & MKFLAG_MOTOR_RUN) ) |
{ |
BeepTime = 10000; // 1 second |
281,7 → 322,6 |
} |
else |
{ |
I2CTimeout--; |
RED_OFF; |
} |
|
310,7 → 350,6 |
} |
|
LED_Update(); |
//J4LOW; |
} |
|
#ifdef USE_NAVICTRL |