Subversion Repositories NaviCtrl

Rev

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

Rev 489 Rev 493
Line 298... Line 298...
298
                        MK3MAG_SendCommand(MK3MAG_CMD_READ_MAGVECT); // initiate magvector transfer
298
                        MK3MAG_SendCommand(MK3MAG_CMD_READ_MAGVECT); // initiate magvector transfer
Line 299... Line 299...
299
 
299
 
300
                        switch(Compass_CalState)
300
                        switch(Compass_CalState)
301
                        {
301
                        {
302
                                case 1:
302
                                case 1:
303
                                    if(last_state != Compass_CalState)
303
                                        if(last_state != Compass_CalState)
304
                                         {
304
                                        {
305
                                          UART1_PutString("\r\nMK3Mag calibration\n\r");
305
                                                UART1_PutString("\r\nMK3Mag calibration\n\r");
306
                                      if(EarthMagneticStrengthTheoretic)
306
                                                if(EarthMagneticStrengthTheoretic)
307
                                                {
307
                                                {
308
                                                  MinCaclibration = (MinCaclibration * EarthMagneticStrengthTheoretic) / 50;
308
                                                        MinCaclibration = (MinCaclibration * EarthMagneticStrengthTheoretic) / 50;
309
                                                  sprintf(msg, "Earth field on your location should be: %iuT\r\n",EarthMagneticStrengthTheoretic);
309
                                                        sprintf(msg, "Earth field on your location should be: %iuT\r\n",EarthMagneticStrengthTheoretic);
310
                                                  UART1_PutString(msg);
310
                                                        UART1_PutString(msg);
311
                                                 }
311
                                                }
312
                                           else UART1_PutString("without GPS\n\r");
312
                                                else UART1_PutString("without GPS\n\r");
313
                                         }
313
                                        }
314
                                        x_max = -30000; y_max = -30000; z_max = -30000;
314
                                        x_max = -30000; y_max = -30000; z_max = -30000;
315
                                        x_min = 30000; y_min = 30000; z_min = 30000;
315
                                        x_min = 30000; y_min = 30000; z_min = 30000;
316
                                        speak = 1;
316
                                        speak = 1;
317
                                        break;
317
                                        break;
Line 334... Line 334...
334
                                        break;
334
                                        break;
335
                                case 5:
335
                                case 5:
336
                                    if(last_state == Compass_CalState) break;
336
                                    if(last_state == Compass_CalState) break;
337
                                        if(((x_max - x_min) > MinCaclibration) && ((y_max - y_min) > MinCaclibration) && ((z_max - z_min) > MinCaclibration))
337
                                        if(((x_max - x_min) > MinCaclibration) && ((y_max - y_min) > MinCaclibration) && ((z_max - z_min) > MinCaclibration))
338
                                        {
338
                                        {
339
                                        BeepTime = 2500;
339
                                                BeepTime = 2500;
340
                                        UART1_PutString("\r\n-> Calibration okay <-\n\r");
340
                                                UART1_PutString("\r\n-> Calibration okay <-\n\r");
341
SpeakHoTT = SPEAK_MIKROKOPTER;
341
                                                SpeakHoTT = SPEAK_MIKROKOPTER;
342
                                        }
342
                                        }
343
                                        else
343
                                        else
344
                                        {
344
                                        {
345
                                        UART1_PutString("\r\nCalibration FAILED - Values too low: ");
345
                                                UART1_PutString("\r\nCalibration FAILED - Values too low: ");
346
                                    if((x_max - x_min) < MinCaclibration) UART1_PutString("X! ");
346
                                            if((x_max - x_min) < MinCaclibration) UART1_PutString("X! ");
347
                                    if((y_max - y_min) < MinCaclibration) UART1_PutString("Y! ");
347
                                            if((y_max - y_min) < MinCaclibration) UART1_PutString("Y! ");
348
                                    if((z_max - z_min) < MinCaclibration) UART1_PutString("Z! ");
348
                                            if((z_max - z_min) < MinCaclibration) UART1_PutString("Z! ");
349
                                        UART1_PutString("\r\n");
349
                                                UART1_PutString("\r\n");
350
SpeakHoTT = SPEAK_ERR_CALIBARTION;
350
                                                SpeakHoTT = SPEAK_ERR_CALIBARTION;
351
                                        }
351
                                        }
352
                                        UART1_PutString(msg);
352
                                        UART1_PutString(msg);
353
                                        sprintf(msg, "\r\nX: (%i - %i = %i)\r\n",x_max,x_min,x_max - x_min);
353
                                        sprintf(msg, "\r\nX: (%i - %i = %i)\r\n",x_max,x_min,x_max - x_min);
354
                                        UART1_PutString(msg);
354
                                        UART1_PutString(msg);
355
                                        sprintf(msg, "Y: (%i - %i = %i)\r\n",y_max,y_min,y_max - y_min);
355
                                        sprintf(msg, "Y: (%i - %i = %i)\r\n",y_max,y_min,y_max - y_min);