Subversion Repositories NaviCtrl

Rev

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

Rev 264 Rev 268
Line 269... Line 269...
269
void SPI0_UpdateBuffer(void)
269
void SPI0_UpdateBuffer(void)
270
{
270
{
271
        static u32 timeout = 0;
271
        static u32 timeout = 0;
272
        static u8 counter = 50;
272
        static u8 counter = 50;
273
        static u8 CompassCalState = 0;
273
        static u8 CompassCalState = 0;
-
 
274
        static u8 FCCalibActive = 0;
Line 274... Line 275...
274
 
275
 
275
        if (SPI_RxBuffer_Request)
276
        if (SPI_RxBuffer_Request)
276
        {
277
        {
277
                // avoid sending data via SPI during the update of the  ToFlightCtrl structure
278
                // avoid sending data via SPI during the update of the  ToFlightCtrl structure
Line 338... Line 339...
338
                                {
339
                                {
339
                                        FC.StatusFlags = 0;
340
                                        FC.StatusFlags = 0;
340
                                        ClearFCStatusFlags = 0;
341
                                        ClearFCStatusFlags = 0;
341
                                }
342
                                }
342
                                FC.StatusFlags |= FromFlightCtrl.Param.Byte[8];
343
                                FC.StatusFlags |= FromFlightCtrl.Param.Byte[8];
-
 
344
                                if(FC.StatusFlags&FC_STATUS_CALIBRATE && !FCCalibActive)
-
 
345
                                {
-
 
346
                                        Compass_Init();
-
 
347
                                        FCCalibActive = 1;
-
 
348
                                }
-
 
349
                                else
-
 
350
                                {
-
 
351
                                        FCCalibActive = 0;     
-
 
352
                                }
343
                                Parameter.ActiveSetting = FromFlightCtrl.Param.Byte[9];
353
                                Parameter.ActiveSetting = FromFlightCtrl.Param.Byte[9];
344
                                DebugOut.Analog[5] = FC.StatusFlags;
354
                                DebugOut.Analog[5] = FC.StatusFlags;
345
                                NaviData.FCStatusFlags = FC.StatusFlags;
355
                                NaviData.FCStatusFlags = FC.StatusFlags;
346
                                HeadFreeStartAngle = (s32) FromFlightCtrl.Param.Byte[10] * 20; // convert to 0.1°
356
                                HeadFreeStartAngle = (s32) FromFlightCtrl.Param.Byte[10] * 20; // convert to 0.1°
347
                                break;
357
                                break;