Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 179 → Rev 180

/trunk/main.c
130,7 → 130,6
{
LED_RED_ON;
sprintf(ErrorMSG,"no FC communication ");
TIMER2_Deinit(); // reduce irq load
ErrorCode = 3;
StopNavigation = 1;
}
181,10 → 180,6
else // no error occured
{
sprintf(ErrorMSG,"No Error ");
if(ErrorCode == 3)
{
TIMER2_Init(); // enbable servo outputs
}
ErrorCode = 0;
StopNavigation = 0;
LED_RED_OFF;
224,7 → 219,7
UART1_Init();
UART1_PutString("\r\n---------------------------------------------");
// initialize timer 2 for servo outputs
TIMER2_Init();
//TIMER2_Init();
// initialize UART2 to FLIGHTCTRL
UART2_Init();
// initialize UART0 (to MKGPS or MK3MAG)
/trunk/main.h
4,7 → 4,7
 
#define VERSION_MAJOR 0
#define VERSION_MINOR 17
#define VERSION_PATCH 0
#define VERSION_PATCH 1
 
#define VERSION_SERIAL_MAJOR 10
#define VERSION_SERIAL_MINOR 1
/trunk/spi_slave.c
289,6 → 289,9
//------------------------------------------------------
void SPI0_UpdateBuffer(void)
{
static u32 timeout = 0;
static u8 counter = 50;
if (SPI_RxBuffer_Request)
{
// avoid sending data via SPI during the update of the ToFlightCtrl structure
415,8 → 418,15
// every time we got new data from the FC via SPI call the navigation routine
GPS_Navigation();
ClearMKFlags = 1;
if(counter)
{
counter--; // count down to enable servo
if(!counter) TIMER2_Init(); // enable Servo Output
}
 
SPI_RxBuffer_Request = 0;
timeout = SetDelay(80); // 80 ms, new data are send every 20 ms
 
DebugOut.Analog[0] = FromFlightCtrl.AngleNick;
DebugOut.Analog[1] = FromFlightCtrl.AngleRoll;
427,6 → 437,14
Data3D.AngleRoll = FromFlightCtrl.AngleRoll; // in 0.1 deg
Data3D.Heading = FromFlightCtrl.GyroHeading; // in 0.1 deg
} // EOF if(SPI_RxBuffer_Request)
else // no new SPI data
{
if(CheckDelay(timeout) && (counter == 0))
{
TIMER2_Deinit(); // disable Servo Output
counter = 50; // reset counter for enabling Servo Output
}
}
}
 
//------------------------------------------------------
454,7 → 472,7
}while (!CheckDelay(timeout));
UART1_PutString(".");
repeat++;
}while((FC_Version.Major == 0xFF) && (repeat < 12)); // 12*250ms = 3s
}while((FC_Version.Major == 0xFF) && (repeat < 40)); // 40*250ms = 10s
// if we got it
if (FC_Version.Major != 0xFF)
{
/trunk/timer2.c
250,6 → 250,8
{
GPIO_InitTypeDef GPIO_InitStructure;
 
UART1_PutString("\r\n Timer2 deinit...");
 
VIC_ITCmd(TIM2_ITLine, DISABLE);
TIM_CounterCmd(TIM2, TIM_STOP); // stop the timer
TIM_CounterCmd(TIM2, TIM_CLEAR); // stop the timer
/trunk/uart1.c
391,6 → 391,7
case UART_FLIGHTCTRL:
UART2_Init(); // initialize UART2 to FC pins
fifo_purge(&UART1_rx_fifo);
TIMER2_Deinit(); // reduce irq load
DebugUART = UART2;
break;
case UART_MK3MAG: