Rev 683 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 683 | Rev 685 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | // + Copyright (c) 04.2007 Holger Buss |
2 | // + Copyright (c) 04.2007 Holger Buss |
3 | // + only for non-profit use |
3 | // + only for non-profit use |
4 | // + www.MikroKopter.com |
4 | // + www.MikroKopter.com |
5 | // + see the File "License.txt" for further Informations |
5 | // + see the File "License.txt" for further Informations |
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
6 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
7 | #include "main.h" |
- | |
Line -... | Line 7... | ||
- | 7 | ||
- | 8 | ||
- | 9 | #include <inttypes.h> |
|
- | 10 | #include "main.h" |
|
- | 11 | #include "timer2.h" |
|
- | 12 | #include "fc.h" |
|
- | 13 | #include "rc.h" |
|
- | 14 | #include "uart.h" |
|
- | 15 | #include "printf_P.h" |
|
- | 16 | #include "analog.h" |
|
- | 17 | #include "_Settings.h" |
|
8 | 18 | ||
9 | unsigned int TestInt = 0; |
19 | uint16_t TestInt = 0; |
10 | #define ARRAYGROESSE 10 |
20 | #define ARRAYSIZE 10 |
- | 21 | uint8_t Array[ARRAYSIZE] = {1,2,3,4,5,6,7,8,9,10}; |
|
11 | unsigned char Array[ARRAYGROESSE] = {1,2,3,4,5,6,7,8,9,10}; |
22 | #define DISPLAYBUFFSIZE 80 |
12 | char DisplayBuff[80] = "Hallo Welt"; |
23 | int8_t DisplayBuff[DISPLAYBUFFSIZE] = "Hello World"; |
13 | unsigned char DispPtr = 0; |
24 | uint8_t DispPtr = 0; |
Line 14... | Line 25... | ||
14 | unsigned char RemoteTasten = 0; |
25 | uint8_t RemoteButtons = 0; |
15 | 26 | ||
16 | #define KEY1 0x01 |
27 | #define KEY1 0x01 |
17 | #define KEY2 0x02 |
28 | #define KEY2 0x02 |
18 | #define KEY3 0x04 |
29 | #define KEY3 0x04 |
Line -... | Line 30... | ||
- | 30 | #define KEY4 0x08 |
|
- | 31 | #define KEY5 0x10 |
|
- | 32 | ||
19 | #define KEY4 0x08 |
33 | /************************************/ |
20 | #define KEY5 0x10 |
34 | /* Clear LCD Buffer */ |
21 | 35 | /************************************/ |
|
22 | void LcdClear(void) |
36 | void LCD_Clear(void) |
23 | { |
37 | { |
Line -... | Line 38... | ||
- | 38 | uint8_t i; |
|
- | 39 | for( i = 0; i < DISPLAYBUFFSIZE; i++) DisplayBuff[i] = ' '; |
|
- | 40 | } |
|
- | 41 | ||
- | 42 | ||
24 | unsigned char i; |
43 | /************************************/ |
25 | for(i=0;i<80;i++) DisplayBuff[i] = ' '; |
44 | /* Update Menu on LCD */ |
26 | } |
45 | /************************************/ |
Line -... | Line 46... | ||
- | 46 | // Display with 20 characters in 4 lines |
|
- | 47 | void LCD_PrintMenu(void) |
|
- | 48 | { |
|
- | 49 | static uint8_t MaxMenuItem = 11, MenuItem=0; |
|
- | 50 | ||
- | 51 | // if KEY1 is activated goto previous menu item |
|
- | 52 | if(RemoteButtons & KEY1) |
|
- | 53 | { |
|
- | 54 | if(MenuItem) MenuItem--; |
|
- | 55 | else MenuItem = MaxMenuItem; |
|
- | 56 | LCD_Clear(); |
|
27 | 57 | RemotePollDisplayLine = -1; |
|
- | 58 | } |
|
- | 59 | // if KEY2 is activated goto next menu item |
|
- | 60 | if(RemoteButtons & KEY2) |
|
- | 61 | { |
|
- | 62 | if (MenuItem == MaxMenuItem) MenuItem = 0; |
|
28 | void Menu(void) |
63 | else MenuItem++; |
29 | { |
64 | LCD_Clear(); |
- | 65 | RemotePollDisplayLine = -1; |
|
- | 66 | } |
|
- | 67 | ||
- | 68 | // if KEY1 and KEY2 is activated goto initial menu item |
|
30 | static unsigned char MaxMenue = 11,MenuePunkt=0; |
69 | if((RemoteButtons & KEY1) && (RemoteButtons & KEY2)) MenuItem = 0; |
- | 70 | ||
- | 71 | // print menu item number in the upper right corner |
|
- | 72 | if(MenuItem < 10) |
|
- | 73 | { |
|
- | 74 | LCD_printfxy(17,0,"[%i]",MenuItem); |
|
- | 75 | } |
|
31 | 76 | else |
|
32 | if(RemoteTasten & KEY1) { if(MenuePunkt) MenuePunkt--; else MenuePunkt = MaxMenue; LcdClear(); RemotePollDisplayLine = -1; } |
77 | { |
33 | if(RemoteTasten & KEY2) { MenuePunkt++; LcdClear(); RemotePollDisplayLine = -1;} |
78 | LCD_printfxy(16,0,"[%i]",MenuItem); |
34 | if((RemoteTasten & KEY1) && (RemoteTasten & KEY2)) MenuePunkt = 0; |
79 | } |
35 | if(MenuePunkt < 10) {LCD_printfxy(17,0,"[%i]",MenuePunkt);} else {LCD_printfxy(16,0,"[%i]",MenuePunkt);}; |
80 | |
36 | switch(MenuePunkt) |
81 | switch(MenuItem) |
37 | { |
82 | { |
38 | case 0: |
- | |
39 | LCD_printfxy(0,0,"+ MikroKopter +"); |
- | |
40 | LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",PlatinenVersion/10,PlatinenVersion%10,VERSION_HAUPTVERSION, VERSION_NEBENVERSION,VERSION_INDEX+'a'); |
83 | case 0:// Version Info Menu Item |
41 | LCD_printfxy(0,2,"Setting: %d ",GetActiveParamSetNumber()); |
84 | LCD_printfxy(0,0,"+ MikroKopter +"); |
42 | LCD_printfxy(0,3,"(c) Holger Buss"); |
85 | LCD_printfxy(0,1,"HW:V%d.%d SW:%d.%d%c",BoardRelease/10,BoardRelease%10,VERSION_HAUPTVERSION, VERSION_NEBENVERSION,VERSION_INDEX+'a'); |
43 | // if(RemoteTasten & KEY3) TestInt--; |
86 | LCD_printfxy(0,2,"Setting: %d ", GetActiveParamSetNumber()); |
44 | // if(RemoteTasten & KEY4) TestInt++; |
87 | LCD_printfxy(0,3,"(c) Holger Buss"); |
45 | break; |
88 | break; |
46 | case 1: |
89 | case 1:// Hight Control Menu Item |
Line 56... | Line 99... | ||
56 | LCD_printfxy(0,1,"Keine "); |
99 | LCD_printfxy(0,1,"Keine "); |
57 | LCD_printfxy(0,2,"Höhenregelung"); |
100 | LCD_printfxy(0,2,"Höhenregelung"); |
58 | } |
101 | } |
Line 59... | Line 102... | ||
59 | 102 | ||
60 | break; |
103 | break; |
61 | case 2: |
104 | case 2:// Attitude Menu Item |
62 | LCD_printfxy(0,0,"akt. Lage"); |
105 | LCD_printfxy(0,0,"akt. Lage"); |
63 | LCD_printfxy(0,1,"Nick: %5i",IntegralNick/1024); |
106 | LCD_printfxy(0,1,"Nick: %5i",IntegralNick/1024); |
64 | LCD_printfxy(0,2,"Roll: %5i",IntegralRoll/1024); |
107 | LCD_printfxy(0,2,"Roll: %5i",IntegralRoll/1024); |
65 | LCD_printfxy(0,3,"Kompass: %5i",KompassValue); |
108 | LCD_printfxy(0,3,"Kompass: %5i",KompassValue); |
66 | break; |
109 | break; |
67 | case 3: |
110 | case 3:// Remote Control Channel Menu Item |
68 | LCD_printfxy(0,0,"K1:%4i K2:%4i ",PPM_in[1],PPM_in[2]); |
111 | LCD_printfxy(0,0,"K1:%4i K2:%4i ",PPM_in[1],PPM_in[2]); |
69 | LCD_printfxy(0,1,"K3:%4i K4:%4i ",PPM_in[3],PPM_in[4]); |
112 | LCD_printfxy(0,1,"K3:%4i K4:%4i ",PPM_in[3],PPM_in[4]); |
70 | LCD_printfxy(0,2,"K5:%4i K6:%4i ",PPM_in[5],PPM_in[6]); |
113 | LCD_printfxy(0,2,"K5:%4i K6:%4i ",PPM_in[5],PPM_in[6]); |
71 | LCD_printfxy(0,3,"K7:%4i K8:%4i ",PPM_in[7],PPM_in[8]); |
114 | LCD_printfxy(0,3,"K7:%4i K8:%4i ",PPM_in[7],PPM_in[8]); |
72 | break; |
115 | break; |
73 | case 4: |
116 | case 4:// Remote Control Mapping Menu Item |
74 | LCD_printfxy(0,0,"Ni:%4i Ro:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_NICK]],PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]); |
117 | LCD_printfxy(0,0,"Ni:%4i Ro:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_NICK]],PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]]); |
75 | LCD_printfxy(0,1,"Gs:%4i Gi:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]],PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]); |
118 | LCD_printfxy(0,1,"Gs:%4i Gi:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]],PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]); |
76 | LCD_printfxy(0,2,"P1:%4i P2:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]],PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]]); |
119 | LCD_printfxy(0,2,"P1:%4i P2:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_POTI1]],PPM_in[EE_Parameter.Kanalbelegung[K_POTI2]]); |
77 | LCD_printfxy(0,3,"P3:%4i P4:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]],PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]]); |
120 | LCD_printfxy(0,3,"P3:%4i P4:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_POTI3]],PPM_in[EE_Parameter.Kanalbelegung[K_POTI4]]); |
78 | break; |
121 | break; |
79 | case 5: |
122 | case 5:// Gyro Sensor Menu Item |
80 | LCD_printfxy(0,0,"Gyro - Sensor"); |
123 | LCD_printfxy(0,0,"Gyro - Sensor"); |
81 | if(PlatinenVersion == 10) |
124 | if(BoardRelease == 10) |
82 | { |
125 | { |
83 | LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick); |
126 | LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick); |
84 | LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll); |
127 | LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll); |
85 | LCD_printfxy(0,3,"Gier %4i (%3i)",MesswertGier, AdNeutralGier); |
128 | LCD_printfxy(0,3,"Gier %4i (%3i)",MesswertGier, AdNeutralGier); |
Line 89... | Line 132... | ||
89 | LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick/2); |
132 | LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueGyrNick - AdNeutralNick, AdNeutralNick/2); |
90 | LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll/2); |
133 | LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueGyrRoll - AdNeutralRoll, AdNeutralRoll/2); |
91 | LCD_printfxy(0,3,"Gier %4i (%3i)",MesswertGier, AdNeutralGier/2); |
134 | LCD_printfxy(0,3,"Gier %4i (%3i)",MesswertGier, AdNeutralGier/2); |
92 | } |
135 | } |
93 | break; |
136 | break; |
94 | case 6: |
137 | case 6:// Acceleration Sensor Menu Item |
95 | LCD_printfxy(0,0,"ACC - Sensor"); |
138 | LCD_printfxy(0,0,"ACC - Sensor"); |
96 | LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueAccNick,NeutralAccX); |
139 | LCD_printfxy(0,1,"Nick %4i (%3i)",AdValueAccNick,NeutralAccX); |
97 | LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueAccRoll,NeutralAccY); |
140 | LCD_printfxy(0,2,"Roll %4i (%3i)",AdValueAccRoll,NeutralAccY); |
98 | LCD_printfxy(0,3,"Hoch %4i (%3i)",Mittelwert_AccHoch/*accumulate_AccHoch / messanzahl_AccHoch*/,(int)NeutralAccZ); |
141 | LCD_printfxy(0,3,"Hoch %4i (%3i)",Mittelwert_AccHoch/*accumulate_AccHoch / messanzahl_AccHoch*/,(int)NeutralAccZ); |
99 | break; |
142 | break; |
100 | case 7: |
143 | case 7:// Accumulator Voltage / Remote Control Level |
101 | LCD_printfxy(0,1,"Spannung: %5i",UBat); |
144 | LCD_printfxy(0,1,"Spannung: %5i",UBat); |
102 | LCD_printfxy(0,2,"Empf.Pegel:%5i",SenderOkay); |
145 | LCD_printfxy(0,2,"Empf.Pegel:%5i",SenderOkay); |
103 | break; |
146 | break; |
104 | case 8: |
147 | case 8:// Compass Menu Item |
105 | LCD_printfxy(0,0,"Kompass "); |
148 | LCD_printfxy(0,0,"Kompass "); |
106 | LCD_printfxy(0,1,"Richtung: %5i",KompassRichtung); |
149 | LCD_printfxy(0,1,"Richtung: %5i",KompassRichtung); |
107 | LCD_printfxy(0,2,"Messwert: %5i",KompassValue); |
150 | LCD_printfxy(0,2,"Messwert: %5i",KompassValue); |
108 | LCD_printfxy(0,3,"Start: %5i",KompassStartwert); |
151 | LCD_printfxy(0,3,"Start: %5i",KompassStartwert); |
109 | break; |
152 | break; |
110 | case 9: |
153 | case 9:// Poti Menu Item |
111 | LCD_printfxy(0,0,"Poti1: %3i",Poti1); |
154 | LCD_printfxy(0,0,"Poti1: %3i",Poti1); |
112 | LCD_printfxy(0,1,"Poti2: %3i",Poti2); |
155 | LCD_printfxy(0,1,"Poti2: %3i",Poti2); |
113 | LCD_printfxy(0,2,"Poti3: %3i",Poti3); |
156 | LCD_printfxy(0,2,"Poti3: %3i",Poti3); |
114 | LCD_printfxy(0,3,"Poti4: %3i",Poti4); |
157 | LCD_printfxy(0,3,"Poti4: %3i",Poti4); |
115 | break; |
158 | break; |
116 | case 10: |
159 | case 10:// Servo Menu Item |
117 | LCD_printfxy(0,0,"Servo " ); |
160 | LCD_printfxy(0,0,"Servo " ); |
118 | LCD_printfxy(0,1,"Setpoint %3i",Parameter_ServoNickControl); |
161 | LCD_printfxy(0,1,"Setpoint %3i",Parameter_ServoNickControl); |
119 | LCD_printfxy(0,2,"Stellung: %3i",ServoValue); |
162 | LCD_printfxy(0,2,"Stellung: %3i",ServoValue); |
120 | LCD_printfxy(0,3,"Range:%3i-%3i",EE_Parameter.ServoNickMin,EE_Parameter.ServoNickMax); |
163 | LCD_printfxy(0,3,"Range:%3i-%3i",EE_Parameter.ServoNickMin,EE_Parameter.ServoNickMax); |
121 | break; |
164 | break; |
122 | case 11: |
165 | case 11://Extern Control |
123 | LCD_printfxy(0,0,"ExternControl " ); |
166 | LCD_printfxy(0,0,"ExternControl " ); |
124 | LCD_printfxy(0,1,"Ni:%4i Ro:%4i ",ExternControl.Nick,ExternControl.Roll); |
167 | LCD_printfxy(0,1,"Ni:%4i Ro:%4i ",ExternControl.Nick,ExternControl.Roll); |
125 | LCD_printfxy(0,2,"Gs:%4i Gi:%4i ",ExternControl.Gas,ExternControl.Gier); |
168 | LCD_printfxy(0,2,"Gs:%4i Gi:%4i ",ExternControl.Gas,ExternControl.Gier); |
126 | LCD_printfxy(0,3,"Hi:%4i Cf:%4i ",ExternControl.Hight,ExternControl.Config); |
169 | LCD_printfxy(0,3,"Hi:%4i Cf:%4i ",ExternControl.Hight,ExternControl.Config); |
127 | break; |
170 | break; |
128 | default: MaxMenue = MenuePunkt - 1; |
171 | default: MaxMenuItem = MenuItem - 1; |
129 | MenuePunkt = 0; |
172 | MenuItem = 0; |
130 | break; |
173 | break; |
131 | } |
174 | } |
132 | RemoteTasten = 0; |
175 | RemoteButtons = 0; |
133 | } |
176 | } |