Subversion Repositories NaviCtrl

Rev

Rev 419 | Rev 421 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 419 Rev 420
Line 284... Line 284...
284
//------------------------------------------------------
284
//------------------------------------------------------
285
void SPI0_UpdateBuffer(void)
285
void SPI0_UpdateBuffer(void)
286
{
286
{
287
        static u32 timeout = 0;
287
        static u32 timeout = 0;
288
        static u8 counter = 50,hott_index = 0, last_error_code = 0;
288
        static u8 counter = 50,hott_index = 0, last_error_code = 0;
289
        s16 tmp;
289
        s16 tmp, last_wp_event = 0;
290
        s32 i1,i2;
290
        s32 i1,i2;
Line 291... Line 291...
291
       
291
       
292
    SPIWatchDog = 3500;    // stop communication to FC after this timeout
292
    SPIWatchDog = 3500;    // stop communication to FC after this timeout
293
        if(SPI_RxBuffer_Request)
293
        if(SPI_RxBuffer_Request)
Line 301... Line 301...
301
                ToFlightCtrl.MagVecY = MagVector.Y;
301
                ToFlightCtrl.MagVecY = MagVector.Y;
302
                ToFlightCtrl.MagVecZ = MagVector.Z;
302
                ToFlightCtrl.MagVecZ = MagVector.Z;
303
//              ToFlightCtrl.NCStatus = 0;
303
//              ToFlightCtrl.NCStatus = 0;
304
                // cycle spi commands
304
                // cycle spi commands
305
                if(ErrorCode != last_error_code) ToFlightCtrl.Command = SPI_NCCMD_VERSION;
305
                if(ErrorCode != last_error_code) ToFlightCtrl.Command = SPI_NCCMD_VERSION;
-
 
306
                else
-
 
307
                if(FC_WP_EventChannel != last_wp_event) ToFlightCtrl.Command = SPI_NCCMD_GPSINFO;
-
 
308
                else
-
 
309
                 {
306
                else ToFlightCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++];
310
                  ToFlightCtrl.Command = SPI_CommandSequence[SPI_CommandCounter++];
307
                // restart command cycle at the end
311
                // restart command cycle at the end
308
                if(SPI_CommandCounter >= sizeof(SPI_CommandSequence)) SPI_CommandCounter = 0;
312
                  if(SPI_CommandCounter >= sizeof(SPI_CommandSequence)) SPI_CommandCounter = 0;
309
 
313
                 }
310
                last_error_code = ErrorCode;
314
                last_error_code = ErrorCode;
-
 
315
                last_wp_event = FC_WP_EventChannel;
Line 311... Line 316...
311
 
316
 
312
#define FLAG_GPS_AID 0x01
317
#define FLAG_GPS_AID 0x01
313
                switch (ToFlightCtrl.Command)
318
                switch (ToFlightCtrl.Command)
314
                {
319
                {