Subversion Repositories NaviCtrl

Rev

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

Rev 475 Rev 482
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 72... Line 71...
72
 
71
 
73
u8 DispPtr = 0;
72
u8 DispPtr = 0;
Line 86... Line 85...
86
{
85
{
87
        u8 i;
86
        u8 i;
88
        for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' ';
87
        for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' ';
89
}
88
}
Line 90... Line -...
90
 
-
 
91
 
89
 
92
// Display with 20 characters in 4 lines
90
// Display with 20 characters in 4 lines
93
void Menu_Update(u8 Keys)
91
void Menu_Update(u8 Keys)
94
{
92
{
95
        s32 i1,i2;
93
        s32 i1,i2;
Line 356... Line 354...
356
                        break;
354
                        break;
357
                case 14: // gyros from FC
355
                case 14: // gyros from FC
358
                        LCD_printfxy(0,0,"GyroNick:  %4i", FromFlightCtrl.GyroNick);
356
                        LCD_printfxy(0,0,"GyroNick:  %4i", FromFlightCtrl.GyroNick);
359
            LCD_printfxy(0,1,"GyroRoll:  %4i", FromFlightCtrl.GyroRoll);
357
            LCD_printfxy(0,1,"GyroRoll:  %4i", FromFlightCtrl.GyroRoll);
360
                        LCD_printfxy(0,2,"GyroYaw:   %4i", FromFlightCtrl.GyroYaw);
358
                        LCD_printfxy(0,2,"GyroYaw:   %4i", FromFlightCtrl.GyroYaw);
361
                        if(FC_is_Calibrated) LCD_printfxy(0,3,"Calibrated    ") else LCD_printfxy(0,3,"not calibrated");
359
                        if(FC_is_Calibrated)    LCD_printfxy(0,3,"Calibrated    ")
-
 
360
                        else                                    LCD_printfxy(0,3,"not calibrated");
362
                        break;
361
                        break;
363
                case 15:
362
                case 15:
364
//                      LCD_printfxy(0,0,"Ubat:   %2i.%1i V", FC.BAT_Voltage/10, FC.BAT_Voltage%10);
363
//                      LCD_printfxy(0,0,"Ubat:   %2i.%1i V", FC.BAT_Voltage/10, FC.BAT_Voltage%10);
365
                        LCD_printfxy(0,0,"Compass:    %3i", FromFlightCtrl.GyroHeading / 10);
364
                        LCD_printfxy(0,0,"Compass:    %3i", FromFlightCtrl.GyroHeading / 10);
366
                        LCD_printfxy(0,1,"Man.-Offset:%3i", FC.FromFC_CompassOffset / 10);
365
                        LCD_printfxy(0,1,"Man.-Offset:%3i", FC.FromFC_CompassOffset / 10);
367
                        if(FC.FromFC_DisableDeclination)
366
                        if(FC.FromFC_DisableDeclination)
368
                        {
367
                        {
369
                         LCD_printfxy(0,2,"Mag.Declinat.:disabl");
368
                                LCD_printfxy(0,2,"Mag.Declinat.:disabl");
370
                        }
369
                        }
371
                        else
370
                        else
372
                        {
371
                        {
373
                         if(GeoMagDec < 0) sign = '-';
372
                                if(GeoMagDec < 0) sign = '-';
374
                         else sign = '+';
373
                                else sign = '+';
375
                         LCD_printfxy(0,2,"Mag.Declinat.:%c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10);
374
                                LCD_printfxy(0,2,"Mag.Declinat.:%c%i.%1i", sign, abs(GeoMagDec)/10,abs(GeoMagDec)%10);
376
                        }
375
                        }
377
                        LCD_printfxy(0,3,"True Compass: %3i", GyroCompassCorrected/10);
376
                        LCD_printfxy(0,3,"True Compass: %3i", GyroCompassCorrected/10);
378
            break;
377
            break;
379
                case 16: // User Parameter
378
                case 16: // User Parameter
380
                        LCD_printfxy(0,0,"UP1:%3i  UP2:%3i",Parameter.User1,Parameter.User2);
379
                        LCD_printfxy(0,0,"UP1:%3i  UP2:%3i",Parameter.User1,Parameter.User2);
Line 425... Line 424...
425
                                LCD_printfxy(0,0,"Magnetic Field");
424
                                LCD_printfxy(0,0,"Magnetic Field");
426
                                LCD_printfxy(0,1,"X:%5i",MagVector.X);
425
                                LCD_printfxy(0,1,"X:%5i",MagVector.X);
427
                                LCD_printfxy(0,2,"Y:%5i",MagVector.Y);
426
                                LCD_printfxy(0,2,"Y:%5i",MagVector.Y);
428
                                LCD_printfxy(0,3,"Z:%5i",MagVector.Z);
427
                                LCD_printfxy(0,3,"Z:%5i",MagVector.Z);
429
                                LCD_printfxy(8,1,"Field:%3i",EarthMagneticField/5);
428
                                LCD_printfxy(8,1,"Field:%3i",EarthMagneticField/5);
430
                                if(I2C_CompassPort == I2C_EXTERN_0) LCD_printfxy(11,2,"Extern %d",ExtCompassOrientation) else LCD_printfxy(11,2,"Intern");
429
                                if(Compass_I2CPort == NCMAG_PORT_EXTERN)        LCD_printfxy(11,2,"Extern")
-
 
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
 
470
                case 23:
471
                case 23:
471
           LCD_printfxy(0,0,"Ext. Compass" );
472
                        LCD_printfxy(0,0,"Ext. Compass" );
472
                          if(I2C_CompassPort == I2C_EXTERN_0)
473
                        if(Compass_I2CPort == NCMAG_PORT_EXTERN)
473
                           {
474
                        {
474
                             u8 tmp;
475
                             u8 tmp;
475
                         LCD_printfxy(0,1,"ACC  X      Y      Z");
476
                         LCD_printfxy(0,1,"ACC  X      Y      Z");
476
                         LCD_printfxy(0,2," %5d  %5d  %5d",AccRawVector.X/40,AccRawVector.Y/40,AccRawVector.Z/40);
477
                         LCD_printfxy(0,2," %5d  %5d  %5d", AccVector.X/40, AccVector.Y/40, AccVector.Z/40);
477
                                 tmp = GetExtCompassOrientation();
478
                                 tmp = NCMAG_GetOrientationFromAcc();
478
                                 LCD_printfxy(0,3,"Orientat.: ");
479
                                 LCD_printfxy(0,3,"Orientat.: ");
479
                                 if(!tmp) LCD_printfxy(11,3,"??") else LCD_printfxy(11,3,"%2d",tmp);
480
                                 if(!tmp) LCD_printfxy(11,3,"??") else LCD_printfxy(11,3,"%2d",tmp);
480
                                 LCD_printfxy(15,3,"(%d)",ExtCompassOrientation);
481
                                 LCD_printfxy(15,3,"(%d)",NCMAG_Orientation);
481
                           }
482
                        }
482
                           else
483
                        else
483
                           {
484
                        {
484
                            LCD_printfxy(0,1,"Not connected");
485
                                LCD_printfxy(0,1,"Not connected");
485
                           }
486
                        }
486
                        break;
487
                        break;
487
                default:
488
                default:
488
                        //MaxMenuItem = MenuItem - 1;
489
                        //MaxMenuItem = MenuItem - 1;
489
                        MenuItem = 0;
490
                        MenuItem = 0;
490
                        break;
491
                        break;