Subversion Repositories FlightCtrl

Rev

Rev 1141 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1134 thjac 1
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2
// + Copyright (c) 04.2007 Holger Buss
3
// + only for non-profit use
4
// + www.MikroKopter.com
5
// + see the File "License.txt" for further Informations
6
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
7
#include "main.h"
8
#include "altcon.h"
1139 thjac 9
#include "pitch.h"
1141 thjac 10
#include "pitch_neutral.h"
1139 thjac 11
#include "pitch_md.h"
12
#include "parameter.h"
1154 thjac 13
#include "fc.h"
1134 thjac 14
 
15
unsigned int  TestInt = 0;
16
#define ARRAYGROESSE 10
17
unsigned char Array[ARRAYGROESSE] = {1,2,3,4,5,6,7,8,9,10};
18
char DisplayBuff[80] = "Hallo Welt";
19
unsigned char DispPtr = 0;
20
 
1139 thjac 21
unsigned char MaxMenue = 12;
1134 thjac 22
unsigned char MenuePunkt = 0;
23
unsigned char RemoteKeys = 0;
24
 
25
#define KEY1    0x01
26
#define KEY2    0x02
27
#define KEY3    0x04
28
#define KEY4    0x08
29
#define KEY5    0x10
30
 
31
void LcdClear(void)
32
{
33
 unsigned char i;
34
 for(i=0;i<80;i++) DisplayBuff[i] = ' ';
35
}
36
 
