Subversion Repositories NaviCtrl

Rev

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

Rev 482 Rev 483
Line 66... Line 66...
66
#include "menu.h"
66
#include "menu.h"
67
#include "uart1.h"
67
#include "uart1.h"
68
#include "ncmag.h"
68
#include "ncmag.h"
69
#include "logging.h"
69
#include "logging.h"
70
#include "settings.h"
70
#include "settings.h"
-
 
71
#include "gpx.h"
Line 71... Line 72...
71
 
72
 
72
u8 DispPtr = 0;
73
u8 DispPtr = 0;
Line 85... Line 86...
85
{
86
{
86
        u8 i;
87
        u8 i;
87
        for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' ';
88
        for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' ';
88
}
89
}
Line -... Line 90...
-
 
90
 
89
 
91
 
90
// Display with 20 characters in 4 lines
92
// Display with 20 characters in 4 lines
91
void Menu_Update(u8 Keys)
93
void Menu_Update(u8 Keys)
92
{
94
{
93
        s32 i1,i2;
95
        s32 i1,i2;
Line 354... Line 356...
354
                        break;
356
                        break;
355
                case 14: // gyros from FC
357
                case 14: // gyros from FC
356
                        LCD_printfxy(0,0,"GyroNick:  %4i", FromFlightCtrl.GyroNick);
358
                        LCD_printfxy(0,0,"GyroNick:  %4i", FromFlightCtrl.GyroNick);
357
            LCD_printfxy(0,1,"GyroRoll:  %4i", FromFlightCtrl.GyroRoll);
359
            LCD_printfxy(0,1,"GyroRoll:  %4i", FromFlightCtrl.GyroRoll);
358
                        LCD_printfxy(0,2,"GyroYaw:   %4i", FromFlightCtrl.GyroYaw);
360
                        LCD_printfxy(0,2,"GyroYaw:   %4i", FromFlightCtrl.GyroYaw);
359
                        if(FC_is_Calibrated)    LCD_printfxy(0,3,"Calibrated    ")
361
                        if(FC_is_Calibrated) LCD_printfxy(0,3,"Calibrated    ") else LCD_printfxy(0,3,"not calibrated");
360
                        else                                    LCD_printfxy(0,3,"not calibrated");
-
 
361
                        break;
362
                        break;
362
                case 15:
363
                case 15:
363
//                      LCD_printfxy(0,0,"Ubat:   %2i.%1i V", FC.BAT_Voltage/10, FC.BAT_Voltage%10);
364
//                      LCD_printfxy(0,0,"Ubat:   %2i.%1i V", FC.BAT_Voltage/10, FC.BAT_Voltage%10);
364
                        LCD_printfxy(0,0,"Compass:    %3i", FromFlightCtrl.GyroHeading / 10);
365
                        LCD_printfxy(0,0,"Compass:    %3i", FromFlightCtrl.GyroHeading / 10);
365
                        LCD_printfxy(0,1,"Man.-Offset:%3i", FC.FromFC_CompassOffset / 10);
366
                        LCD_printfxy(0,1,"Man.-Offset:%3i", FC.FromFC_CompassOffset / 10);
366
                        if(FC.FromFC_DisableDeclination)
367
                        if(FC.FromFC_DisableDeclination)
367
                        {
368
                        {
368
                                LCD_printfxy(0,2,"Mag.Declinat.:disabl");
369
                         LCD_printfxy(0,2,"Mag.Declinat.:disabl");
369
                        }
370
                        }
370
                        else
371
                        else
371
                        {
372
                        {
372
                                if(GeoMagDec < 0) sign = '-';
373
                         if(GeoMagDec < 0) sign = '-';
373
                                else sign = '+';
374
                         else sign = '+';
374
                                LCD_printfxy(0,2,"Mag.Declinat.:%c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10);
375
                         LCD_printfxy(0,2,"Mag.Declinat.:%c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10);
375
                        }
376
                        }
376
                        LCD_printfxy(0,3,"True Compass: %3i", GyroCompassCorrected/10);
377
                        LCD_printfxy(0,3,"True Compass: %3i", GyroCompassCorrected/10);
377
            break;
378
            break;
378
                case 16: // User Parameter
379
                case 16: // User Parameter
379
                        LCD_printfxy(0,0,"UP1:%3i  UP2:%3i",Parameter.User1,Parameter.User2);
380
                        LCD_printfxy(0,0,"UP1:%3i  UP2:%3i",Parameter.User1,Parameter.User2);
Line 424... Line 425...
424
                                LCD_printfxy(0,0,"Magnetic Field");
425
                                LCD_printfxy(0,0,"Magnetic Field");
425
                                LCD_printfxy(0,1,"X:%5i",MagVector.X);
426
                                LCD_printfxy(0,1,"X:%5i",MagVector.X);
426
                                LCD_printfxy(0,2,"Y:%5i",MagVector.Y);
427
                                LCD_printfxy(0,2,"Y:%5i",MagVector.Y);
427
                                LCD_printfxy(0,3,"Z:%5i",MagVector.Z);
428
                                LCD_printfxy(0,3,"Z:%5i",MagVector.Z);
428
                                LCD_printfxy(8,1,"Field:%3i",EarthMagneticField/5);
429
                                LCD_printfxy(8,1,"Field:%3i",EarthMagneticField/5);
429
                                if(Compass_I2CPort == NCMAG_PORT_EXTERN)        LCD_printfxy(11,2,"Extern")
430
                                if(I2C_CompassPort == I2C_EXTERN_0) LCD_printfxy(11,2,"Extern %d",ExtCompassOrientation) else LCD_printfxy(11,2,"Intern");
430
                                else                                                                            LCD_printfxy(11,2,"Intern");
-
 
431
//                              LCD_printfxy(8,2,"Dec:%c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10);
431
//                              LCD_printfxy(8,2,"Dec:%c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10);
432
//                              LCD_printfxy(8,3,"Inc:%2i", EarthMagneticInclination);
432
//                              LCD_printfxy(8,3,"Inc:%2i", EarthMagneticInclination);
433
                                LCD_printfxy(15,3,"(CAL)");
433
                                LCD_printfxy(15,3,"(CAL)");
434
                        }
434
                        }
435
                        if(Keys & KEY4) //  next step
435
                        if(Keys & KEY4) //  next step
Line 457... Line 457...
457
                        LCD_printfxy(0,3,"GPS-Update:%2i.%iHz ",FreqGpsProcessedIn5Sec/10, FreqGpsProcessedIn5Sec%10);
457
                        LCD_printfxy(0,3,"GPS-Update:%2i.%iHz ",FreqGpsProcessedIn5Sec/10, FreqGpsProcessedIn5Sec%10);
458
                        if(FreqNewGpsDataIn5Sec >= 48 && FreqNewGpsDataIn5Sec <= 52) LCD_printfxy(18,2,"OK") else LCD_printfxy(18,2,"!!");
458
                        if(FreqNewGpsDataIn5Sec >= 48 && FreqNewGpsDataIn5Sec <= 52) LCD_printfxy(18,2,"OK") else LCD_printfxy(18,2,"!!");
459
                        if(FreqGpsProcessedIn5Sec >= 350) LCD_printfxy(18,3,"OK") else LCD_printfxy(18,3,"!!");
459
                        if(FreqGpsProcessedIn5Sec >= 350) LCD_printfxy(18,3,"OK") else LCD_printfxy(18,3,"!!");
460
                        break;
460
                        break;
461
                case 22:
461
                case 22:
462
                        LCD_printfxy(0,0,"BL Current" );
462
           LCD_printfxy(0,0,"BL Current" );
463
                        LCD_printfxy(11,3,"(in 0.1A)" );
463
           LCD_printfxy(11,3,"(in 0.1A)" );
464
                        for(i1 = 0; i1 < 3; i1++)
464
                   for(i1 = 0; i1 < 3; i1++)
465
                        {
465
                    {
466
                     LCD_printfxy(0,i1+1,"%3d %3d %3d %3d ",BL3_Current(i1*4),BL3_Current(i1*4+1),BL3_Current(i1*4+2),BL3_Current(i1*4+3));
466
                     LCD_printfxy(0,i1+1,"%3d %3d %3d %3d ",BL3_Current(i1*4),BL3_Current(i1*4+1),BL3_Current(i1*4+2),BL3_Current(i1*4+3));
467
                         if(Motor[4 + i1 * 4].State == 0) break;
467
                         if(Motor[4 + i1 * 4].State == 0) break;
468
                        }                      
468
                        }                      
469
                        break;
469
                        break;
470
 
-
 
471
                case 23:
470
                case 23:
472
                        LCD_printfxy(0,0,"Ext. Compass" );
471
           LCD_printfxy(0,0,"Ext. Compass" );
473
                        if(Compass_I2CPort == NCMAG_PORT_EXTERN)
472
                          if(I2C_CompassPort == I2C_EXTERN_0)
474
                        {
473
                           {
475
                             u8 tmp;
474
                             u8 tmp;
476
                         LCD_printfxy(0,1,"ACC  X      Y      Z");
475
                         LCD_printfxy(0,1,"ACC  X      Y      Z");
477
                         LCD_printfxy(0,2," %5d  %5d  %5d", AccVector.X/40, AccVector.Y/40, AccVector.Z/40);
476
                         LCD_printfxy(0,2," %5d  %5d  %5d",AccRawVector.X/40,AccRawVector.Y/40,AccRawVector.Z/40);
478
                                 tmp = NCMAG_GetOrientationFromAcc();
477
                                 tmp = GetExtCompassOrientation();
479
                                 LCD_printfxy(0,3,"Orientat.: ");
478
                                 LCD_printfxy(0,3,"Orientat.: ");
480
                                 if(!tmp) LCD_printfxy(11,3,"??") else LCD_printfxy(11,3,"%2d",tmp);
479
                                 if(!tmp) LCD_printfxy(11,3,"??") else LCD_printfxy(11,3,"%2d",tmp);
481
                                 LCD_printfxy(15,3,"(%d)",NCMAG_Orientation);
480
                                 LCD_printfxy(15,3,"(%d)",ExtCompassOrientation);
482
                        }
481
                           }
483
                        else
482
                           else
484
                        {
483
                           {
485
                                LCD_printfxy(0,1,"Not connected");
484
                            LCD_printfxy(0,1,"Not connected");
486
                        }
485
                           }
487
                        break;
486
                        break;
488
                default:
487
                default:
489
                        //MaxMenuItem = MenuItem - 1;
488
                        //MaxMenuItem = MenuItem - 1;
490
                        MenuItem = 0;
489
                        MenuItem = 0;
491
                        break;
490
                        break;