Subversion Repositories NaviCtrl

Rev

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

Rev 231 Rev 232
Line 148... Line 148...
148
#define ERROR_COMPASS_VALUE                     0x20
148
#define ERROR_COMPASS_VALUE                     0x20
149
//----------------------------------------------------------------------------------------------------
149
//----------------------------------------------------------------------------------------------------
Line 150... Line 150...
150
 
150
 
151
void CheckErrors(void)
151
void CheckErrors(void)
152
{
152
{
153
 UART_VersionInfo.HardwareError[0] = 0;
-
 
Line 154... Line 153...
154
 
153
        UART_VersionInfo.HardwareError[0] = 0;
155
 
154
 
156
  if((MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE) || (CheckDelay(I2C1_Timeout)) || (MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE) || (I2C_Heading.Heading < 0)) DebugOut.Status[1] |= 0x08;
155
        if((MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE) || CheckDelay(I2C1_Timeout) || (I2C_Heading.Heading < 0)) DebugOut.Status[1] |= 0x08;
157
  else DebugOut.Status[1] &= ~0x08; // MK3Mag green status
156
        else DebugOut.Status[1] &= ~0x08; // MK3Mag green status
158
 
157
 
Line 159... Line 158...
159
  if((FC_ErrorCode[1] & DEFEKT_I2C) || (FC_ErrorCode[1] & DEFEKT_BL_MISSING)) DebugOut.Status[1] |= 0x02;
158
        if((FC_ErrorCode[1] & DEFEKT_I2C) || (FC_ErrorCode[1] & DEFEKT_BL_MISSING)) DebugOut.Status[1] |= 0x02;
160
  else DebugOut.Status[1] &= ~0x02; // BL-Ctrl green status
159
        else DebugOut.Status[1] &= ~0x02; // BL-Ctrl green status
161
 
160
 
162
        if(CheckDelay(SPI0_Timeout))
161
        if(CheckDelay(SPI0_Timeout))
163
        {
162
        {
164
                LED_RED_ON;
163
                LED_RED_ON;
165
                sprintf(ErrorMSG,"no FC communication ");
164
                sprintf(ErrorMSG,"no FC communication ");
166
                ErrorCode = 3;
165
                ErrorCode = 3;
167
                StopNavigation = 1;
166
                StopNavigation = 1;
168
                DebugOut.Status[0] &= ~0x01; // status of FC Present
167
                DebugOut.Status[0] &= ~0x01; // status of FC Present
169
                DebugOut.Status[0] &= ~0x02; // status of BL Present
168
                DebugOut.Status[0] &= ~0x02; // status of BL Present
170
                UART_VersionInfo.HardwareError[0] |= ERROR_FC_COMMUNICATION;
169
                UART_VersionInfo.HardwareError[0] |= ERROR_FC_COMMUNICATION;
171
        }
170
        }
Line 177... Line 176...
177
                I2C1_Deinit();
176
                I2C1_Deinit();
178
                I2C1_Init();
177
                I2C1_Init();
179
                ErrorCode = 4;
178
                ErrorCode = 4;
180
                StopNavigation = 1;
179
                StopNavigation = 1;
181
                UART_VersionInfo.HardwareError[0] |= ERROR_MK3_COMMUNICATION;
180
                UART_VersionInfo.HardwareError[0] |= ERROR_MK3_COMMUNICATION;
182
        DebugOut.Status[1] |= 0x08;
181
                DebugOut.Status[1] |= 0x08;
183
        }
182
        }
184
        else if(FC_Version.Compatible != FC_SPI_COMPATIBLE)
183
        else if(FC_Version.Compatible != FC_SPI_COMPATIBLE)
