Subversion Repositories NaviCtrl

Rev

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

Rev 487 Rev 488
Line 157... Line 157...
157
        if(UART_VersionInfo.HardwareError[0] || UART_VersionInfo.HardwareError[1]) DebugOut.StatusRed |= AMPEL_NC;
157
        if(UART_VersionInfo.HardwareError[0] || UART_VersionInfo.HardwareError[1]) DebugOut.StatusRed |= AMPEL_NC;
158
        else DebugOut.StatusRed &= ~AMPEL_NC;
158
        else DebugOut.StatusRed &= ~AMPEL_NC;
Line 159... Line 159...
159
 
159
 
Line 160... Line -...
160
//if(I2C_CompassPort == I2C_EXTERN_0) LED_RED_OFF_T;
-
 
161
 
-
 
162
    if((FCCalibActive || CompassCalState) && FC_Version.Hardware)
-
 
163
     {
-
 
164
                sprintf(ErrorMSG,"Calibrate... ");
-
 
165
                newErrorCode = 0;
-
 
166
                ErrorCode = 0;
-
 
167
                no_error_delay = 1;
160
//if(I2C_CompassPort == I2C_EXTERN_0) LED_RED_OFF_T;
168
         }
161
 
169
        else if(CheckDelay(I2C1_Timeout) && (I2C_CompassPort == I2C_INTERN_1))
162
        if(CheckDelay(I2C1_Timeout) && (I2C_CompassPort == I2C_INTERN_1))
170
        {
163
        {
171
                LED_RED_ON;              
164
                LED_RED_ON;              
172
                sprintf(ErrorMSG,"no compass communica");
165
                sprintf(ErrorMSG,"no compass communica");
Line 190... Line 183...
190
                newErrorCode = 33;
183
                newErrorCode = 33;
191
                StopNavigation = 1;
184
                StopNavigation = 1;
192
                UART_VersionInfo.HardwareError[0] |= NC_ERROR0_COMPASS_RX;
185
                UART_VersionInfo.HardwareError[0] |= NC_ERROR0_COMPASS_RX;
193
                DebugOut.StatusRed |= AMPEL_COMPASS;
186
                DebugOut.StatusRed |= AMPEL_COMPASS;
194
        }
187
        }
-
 
188
        else if(CompassValueErrorCount > 30)
-
 
189
        {
-
 
190
                LED_RED_ON;
-
 
191
                sprintf(ErrorMSG,"compass sensor error");
-
 
192
                newErrorCode = 34;
-
 
193
                StopNavigation = 1;
-
 
194
                UART_VersionInfo.HardwareError[0] |= NC_ERROR0_COMPASS_VALUE;
-
 
195
                if(I2C_CompassPort == I2C_INTERN_1)
-
 
196
                {
-
 
197
                 I2C1_Deinit();
-
 
198
                 I2C1_Init();
-
 
199
                }
-
 
200
                else
-
 
201
                {
-
 
202
                 I2C0_Deinit();
-
 
203
                 I2C0_Init();
-
 
204
                }
-
 
205
        }
195
        else
206
        else
-
 
207
    if((FCCalibActive || CompassCalState) && FC_Version.Hardware)
-
 
208
     {
-
 
209
                sprintf(ErrorMSG,"Calibrate... ");
-
 
210
                newErrorCode = 0;
-
 
211
                ErrorCode = 0;
-
 
212
                no_error_delay = 1;
-
 
213
         }
-
 
214
        else
196
        if(CheckDelay(SPI0_Timeout))
215
        if(CheckDelay(SPI0_Timeout))
197
        {
216
        {
198
                LED_RED_ON;              
217
                LED_RED_ON;              
199
                sprintf(ErrorMSG,"no FC communication ");
218
                sprintf(ErrorMSG,"no FC communication ");
200
                newErrorCode = 3;
219
                newErrorCode = 3;
Line 303... Line 322...
303
                sprintf(ErrorMSG,"compass not calibr.");
322
                sprintf(ErrorMSG,"compass not calibr.");
304
                newErrorCode = 31;
323
                newErrorCode = 31;
305
                StopNavigation = 1;
324
                StopNavigation = 1;
306
                UART_VersionInfo.HardwareError[0] |= NC_ERROR0_COMPASS_VALUE;
325
                UART_VersionInfo.HardwareError[0] |= NC_ERROR0_COMPASS_VALUE;
307
        }
326
        }
308
        else if(CompassValueErrorCount > 30)
-
 
309
        {
-
 
310
                LED_RED_ON;
-
 
311
                sprintf(ErrorMSG,"compass sensor error");
-
 
312
                newErrorCode = 34;
-
 
313
                StopNavigation = 1;
-
 
314
                UART_VersionInfo.HardwareError[0] |= NC_ERROR0_COMPASS_VALUE;
-
 
315
        }
-
 
316
        else if(Compass_Heading < 0)
327
        else if(Compass_Heading < 0)
317
        {
328
        {
318
                LED_RED_ON;
329
                LED_RED_ON;
319
                sprintf(ErrorMSG,"bad compass value ");
330
                sprintf(ErrorMSG,"bad compass value ");
320
                newErrorCode = 6;
331
                newErrorCode = 6;
Line 458... Line 469...
458
                UART0_TransmitTxData(); // GPS send answer
469
                UART0_TransmitTxData(); // GPS send answer
459
                UART1_ProcessRxData();  // PC process request
470
                UART1_ProcessRxData();  // PC process request
460
                UART1_TransmitTxData(); // PC send answer
471
                UART1_TransmitTxData(); // PC send answer
461
                UART2_TransmitTxData(); // FC send answer
472
                UART2_TransmitTxData(); // FC send answer
462
                // ---------------- Error Check Timing ----------------------------
473
                // ---------------- Error Check Timing ----------------------------
-
 
474
 
-
 
475
//DebugOut.Analog[16] = CompassValueErrorCount;
463
                if(CheckDelay(TimerCheckError) || (FC.StatusFlags & FC_STATUS_START && !(oldFcFlags & FC_STATUS_START))) // Timer or FY wants to start
476
                if(CheckDelay(TimerCheckError) || (FC.StatusFlags & FC_STATUS_START && !(oldFcFlags & FC_STATUS_START))) // Timer or FY wants to start
464
                {
477
                {
465
                        if(CheckDelay(TimerCheckError))
478
                        if(CheckDelay(TimerCheckError))
466
                         {
479
                         {
467
                          TimerCheckError = SetDelay(1000);
480
                          TimerCheckError = SetDelay(1000);