37
void Menu(void)
38
 {
39
 
40
  if(MenuePunkt > MaxMenue) MenuePunkt = MaxMenue;
41
 
42
  if(RemoteKeys & KEY1) { if(MenuePunkt) MenuePunkt--; else MenuePunkt = MaxMenue;}
43
  if(RemoteKeys & KEY2) { if(MenuePunkt == MaxMenue) MenuePunkt = 0; else MenuePunkt++;}
44
  if((RemoteKeys & KEY1) && (RemoteKeys & KEY2)) MenuePunkt = 0;
45
  LcdClear();
46
  if(MenuePunkt < 10) {LCD_printfxy(17,0,"[%i]",MenuePunkt);}
47
  else {LCD_printfxy(16,0,"[%i]",MenuePunkt);};
48
 
49
 
50
  switch(MenuePunkt)
51
   {
52
    case 0:
53
           LCD_printfxy(0,0,"+ MikroKopter +");
54
           LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",PlatinenVersion/10,PlatinenVersion%10, VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH +'a');
55
           LCD_printfxy(0,2,"Setting: %d ",GetActiveParamSetNumber());
56
           LCD_printfxy(0,3,"(c) Holger Buss");
57
//           if(RemoteTasten & KEY3) TestInt--;
58
//           if(RemoteTasten & KEY4) TestInt++;
59
           break;
60
    case 1:
61
          if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)
62
           {        
63
           LCD_printfxy(0,0,"RegOffset: %5i", pressureOffset );
1154 thjac 64
           LCD_printfxy(0,1,"Luftdruck: %5i", analog_airPressure() );
1134 thjac 65
           LCD_printfxy(0,2,"Off      : %5i",DruckOffsetSetting);
66
           }
67
           else
68
           {
69
           LCD_printfxy(0,1,"Keine ");
70
           LCD_printfxy(0,2,"Höhenregelung");
71
           }
72
 
73
           break;
74
    case 2:
75
           LCD_printfxy(0,0,"akt. Lage");
76
           LCD_printfxy(0,1,"Nick:      %5i",IntegralNick/1024);
77
           LCD_printfxy(0,2,"Roll:      %5i",IntegralRoll/1024);
78
           LCD_printfxy(0,3,"Kompass:   %5i",KompassValue);
79
           break;
80
    case 3:
81
           LCD_printfxy(0,0,"K1:%4i  K2:%4i ",PPM_in[1],PPM_in[2]);
82
           LCD_printfxy(0,1,"K3:%4i  K4:%4i ",PPM_in[3],PPM_in[4]);
83
           LCD_printfxy(0,2,"K5:%4i  K6:%4i ",PPM_in[5],PPM_in[6]);
84
           LCD_printfxy(0,3,"K7:%4i  K8:%4i ",PPM_in[7],PPM_in[8]);
85
           break;
86
    case 4:
87
           LCD_printfxy(0,0,"Ni:%4i  Ro:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_NICK]],PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]);
88
           LCD_printfxy(0,1,"Gs:%4i  Gi:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]],PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]);
89
           LCD_printfxy(0,2,"P1:%4i  P2:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]],PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]]);
90
           LCD_printfxy(0,3,"P3:%4i  P4:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]],PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]]);
91
           break;
92
    case 5:
93
           LCD_printfxy(0,0,"Gyro - Sensor");
94
          if(PlatinenVersion == 10)
95
          {
96
           LCD_printfxy(0,1,"Nick %4i (%3i)",AdWertNick - AdNeutralNick, AdNeutralNick);
97
           LCD_printfxy(0,2,"Roll %4i (%3i)",AdWertRoll - AdNeutralRoll, AdNeutralRoll);
98
           LCD_printfxy(0,3,"Gier %4i (%3i)",AdNeutralGier - AdWertGier, AdNeutralGier);
99
          }
100
          else
101
          if((PlatinenVersion == 11) || (PlatinenVersion == 20))
102
          {
103
           LCD_printfxy(0,1,"Nick %4i (%3i)",AdWertNick - AdNeutralNick, AdNeutralNick/2);
104
           LCD_printfxy(0,2,"Roll %4i (%3i)",AdWertRoll - AdNeutralRoll, AdNeutralRoll/2);
105
           LCD_printfxy(0,3,"Gier %4i (%3i)",AdNeutralGier - AdWertGier, AdNeutralGier/2);
106
          }
107
          else
108
          if(PlatinenVersion == 13)
109
          {
110
           LCD_printfxy(0,1,"Nick %4i (%3i)(%3i)",AdWertNick - AdNeutralNick, AdNeutralNick/2,AnalogOffsetNick);
111
           LCD_printfxy(0,2,"Roll %4i (%3i)(%3i)",AdWertRoll - AdNeutralRoll, AdNeutralRoll/2,AnalogOffsetRoll);
112
           LCD_printfxy(0,3,"Gier %4i (%3i)(%3i)",AdNeutralGier - AdWertGier, AdNeutralGier/2,AnalogOffsetGier);
113
          }
114
 
115
           break;
116
    case 6:
117
           LCD_printfxy(0,0,"ACC - Sensor");
118
           LCD_printfxy(0,1,"Nick %4i (%3i)",AdWertAccNick,NeutralAccX);
119
           LCD_printfxy(0,2,"Roll %4i (%3i)",AdWertAccRoll,NeutralAccY);
120
           LCD_printfxy(0,3,"Hoch %4i (%3i)",Mittelwert_AccHoch/*accumulate_AccHoch / messanzahl_AccHoch*/,(int)NeutralAccZ);
121
           break;
122
    case 7:
123
           LCD_printfxy(0,1,"Spannung:  %5i",UBat);
124
           LCD_printfxy(0,2,"Empf.Pegel:%5i",SenderOkay);
125
           break;
126
    case 8:
127
           LCD_printfxy(0,0,"Kompass       ");
128
           LCD_printfxy(0,1,"Richtung:  %5i",KompassRichtung);
129
           LCD_printfxy(0,2,"Messwert:  %5i",KompassValue);
130
           LCD_printfxy(0,3,"Start:     %5i",KompassStartwert);
131
           break;
132
    case 9:
133
           LCD_printfxy(0,0,"Poti1:  %3i",Poti1);
134
           LCD_printfxy(0,1,"Poti2:  %3i",Poti2);
135
           LCD_printfxy(0,2,"Poti3:  %3i",Poti3);
136
           LCD_printfxy(0,3,"Poti4:  %3i",Poti4);
137
           break;
138
    case 10:
139
           LCD_printfxy(0,0,"Servo  " );
140
           LCD_printfxy(0,1,"Setpoint  %3i",Parameter_ServoNickControl);
141
           LCD_printfxy(0,2,"Stellung: %3i",ServoValue);
142
           LCD_printfxy(0,3,"Range:%3i-%3i",EE_Parameter.ServoNickMin,EE_Parameter.ServoNickMax);
143
           break;
144
    case 11:
145
           LCD_printfxy(0,0,"ExternControl  " );
146
           LCD_printfxy(0,1,"Ni:%4i  Ro:%4i ",ExternControl.Nick,ExternControl.Roll);
147
           LCD_printfxy(0,2,"Gs:%4i  Gi:%4i ",ExternControl.Gas,ExternControl.Gier);
148
           LCD_printfxy(0,3,"Hi:%4i  Cf:%4i ",ExternControl.Hight,ExternControl.Config);
149
           break;
1139 thjac 150
    case 12:
151
           LCD_printfxy( 0, 0, "PitchSteuerung " );
1141 thjac 152
           LCD_printfxy( 0, 1, "Modus:    %8s", pitchModeStrings[ pitch_currentMode() ] );
153
           LCD_printfxy( 0, 2, "GsInit:   %3i", pitch_initialStickValue() );
1139 thjac 154
 
1141 thjac 155
 
1139 thjac 156
           // MD-Modus
1141 thjac 157
           switch( pitch_currentMode() ) {
158
                case PARAM_PITCH_MODE_NEUTRAL:
159
                        LCD_printfxy( 0, 3, "StickDiff: %2i", pitch_neutralDiff() )
160
                        break;
161
 
1139 thjac 162
                case PARAM_PITCH_MODE_MD:
1141 thjac 163
                        LCD_printfxy( 0, 3, "Standgas: %3i", pitch_hoverValue() );
1139 thjac 164
                        break;
165
           }
166
 
167
           break;
168
 
1134 thjac 169
    default: MaxMenue = MenuePunkt - 1;
170
             MenuePunkt = 0;
171
           break;
172
    }
173
    RemoteKeys = 0;
174
}