Subversion Repositories FlightCtrl

Compare Revisions

Ignore whitespace Rev 935 → Rev 936

/branches/V0.70d Code Redesign killagreg/main.c
98,12 → 98,16
DDRB = 0x00;
PORTB = 0x00;
for(timer = 0; timer < 1000; timer++); // make some delay
if(PINB & (1<<PINB0)) BoardRelease = 11;
if(PINB & (1<<PINB0))
{
if(PINB & (1<<PINB1)) BoardRelease = 13;
else BoardRelease = 11;
}
else BoardRelease = 10;
 
// set LED ports as output
DDRB |= (1<<DDB1)|(1<<DDB0);
ROT_ON;
RED_ON;
GRN_OFF;
 
// disable watchdog
118,10 → 122,10
StickRoll = 0;
StickNick = 0;
 
ROT_OFF;
RED_OFF;
 
// initalize modules
LED_Init();
//LED_Init(); Is done within ParamSet_Init() below
TIMER0_Init();
TIMER2_Init();
USART0_Init();
152,6 → 156,7
VersionInfo.Major = VERSION_MAJOR;
VersionInfo.Minor = VERSION_MINOR;
VersionInfo.PCCompatible = VERSION_COMPATIBLE;
VersionInfo.Hardware = 1; // Flight Control
 
printf("\n\rFlightControl\n\rHardware:%d.%d\n\rSoftware:V%d.%d%c ",BoardRelease/10,BoardRelease%10, VERSION_MAJOR, VERSION_MINOR,VERSION_INDEX + 'a');
printf("\n\r==============================");
211,7 → 216,7
 
SetNeutral();
 
ROT_OFF;
RED_OFF;
 
BeepTime = 2000;
ExternControl.Digital[0] = 0x55;
231,7 → 236,7
{
if(UpdateMotor) // control interval
{
UpdateMotor=0; // reset Flag, is enabled every 2 ms by isr of timer0
UpdateMotor = 0; // reset Flag, is enabled every 2 ms by isr of timer0
//PORTD |= (1<<PORTD4);
MotorControl();
//PORTD &= ~(1<<PORTD4);
238,7 → 243,7
 
SendMotorData();
 
ROT_OFF;
RED_OFF;
 
if(PcAccess) PcAccess--;
else
255,7 → 260,7
{
I2CTimeout = 5;
I2C_Reset();
if((BeepModulation == 0xFFFF) && MotorsOn)
if((BeepModulation == 0xFFFF) && (MKFlags & MKFLAG_MOTOR_RUN) )
{
BeepTime = 10000; // 1 second
BeepModulation = 0x0080;
264,10 → 269,10
else
{
I2CTimeout--;
ROT_OFF;
RED_OFF;
}
 
if(SIO_DEBUG && (!UpdateMotor || !MotorsOn))
if(SIO_DEBUG && (!UpdateMotor || !(MKFlags & MKFLAG_MOTOR_RUN) ))
{
USART0_TransmitTxData();
USART0_ProcessRxData();
290,6 → 295,8
#endif
timer = SetDelay(20); // every 20 ms
}
 
LED_Update();
}
 
#ifdef USE_NAVICTRL