185
        {
184
        {
186
                LED_RED_ON;
185
                LED_RED_ON;
187
                sprintf(ErrorMSG,"FC not compatible ");
186
                sprintf(ErrorMSG,"FC not compatible ");
Line 193... Line 192...
193
        else if(FC_ErrorCode[0] & DEFEKT_G_NICK)
192
        else if(FC_ErrorCode[0] & DEFEKT_G_NICK)
194
        {
193
        {
195
                LED_RED_ON;
194
                LED_RED_ON;
196
                sprintf(ErrorMSG,"ERR: FC Nick Gyro");
195
                sprintf(ErrorMSG,"ERR: FC Nick Gyro");
197
                ErrorCode = 10;
196
                ErrorCode = 10;
198
    }
197
        }
199
        else if(FC_ErrorCode[0] & DEFEKT_G_ROLL)
198
        else if(FC_ErrorCode[0] & DEFEKT_G_ROLL)
200
        {
199
        {
201
                LED_RED_ON;
200
                LED_RED_ON;
202
                sprintf(ErrorMSG,"ERR: FC Roll Gyro");
201
                sprintf(ErrorMSG,"ERR: FC Roll Gyro");
203
                ErrorCode = 11;
202
                ErrorCode = 11;
204
    }
203
        }
205
        else if(FC_ErrorCode[0] & DEFEKT_G_GIER)
204
        else if(FC_ErrorCode[0] & DEFEKT_G_GIER)
206
        {
205
        {
207
                LED_RED_ON;
206
                LED_RED_ON;
208
                sprintf(ErrorMSG,"ERR: FC Yaw Gyro");
207
                sprintf(ErrorMSG,"ERR: FC Yaw Gyro");
209
                ErrorCode = 12;
208
                ErrorCode = 12;
210
    }
209
        }
211
        else if(FC_ErrorCode[0] & DEFEKT_A_NICK)
210
        else if(FC_ErrorCode[0] & DEFEKT_A_NICK)
212
        {
211
        {
213
                LED_RED_ON;
212
                LED_RED_ON;
214
                sprintf(ErrorMSG,"ERR: FC Nick ACC");
213
                sprintf(ErrorMSG,"ERR: FC Nick ACC");
215
                ErrorCode = 13;
214
                ErrorCode = 13;
216
    }
215
        }
217
        else if(FC_ErrorCode[0] & DEFEKT_A_ROLL)
216
        else if(FC_ErrorCode[0] & DEFEKT_A_ROLL)
218
        {
217
        {
219
                LED_RED_ON;
218
                LED_RED_ON;
220
                sprintf(ErrorMSG,"ERR: FC Roll ACC");
219
                sprintf(ErrorMSG,"ERR: FC Roll ACC");
221
                ErrorCode = 14;
220
                ErrorCode = 14;
222
    }
221
        }
223
        else if(FC_ErrorCode[0] & DEFEKT_A_Z)
222
        else if(FC_ErrorCode[0] & DEFEKT_A_Z)
224
        {
223
        {
225
                LED_RED_ON;
224
                LED_RED_ON;
226
                sprintf(ErrorMSG,"ERR: FC Z-ACC");
225
                sprintf(ErrorMSG,"ERR: FC Z-ACC");
227
                ErrorCode = 15;
226
                ErrorCode = 15;
228
    }
227
        }
229
        else if(FC_ErrorCode[0] & DEFEKT_PRESSURE)
228
        else if(FC_ErrorCode[0] & DEFEKT_PRESSURE)
230
        {
229
        {
231
                LED_RED_ON;
230
                LED_RED_ON;
232
                sprintf(ErrorMSG,"ERR: Pressure sensor");
231
                sprintf(ErrorMSG,"ERR: Pressure sensor");
233
                ErrorCode = 16;
232
                ErrorCode = 16;
234
    }
233
        }
235
        else if(FC_ErrorCode[1] & DEFEKT_I2C)
234
        else if(FC_ErrorCode[1] & DEFEKT_I2C)
236
        {
235
        {
237
                LED_RED_ON;
236
                LED_RED_ON;
238
                sprintf(ErrorMSG,"ERR: FC I2C");
237
                sprintf(ErrorMSG,"ERR: FC I2C");
239
                ErrorCode = 17;
238
                ErrorCode = 17;
240
    }
239
        }
241
        else if(FC_ErrorCode[1] & DEFEKT_BL_MISSING)
240
        else if(FC_ErrorCode[1] & DEFEKT_BL_MISSING)
242
        {
241
        {
243
                LED_RED_ON;
242
                LED_RED_ON;
244
                sprintf(ErrorMSG,"ERR: Bl Missing");
243
                sprintf(ErrorMSG,"ERR: Bl Missing");
245
                ErrorCode = 18;
244
                ErrorCode = 18;
246
    }
245
        }
247
        else if(FC_ErrorCode[1] & DEFEKT_MIXER_ERR)
246
        else if(FC_ErrorCode[1] & DEFEKT_MIXER_ERR)
248
        {
247
        {
249
                LED_RED_ON;
248
                LED_RED_ON;
250
                sprintf(ErrorMSG,"Mixer Error");
249
                sprintf(ErrorMSG,"Mixer Error");
251
                ErrorCode = 19;
250
                ErrorCode = 19;
252
    }
251
        }
253
        else if(MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE)
252
        else if(MK3MAG_Version.Compatible != MK3MAG_I2C_COMPATIBLE)
254
        {
253
        {
255
                sprintf(ErrorMSG,"MK3Mag not compatible ");
254
                sprintf(ErrorMSG,"MK3Mag not compatible ");
256
                LED_RED_ON;
255
                LED_RED_ON;
257
                ErrorCode = 2;
256
                ErrorCode = 2;
Line 284... Line 283...
284
        else if(FC_ErrorCode[0] & DEFEKT_CAREFREE_ERR)
283
        else if(FC_ErrorCode[0] & DEFEKT_CAREFREE_ERR)
285
        {
284
        {
286
                LED_RED_ON;
285
                LED_RED_ON;
287
                sprintf(ErrorMSG,"FC: Carefree Error");
286
                sprintf(ErrorMSG,"FC: Carefree Error");
288
                ErrorCode = 20;
287
                ErrorCode = 20;
289
    }
288
        }
290
        else if(FC.RC_Quality < 100)
289
        else if(FC.RC_Quality < 100)
291
        {
290
        {
292
                LED_RED_ON;
291
                LED_RED_ON;
293
                sprintf(ErrorMSG,"RC Signal lost ");
292
                sprintf(ErrorMSG,"RC Signal lost ");
294
                ErrorCode = 7;
293
                ErrorCode = 7;
Line 298... Line 297...
298
                sprintf(ErrorMSG,"No Error               ");
297
                sprintf(ErrorMSG,"No Error               ");
299
                ErrorCode = 0;
298
                ErrorCode = 0;
300
                StopNavigation = 0;
299
                StopNavigation = 0;
301
                LED_RED_OFF;
300
                LED_RED_OFF;
302
        }
301
        }
303
 if(UART_VersionInfo.HardwareError[0] || UART_VersionInfo.HardwareError[1] || UART_VersionInfo.HardwareError[0]) DebugOut.Status[1] |= 0x04;
302
        if(UART_VersionInfo.HardwareError[0] || UART_VersionInfo.HardwareError[1]) DebugOut.Status[1] |= 0x04;
304
 else DebugOut.Status[1] &= ~0x04;
303
        else DebugOut.Status[1] &= ~0x04;
305
}
304
}
Line 306... Line 305...
306
 
305
 
307
// the handler will be cyclic called by the timer 1 ISR
306
// the handler will be cyclic called by the timer 1 ISR
308
// used is for critical timing parts that normaly would handled
307
// used is for critical timing parts that normaly would handled