Rev 1749 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1749 | Rev 1756 | ||
---|---|---|---|
1 | #include "jetimenu.h" |
1 | #include "jetimenu.h" |
2 | #include "libfc.h" |
2 | #include "libfc.h" |
3 | #include "printf_P.h" |
3 | #include "printf_P.h" |
4 | #include "main.h" |
4 | #include "main.h" |
5 | #include "spi.h" |
5 | #include "spi.h" |
6 | #include "capacity.h" |
6 | #include "capacity.h" |
7 | 7 | ||
8 | #define JETIBOX_KEY_RIGHT 0x1F // |
8 | #define JETIBOX_KEY_RIGHT 0x1F // |
9 | #define JETIBOX_KEY_UP 0x2F // 47 |
9 | #define JETIBOX_KEY_UP 0x2F // 47 |
10 | #define JETIBOX_KEY_DOWN 0x4F // |
10 | #define JETIBOX_KEY_DOWN 0x4F // |
11 | #define JETIBOX_KEY_LEFT 0x8F // |
11 | #define JETIBOX_KEY_LEFT 0x8F // |
12 | #define JETIBOX_KEY_NONE 0x0F // 15 |
12 | #define JETIBOX_KEY_NONE 0x0F // 15 |
13 | #define JETIBOX_KEY_UNDEF 0x00 // |
13 | #define JETIBOX_KEY_UNDEF 0x00 // |
14 | #define JETIBOX_KEY_LANDR 0x9F // 159 |
14 | #define JETIBOX_KEY_LANDR 0x9F // 159 |
15 | #define JETIBOX_KEY_DownANDR 0x5F // 95 |
15 | #define JETIBOX_KEY_DownANDR 0x5F // 95 |
16 | #define JETIBOX_KEY_DownANDL 0xCF // 207 |
16 | #define JETIBOX_KEY_DownANDL 0xCF // 207 |
17 | #define JETIBOX_KEY_DownANDUP 0x6F // 111 |
17 | #define JETIBOX_KEY_DownANDUP 0x6F // 111 |
18 | #define JETIBOX_KEY_UPANDL 0xAF // 175 |
18 | #define JETIBOX_KEY_UPANDL 0xAF // 175 |
19 | #define JETIBOX_KEY_UPANDR 0x3F // 63 |
19 | #define JETIBOX_KEY_UPANDR 0x3F // 63 |
20 | 20 | ||
21 | 21 | ||
22 | #define JetiBox_printfxy(x,y,format, args...) { LIBFC_JetiBox_SetPos(y * 16 + x); _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);} |
22 | #define JetiBox_printfxy(x,y,format, args...) { LIBFC_JetiBox_SetPos(y * 16 + x); _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);} |
23 | #define JetiBox_printf(format, args...) { _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);} |
23 | #define JetiBox_printf(format, args...) { _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);} |
24 | 24 | ||
25 | // ----------------------------------------------------------- |
25 | // ----------------------------------------------------------- |
26 | // the menu functions |
26 | // the menu functions |
27 | // ----------------------------------------------------------- |
27 | // ----------------------------------------------------------- |
28 | 28 | ||
29 | 29 | ||
30 | void Menu_Status(uint8_t key) |
30 | void Menu_Status(uint8_t key) |
31 | 31 | ||
32 | { |
32 | { |
33 | 33 | ||
34 | //0123456789ABCDEF |
34 | //0123456789ABCDEF |
35 | JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10); |
35 | JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10); |
36 | if(NaviDataOkay) |
36 | if(NaviDataOkay) |
37 | { |
37 | { |
38 | // JetiBox_printfxy(6,0,"%03dm %03d%c", GPSInfo.HomeDistance/10,GPSInfo.HomeBearing, 0xDF); |
38 | // JetiBox_printfxy(6,0,"%03dm %03d%c", GPSInfo.HomeDistance/10,GPSInfo.HomeBearing, 0xDF); |
39 | JetiBox_printfxy(6,0,"%3d%c %03dm",(int)(ErsatzKompass / GIER_GRAD_FAKTOR), 0xDF, GPSInfo.HomeDistance/10); |
39 | JetiBox_printfxy(6,0,"%3d%c %03dm",(int)(ErsatzKompass / GIER_GRAD_FAKTOR), 0xDF, GPSInfo.HomeDistance/10); |
40 | } |
40 | } |
41 | else |
41 | else |
42 | { |
42 | { |
43 | JetiBox_printfxy(6,0,"Status"); |
43 | JetiBox_printfxy(6,0,"Status"); |
44 | } |
44 | } |
45 | if(NC_ErrorCode) JetiBox_printfxy(6,0,"ERROR: %2d",NC_ErrorCode); |
45 | if(NC_ErrorCode) JetiBox_printfxy(6,0,"ERROR: %2d",NC_ErrorCode); |
46 | JetiBox_printfxy(0,1,"%4i %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60); |
46 | JetiBox_printfxy(0,1,"%4i %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60); |
47 | if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG) |
47 | if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG) |
48 | { |
48 | { |
49 | JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter); |
49 | JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter); |
50 | } |
50 | } |
51 | } |
51 | } |
52 | 52 | ||
53 | 53 | ||
54 | void Menu_Temperature(uint8_t key) |
54 | void Menu_Temperature(uint8_t key) |
55 | { //0123456789ABCDEF |
55 | { //0123456789ABCDEF |
56 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature); |
56 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature); |
57 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature); |
57 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature); |
58 | if(RequiredMotors <= 4) |
58 | if(RequiredMotors <= 4) |
59 | { |
59 | { |
60 | JetiBox_printfxy(0,1,"Temperatures "); |
60 | JetiBox_printfxy(0,1,"Temperatures "); |
61 | } |
61 | } |
62 | else |
62 | else |
63 | if(RequiredMotors <= 6) |
63 | if(RequiredMotors <= 6) |
64 | { |
64 | { |
65 | JetiBox_printfxy(8,1,"\%cC ",0xdf); |
65 | JetiBox_printfxy(8,1,"\%cC ",0xdf); |
66 | } |
66 | } |
67 | 67 | ||
68 | } |
68 | } |
69 | 69 | ||
70 | void Menu_Battery(uint8_t key) |
70 | void Menu_Battery(uint8_t key) |
71 | { //0123456789ABCDEF |
71 | { //0123456789ABCDEF |
- | 72 | ||
- | 73 | if(Capacity.ActualCurrent > MotorsTmax) MotorsTmax = Capacity.ActualCurrent; /// |
|
- | 74 | ||
- | 75 | JetiBox_printfxy(0,0,"%2i.%1iV", UBat/10, UBat%10); |
|
- | 76 | //0123456789ABCDEF |
|
- | 77 | if(!MotorenEin) |
|
- | 78 | { |
|
- | 79 | JetiBox_printfxy(10,0,"%3i.%1iA",MotorsTmax/10, MotorsTmax%10); |
|
- | 80 | } |
|
- | 81 | else |
|
- | 82 | { |
|
72 | JetiBox_printfxy(0,0,"%2i.%1iV %3i.%1iA", UBat/10, UBat%10, Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
83 | JetiBox_printfxy(10,0,"%3i.%1iA",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
73 | //1 |
84 | } |
74 | JetiBox_printfxy(0,1,"%4iW %6imAH",Capacity.ActualPower, Capacity.UsedCapacity); |
85 | JetiBox_printfxy(0,1,"%4iW %6imAH",Capacity.ActualPower, Capacity.UsedCapacity); |
75 | //1 |
86 | |
76 | } |
87 | } |
77 | 88 | ||
78 | 89 | ||
79 | void Menu_PosInfo(uint8_t key) |
90 | void Menu_PosInfo(uint8_t key) |
80 | { |
91 | { |
81 | if(NaviDataOkay) |
92 | if(NaviDataOkay) |
82 | { |
93 | { |
83 | JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
94 | JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
84 | switch (GPSInfo.SatFix) |
95 | switch (GPSInfo.SatFix) |
85 | { |
96 | { |
86 | case SATFIX_3D: |
97 | case SATFIX_3D: |
87 | JetiBox_printfxy(12,0," 3D"); |
98 | JetiBox_printfxy(12,0," 3D"); |
88 | break; |
99 | break; |
89 | 100 | ||
90 | case SATFIX_2D: |
101 | case SATFIX_2D: |
91 | case SATFIX_NONE: |
102 | case SATFIX_NONE: |
92 | default: |
103 | default: |
93 | JetiBox_printfxy(12,0,"NoFx"); |
104 | JetiBox_printfxy(12,0,"NoFx"); |
94 | break; |
105 | break; |
95 | } |
106 | } |
96 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
107 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
97 | { |
108 | { |
98 | JetiBox_printfxy(12,0,"DGPS"); |
109 | JetiBox_printfxy(12,0,"DGPS"); |
99 | } |
110 | } |
100 | JetiBox_printfxy(0,1,"Home:%3dm %3d%c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF); |
111 | JetiBox_printfxy(0,1,"Home:%3dm %3d%c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF); |
101 | } |
112 | } |
102 | else |
113 | else |
103 | { //0123456789ABCDEF |
114 | { //0123456789ABCDEF |
104 | JetiBox_printfxy(2,0,"No NaviCtrl!"); |
115 | JetiBox_printfxy(2,0,"No NaviCtrl!"); |
105 | } |
116 | } |
106 | } |
117 | } |
107 | 118 | ||
108 | 119 | ||
109 | void Menu_Current(uint8_t key) |
120 | void Menu_Current(uint8_t key) |
110 | { //0123456789ABCDEF |
121 | { //0123456789ABCDEF |
111 | - | ||
112 | loop1 ++; |
122 | loop1 ++; |
113 | 123 | ||
114 | if(loop1 >= updatemotors) |
124 | if(loop1 >= updatemotors) |
115 | { |
125 | { |
116 | loop1=0; |
126 | loop1=0; |
117 | Motors0 =Motor[0].Current; |
127 | Motors0 =Motor[0].Current; |
118 | Motors1 =Motor[1].Current; |
128 | Motors1 =Motor[1].Current; |
119 | Motors2 =Motor[2].Current; |
129 | Motors2 =Motor[2].Current; |
120 | Motors3 =Motor[3].Current; |
130 | Motors3 =Motor[3].Current; |
121 | Motors4 =Motor[4].Current; |
131 | Motors4 =Motor[4].Current; |
122 | Motors5 =Motor[5].Current; |
132 | Motors5 =Motor[5].Current; |
123 | Motors6 =Motor[6].Current; |
133 | Motors6 =Motor[6].Current; |
124 | Motors7 =Motor[7].Current; |
134 | Motors7 =Motor[7].Current; |
125 | } |
135 | } |
- | 136 | ||
- | 137 | if(Motor[0].Current > Motors0max) Motors0max = Motor[0].Current; |
|
126 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motors0-12, Motors1-12, Motors2-12, Motors3-12); |
138 | if(Motor[1].Current > Motors1max) Motors1max = Motor[1].Current; |
127 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motors4-12, Motors5-12, Motors6-12, Motors6-12); |
139 | if(Motor[2].Current > Motors2max) Motors2max = Motor[2].Current; |
- | 140 | if(Motor[3].Current > Motors3max) Motors3max = Motor[3].Current; |
|
- | 141 | if(Motor[4].Current > Motors4max) Motors4max = Motor[4].Current; |
|
- | 142 | if(Motor[5].Current > Motors5max) Motors5max = Motor[5].Current; |
|
- | 143 | if(Motor[6].Current > Motors6max) Motors6max = Motor[6].Current; |
|
- | 144 | if(Motor[7].Current > Motors7max) Motors7max = Motor[7].Current; |
|
- | 145 | ||
- | 146 | if(!MotorenEin) |
|
- | 147 | { |
|
- | 148 | Motors0=Motors0max;Motors1=Motors1max;Motors2=Motors2max;Motors3=Motors3max;Motors4=Motors4max;Motors5=Motors5max;Motors6=Motors6max;Motors7=Motors7max; |
|
- | 149 | } |
|
- | 150 | ||
- | 151 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motors0-(CurrentOffset/RequiredMotors), Motors1-(CurrentOffset/RequiredMotors), Motors2-(CurrentOffset/RequiredMotors), Motors3-(CurrentOffset/RequiredMotors)); |
|
- | 152 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motors4-(CurrentOffset/RequiredMotors), Motors5-(CurrentOffset/RequiredMotors), Motors6-(CurrentOffset/RequiredMotors), Motors6-(CurrentOffset/RequiredMotors)); |
|
- | 153 | ||
128 | if(RequiredMotors <= 4) |
154 | if(RequiredMotors <= 4) |
129 | { |
155 | { |
130 | JetiBox_printfxy(0,1,"Currents "); |
156 | JetiBox_printfxy(0,1,"Currents T%3i.%1iA",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
131 | } |
157 | } |
- | 158 | ||
132 | else |
159 | else |
133 | if(RequiredMotors <= 6) |
160 | if(RequiredMotors <= 6) |
134 | { |
161 | { |
135 | JetiBox_printfxy(8,1,"%3i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
162 | JetiBox_printfxy(8,1,"%3i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
136 | } |
163 | } |
137 | 164 | ||
138 | if(key== JETIBOX_KEY_UP) updatemotors = updatemotors+1; |
165 | if(key== JETIBOX_KEY_UP) updatemotors = updatemotors+1; |
139 | if(key== JETIBOX_KEY_DOWN) updatemotors = updatemotors-1; |
166 | if(key== JETIBOX_KEY_DOWN) updatemotors = updatemotors-1; |
140 | } |
167 | } |
141 | 168 | ||
142 | 169 | ||
143 | void Menu_keynumber(uint8_t key) |
170 | void Menu_keynumber(uint8_t key) |
144 | { |
171 | { |
145 | pos1=0;pos2=0;pos3=0;pos4=0; |
172 | pos1=0;pos2=0;pos3=0;pos4=0; |
146 | if(keynumber <= 0 ) keynumber=1; |
173 | if(keynumber <= 0 ) keynumber=1; |
147 | if(keynumber >= 5 ) keynumber=1; |
174 | if(keynumber >= 5 ) keynumber=1; |
148 | if(keynumber== 1) pos1=0X3E;if(keynumber== 2) pos2=0X3E;if(keynumber== 3) pos3=0X3E;if(keynumber== 4) pos4=0X3E; |
175 | if(keynumber== 1) pos1=0X3E;if(keynumber== 2) pos2=0X3E;if(keynumber== 3) pos3=0X3E;if(keynumber== 4) pos4=0X3E; |
149 | if(key== JETIBOX_KEY_LEFT) keynumber--; |
176 | if(key== JETIBOX_KEY_LEFT) keynumber--; |
150 | if(key== JETIBOX_KEY_RIGHT) keynumber++; |
177 | if(key== JETIBOX_KEY_RIGHT) keynumber++; |
151 | } |
178 | } |
152 | 179 | ||
153 | 180 | ||
154 | void Menu_I2C(uint8_t key) |
181 | void Menu_I2C(uint8_t key) |
155 | { //0123456789ABCDEF |
182 | { //0123456789ABCDEF |
156 | 183 | ||
157 | JetiBox_printfxy(0,0,"I2C%3i%3i%3i%3i",Motor[0].State & MOTOR_STATE_ERROR_MASK,Motor[1].State & MOTOR_STATE_ERROR_MASK, Motor[2].State & MOTOR_STATE_ERROR_MASK, Motor[3].State & MOTOR_STATE_ERROR_MASK); |
184 | JetiBox_printfxy(0,0,"I2C%3i%3i%3i%3i",Motor[0].State & MOTOR_STATE_ERROR_MASK,Motor[1].State & MOTOR_STATE_ERROR_MASK, Motor[2].State & MOTOR_STATE_ERROR_MASK, Motor[3].State & MOTOR_STATE_ERROR_MASK); |
158 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i",Motor[4].State & MOTOR_STATE_ERROR_MASK,Motor[5].State & MOTOR_STATE_ERROR_MASK, Motor[6].State & MOTOR_STATE_ERROR_MASK, Motor[7].State & MOTOR_STATE_ERROR_MASK); |
185 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i",Motor[4].State & MOTOR_STATE_ERROR_MASK,Motor[5].State & MOTOR_STATE_ERROR_MASK, Motor[6].State & MOTOR_STATE_ERROR_MASK, Motor[7].State & MOTOR_STATE_ERROR_MASK); |
159 | 186 | ||
160 | } |
187 | } |
161 | 188 | ||
162 | 189 | ||
163 | void Menu_SetPoint(uint8_t key) |
190 | void Menu_SetPoint(uint8_t key) |
164 | { //0123456789ABCDEF |
191 | { //0123456789ABCDEF |
165 | 192 | ||
166 | loop1 ++; |
193 | loop1 ++; |
167 | if(loop1 >= updatemotors) |
194 | if(loop1 >= updatemotors) |
168 | { |
195 | { |
169 | loop1=0; |
196 | loop1=0; |
170 | Motors0 =Motor[0].SetPoint; |
197 | Motors0 =Motor[0].SetPoint; |
171 | Motors1 =Motor[1].SetPoint; |
198 | Motors1 =Motor[1].SetPoint; |
172 | Motors2 =Motor[2].SetPoint; |
199 | Motors2 =Motor[2].SetPoint; |
173 | Motors3 =Motor[3].SetPoint; |
200 | Motors3 =Motor[3].SetPoint; |
174 | Motors4 =Motor[4].SetPoint; |
201 | Motors4 =Motor[4].SetPoint; |
175 | Motors5 =Motor[5].SetPoint; |
202 | Motors5 =Motor[5].SetPoint; |
176 | Motors6 =Motor[6].SetPoint; |
203 | Motors6 =Motor[6].SetPoint; |
177 | Motors7 =Motor[7].SetPoint; |
204 | Motors7 =Motor[7].SetPoint; |
178 | } |
205 | } |
179 | 206 | ||
180 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motors0, Motors1, Motors2, Motors3); |
207 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motors0, Motors1, Motors2, Motors3); |
181 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motors4, Motors5, Motors6, Motors7); |
208 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motors4, Motors5, Motors6, Motors7); |
182 | if(RequiredMotors <= 4) |
209 | if(RequiredMotors <= 4) |
183 | { |
210 | { |
184 | JetiBox_printfxy(0,1,"M SetPoint "); |
211 | JetiBox_printfxy(0,1,"M SetPoint "); |
185 | } |
212 | } |
186 | else |
213 | else |
187 | if(RequiredMotors <= 6) |
214 | if(RequiredMotors <= 6) |
188 | { |
215 | { |
189 | JetiBox_printfxy(8,1,"MSetP%3i",updatemotors); |
216 | JetiBox_printfxy(8,1,"MSetP%3i",updatemotors); |
190 | } |
217 | } |
191 | 218 | ||
192 | /* |
219 | /* |
193 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].SetPoint, Motor[1].SetPoint, Motor[2].SetPoint, Motor[3].SetPoint); |
220 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].SetPoint, Motor[1].SetPoint, Motor[2].SetPoint, Motor[3].SetPoint); |
194 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].SetPoint, Motor[5].SetPoint, Motor[6].SetPoint, Motor[7].SetPoint); |
221 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].SetPoint, Motor[5].SetPoint, Motor[6].SetPoint, Motor[7].SetPoint); |
195 | if(RequiredMotors <= 4) |
222 | if(RequiredMotors <= 4) |
196 | { |
223 | { |
197 | JetiBox_printfxy(0,1,"M SetPoint "); |
224 | JetiBox_printfxy(0,1,"M SetPoint "); |
198 | } |
225 | } |
199 | else |
226 | else |
200 | if(RequiredMotors <= 6) |
227 | if(RequiredMotors <= 6) |
201 | { |
228 | { |
202 | JetiBox_printfxy(8,1,"MSetP "); |
229 | JetiBox_printfxy(8,1,"MSetP "); |
203 | } |
230 | } |
204 | */ |
231 | */ |
205 | 232 | ||
206 | if(key== JETIBOX_KEY_UP) updatemotors = updatemotors+1; |
233 | if(key== JETIBOX_KEY_UP) updatemotors = updatemotors+1; |
207 | if(key== JETIBOX_KEY_DOWN) updatemotors = updatemotors-1; |
234 | if(key== JETIBOX_KEY_DOWN) updatemotors = updatemotors-1; |
208 | 235 | ||
209 | } |
236 | } |
210 | 237 | ||
211 | void Menu_Integal(uint8_t key) |
238 | void Menu_Integal(uint8_t key) |
212 | { //0123456789ABCDEF |
239 | { //0123456789ABCDEF |
213 | int r=0; |
240 | int r=0; |
214 | int n=0; |
241 | int n=0; |
215 | int g=0; |
242 | int g=0; |
216 | n=SummeNick >> 9; |
243 | n=SummeNick >> 9; |
217 | r=SummeRoll >> 9; |
244 | r=SummeRoll >> 9; |
218 | g=Mess_Integral_Gier >> 9; |
245 | g=Mess_Integral_Gier >> 9; |
219 | 246 | ||
220 | JetiBox_printfxy(0,0,"%3iN %3iR +N",n, r); |
247 | JetiBox_printfxy(0,0,"%3iN %3iR +N",n, r); |
221 | JetiBox_printfxy(0,1,"%3iG +R -N -R",g); |
248 | JetiBox_printfxy(0,1,"%3iG +R -N -R",g); |
222 | } |
249 | } |
223 | 250 | ||
224 | void Menu_Info(uint8_t key) |
251 | void Menu_Info(uint8_t key) |
225 | { //0123456789ABCDEF |
252 | { //0123456789ABCDEF |
226 | 253 | ||
227 | // JetiBox_printfxy(0,0,"%3i=Hovergas",HoverGas); |
254 | JetiBox_printfxy(0,0,"%3i=VSpeed",VarioMeter); |
228 | JetiBox_printfxy(0,1,"%3i=HG/4 %3i=Gas",HoverGas/4,StickGas); |
255 | JetiBox_printfxy(0,1,"%3i=HG/4 %3i=Gas",HoverGas/4,StickGas); |
229 | } |
- | |
230 | /* |
- | |
231 | void Menu_spoti1(uint8_t key) |
- | |
232 | { //0123456789ABCDEF |
- | |
233 | - | ||
234 | JetiBox_printfxy(0,0,">%3i=SPot1",PPM_in[13]); |
- | |
235 | JetiBox_printfxy(0,1," %3i=SPot2",PPM_in[14]); |
- | |
236 | if(key== JETIBOX_KEY_UP) PPM_in[13] = PPM_in[13]+1; |
- | |
237 | if(key== JETIBOX_KEY_DOWN) PPM_in[13] = PPM_in[13]-1; |
- | |
238 | } |
- | |
239 | - | ||
240 | void Menu_spoti2(uint8_t key) |
- | |
241 | { //0123456789ABCDEF |
- | |
242 | - | ||
243 | JetiBox_printfxy(0,0," %3i=SPot1",PPM_in[13]); |
- | |
244 | JetiBox_printfxy(0,1,">%3i=SPot2",PPM_in[14],key); |
256 | } |
245 | if(key== JETIBOX_KEY_UP) PPM_in[14] = PPM_in[14]+5; |
257 | |
246 | if(key== JETIBOX_KEY_DOWN) PPM_in[14] = PPM_in[14]-5; |
258 | |
247 | } |
259 | |
248 | 260 | ||
249 | */ |
261 | |
250 | void Menu_Serialpoti(uint8_t key) |
262 | void Menu_Serialpoti(uint8_t key) |
251 | { |
263 | { |
252 | Menu_keynumber(key); |
264 | Menu_keynumber(key); |
253 | 265 | ||
254 | JetiBox_printfxy(0,0,"%c%3i=SP1%c%3i=SP3",pos1,PPM_in[13],pos3,PPM_in[15]); |
266 | JetiBox_printfxy(0,0,"%c%3i=SP1%c%3i=SP3",pos1,PPM_in[13]+127,pos3,PPM_in[15]+127); |
255 | JetiBox_printfxy(0,1,"%c%3i=SP2%c%3i=SP4",pos2,PPM_in[14],pos4,PPM_in[16]); |
267 | JetiBox_printfxy(0,1,"%c%3i=SP2%c%3i=SP4",pos2,PPM_in[14]+127,pos4,PPM_in[16]+127); |
256 | 268 | ||
257 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) PPM_in[13] ++; |
269 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) PPM_in[13] ++; |
258 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) PPM_in[13] --; |
270 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) PPM_in[13] --; |
259 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) PPM_in[14] ++; |
271 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) PPM_in[14] ++; |
260 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) PPM_in[14] --; |
272 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) PPM_in[14] --; |
261 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) PPM_in[15] ++; |
273 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) PPM_in[15] ++; |
262 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) PPM_in[15] --; |
274 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) PPM_in[15] --; |
263 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) PPM_in[16] ++; |
275 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) PPM_in[16] ++; |
264 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) PPM_in[16] --; |
276 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) PPM_in[16] --; |
265 | } |
277 | } |
266 | 278 | ||
267 | 279 | ||
268 | void Menu_hoeheconf(uint8_t key) |
280 | void Menu_hoeheconf(uint8_t key) |
- | 281 | { |
|
269 | { //0123456789ABCDEF |
282 | /*/ //0123456789ABCDEF |
- | 283 | //CFG2_HEIGHT_LIMIT | CFG2_VARIO_BEEP | CFG_SENSITIVE_RC |
|
- | 284 | ||
- | 285 | SENSITIVE_RC on/off |VARIO_BEEP on/off| sw Height= 1 Vario Height = 0; |
|
- | 286 | bit 2 1 0 |
|
- | 287 | 000 0 rcoff Beepoff h |
|
- | 288 | 001 1 rcoff Beepoff v |
|
- | 289 | 010 2 rcoff Beepon h |
|
- | 290 | 011 3 rcoff Beepon v |
|
- | 291 | 100 4 rcon Beepoff h |
|
- | 292 | 101 5 rcon Beepoff v |
|
- | 293 | 110 6 rcon Beepon h |
|
- | 294 | 111 7 rcon Beepon v |
|
- | 295 | ||
- | 296 | /*/ |
|
- | 297 | ||
- | 298 | //JetiBox_printfxy(0,0,"%3i econf",EE_Parameter.ExtraConfig); |
|
- | 299 | //JetiBox_printfxy(0,1,"%3i=beep %3ideckel",(EE_Parameter.ExtraConfig & CFG2_VARIO_BEEP),(EE_Parameter.ExtraConfig & CFG2_HEIGHT_LIMIT)); |
|
- | 300 | ||
270 | if(EE_Parameter.ExtraConfig == 3 || EE_Parameter.ExtraConfig == 1) //EE_Parameter.ExtraConfig == 1 =switched Hightv+ variopiepser |
301 | if((EE_Parameter.ExtraConfig & CFG2_HEIGHT_LIMIT) == 1) //EE_Parameter.ExtraConfig == 1 =switched Hightv+ variopiepser |
271 | { |
302 | { |
272 | JetiBox_printfxy(0,0,"switched Hight v"); |
303 | JetiBox_printfxy(0,0,"switched Hight v"); |
273 | } |
304 | } |
- | 305 | ||
274 | if(EE_Parameter.ExtraConfig == 2 || EE_Parameter.ExtraConfig == 0) |
306 | if((EE_Parameter.ExtraConfig & CFG2_HEIGHT_LIMIT) == 0) |
275 | { |
307 | { |
276 | JetiBox_printfxy(0,1,"Vario withbeep ^"); |
308 | JetiBox_printfxy(0,1,"Vario withbeep ^"); |
277 | } |
309 | } |
278 | /*/ |
310 | |
- | 311 | if(key== JETIBOX_KEY_UP) EE_Parameter.ExtraConfig |= (1 << 0) ;// set bit 0 |
|
279 | vario =0 |
312 | |
280 | vario und ton 2 |
- | |
281 | nur hohe = 1 |
- | |
282 | höhe mit schalter=1 |
- | |
283 | höhe mit variopiep =3 |
313 | if(key== JETIBOX_KEY_DOWN) |
284 | /*/ |
314 | { |
285 | if(key== JETIBOX_KEY_UP) EE_Parameter.ExtraConfig = 3; |
315 | EE_Parameter.ExtraConfig &= ~(1 << 0) ; //delete bit 0 |
286 | if(key== JETIBOX_KEY_DOWN) EE_Parameter.ExtraConfig = 2; |
316 | EE_Parameter.ExtraConfig |= (1 << 1) ; //set bit 1 +piep |
- | 317 | } |
|
287 | } |
318 | } |
288 | 319 | ||
289 | 320 | ||
290 | 321 | ||
291 | void Menu_hoehe1(uint8_t key) |
322 | void Menu_hoehe1(uint8_t key) |
292 | { |
323 | { |
293 | Menu_keynumber(key); |
324 | Menu_keynumber(key); |
294 | 325 | ||
295 | JetiBox_printfxy(0,0,"%c%3i=HD %c%3i=HA",pos1,EE_Parameter.Luftdruck_D,pos3,EE_Parameter.Hoehe_ACC_Wirkung); |
326 | JetiBox_printfxy(0,0,"%c%3i=HD %c%3i=HA",pos1,EE_Parameter.Luftdruck_D,pos3,EE_Parameter.Hoehe_ACC_Wirkung); |
296 | JetiBox_printfxy(0,1,"%c%3i=HP %c%3i=HM",pos2,EE_Parameter.Hoehe_P,pos4,EE_Parameter.Hoehe_MinGas); |
327 | JetiBox_printfxy(0,1,"%c%3i=HP %c%3i=HM",pos2,EE_Parameter.Hoehe_P,pos4,EE_Parameter.Hoehe_MinGas); |
297 | 328 | ||
298 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Luftdruck_D ++; |
329 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Luftdruck_D ++; |
299 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Luftdruck_D --; |
330 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Luftdruck_D --; |
300 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Hoehe_P ++; |
331 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Hoehe_P ++; |
301 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Hoehe_P --; |
332 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Hoehe_P --; |
302 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Hoehe_ACC_Wirkung ++; |
333 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Hoehe_ACC_Wirkung ++; |
303 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Hoehe_ACC_Wirkung --; |
334 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Hoehe_ACC_Wirkung --; |
304 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.Hoehe_MinGas ++; |
335 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.Hoehe_MinGas ++; |
305 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.Hoehe_MinGas --; |
336 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.Hoehe_MinGas --; |
306 | } |
337 | } |
307 | 338 | ||
308 | 339 | ||
309 | void Menu_hoehe2(uint8_t key) |
340 | void Menu_hoehe2(uint8_t key) |
310 | { |
341 | { |
311 | Menu_keynumber(key); |
342 | Menu_keynumber(key); |
312 | 343 | ||
313 | JetiBox_printfxy(0,0,"%c%3i=HV %c%3i=HZ",pos1,EE_Parameter.Hoehe_HoverBand,pos3,EE_Parameter.Hoehe_GPS_Z); |
344 | JetiBox_printfxy(0,0,"%c%3i=HV %c%3i=HZ",pos1,EE_Parameter.Hoehe_HoverBand,pos3,EE_Parameter.Hoehe_GPS_Z); |
314 | JetiBox_printfxy(0,1,"%c%3i=HG %c%3i=HS",pos2,EE_Parameter.Hoehe_Verstaerkung,pos4,EE_Parameter.MaxHoehe); |
345 | JetiBox_printfxy(0,1,"%c%3i=HG %c%3i=HS",pos2,EE_Parameter.Hoehe_Verstaerkung,pos4,EE_Parameter.MaxHoehe); |
315 | 346 | ||
316 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Hoehe_HoverBand ++; |
347 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Hoehe_HoverBand ++; |
317 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Hoehe_HoverBand --; |
348 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Hoehe_HoverBand --; |
318 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Hoehe_Verstaerkung ++; |
349 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Hoehe_Verstaerkung ++; |
319 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Hoehe_Verstaerkung --; |
350 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Hoehe_Verstaerkung --; |
320 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Hoehe_GPS_Z ++; |
351 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Hoehe_GPS_Z ++; |
321 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Hoehe_GPS_Z --; |
352 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Hoehe_GPS_Z --; |
322 | //if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.MaxHoehe ++; |
353 | //if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.MaxHoehe ++; |
323 | //if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.MaxHoehe --; |
354 | //if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.MaxHoehe --; |
324 | } |
355 | } |
325 | 356 | ||
326 | 357 | ||
327 | void Menu_stick(uint8_t key) |
358 | void Menu_stick(uint8_t key) |
328 | { |
359 | { |
329 | Menu_keynumber(key); |
360 | Menu_keynumber(key); |
330 | 361 | ||
331 | JetiBox_printfxy(0,0,"%c%3i=StP%c%3i=SGP",pos1,EE_Parameter.Stick_P,pos3,EE_Parameter.Gier_P); |
362 | JetiBox_printfxy(0,0,"%c%3i=StP%c%3i=SGP",pos1,EE_Parameter.Stick_P,pos3,EE_Parameter.Gier_P); |
332 | JetiBox_printfxy(0,1,"%c%3i=StD%c%3i=DrC",pos2,EE_Parameter.Stick_D,pos4,EE_Parameter.Driftkomp); |
363 | JetiBox_printfxy(0,1,"%c%3i=StD%c%3i=DrC",pos2,EE_Parameter.Stick_D,pos4,EE_Parameter.Driftkomp); |
333 | 364 | ||
334 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Stick_P ++; |
365 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Stick_P ++; |
335 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Stick_P --; |
366 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Stick_P --; |
336 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Stick_D ++; |
367 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Stick_D ++; |
337 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Stick_D --; |
368 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Stick_D --; |
338 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Gier_P ++; |
369 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Gier_P ++; |
339 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Gier_P --; |
370 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Gier_P --; |
340 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.Driftkomp ++; |
371 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.Driftkomp ++; |
341 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.Driftkomp --; |
372 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.Driftkomp --; |
342 | } |
373 | } |
343 | 374 | ||
344 | 375 | ||
345 | 376 | ||
346 | void Menu_gyro(uint8_t key) |
377 | void Menu_gyro(uint8_t key) |
347 | { |
378 | { |
348 | Menu_keynumber(key); |
379 | Menu_keynumber(key); |
349 | 380 | ||
350 | 381 | ||
351 | JetiBox_printfxy(0,0,"%c%3i=GYP%c%3i=GYI",pos1,EE_Parameter.Gyro_P,pos3,EE_Parameter.Gyro_I); |
382 | JetiBox_printfxy(0,0,"%c%3i=GYP%c%3i=GYI",pos1,EE_Parameter.Gyro_P,pos3,EE_Parameter.Gyro_I); |
352 | JetiBox_printfxy(0,1,"%c%3i=GYD%c%3i=MaI",pos2,EE_Parameter.Gyro_D,pos4,EE_Parameter.I_Faktor); |
383 | JetiBox_printfxy(0,1,"%c%3i=GYD%c%3i=MaI",pos2,EE_Parameter.Gyro_D,pos4,EE_Parameter.I_Faktor); |
353 | 384 | ||
354 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Gyro_P ++; |
385 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Gyro_P ++; |
355 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Gyro_P --; |
386 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Gyro_P --; |
356 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Gyro_D ++; |
387 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Gyro_D ++; |
357 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Gyro_D --; |
388 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Gyro_D --; |
358 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Gyro_I ++; |
389 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Gyro_I ++; |
359 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Gyro_I --; |
390 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Gyro_I --; |
360 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.I_Faktor ++; |
391 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.I_Faktor ++; |
361 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.I_Faktor --; |
392 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.I_Faktor --; |
362 | } |
393 | } |
363 | 394 | ||
364 | void Menu_gps(uint8_t key) |
395 | void Menu_gps(uint8_t key) |
365 | { |
396 | { |
366 | Menu_keynumber(key); |
397 | Menu_keynumber(key); |
367 | 398 | ||
368 | 399 | ||
369 | JetiBox_printfxy(0,0,"%c%3i=NGG%c%3i=NSC",pos1,EE_Parameter.NaviGpsGain,pos3,EE_Parameter.NaviSpeedCompensation); |
400 | JetiBox_printfxy(0,0,"%c%3i=NGG%c%3i=NSC",pos1,EE_Parameter.NaviGpsGain,pos3,EE_Parameter.NaviSpeedCompensation); |
370 | JetiBox_printfxy(0,1,"%c%3i=NWC%c%3i=NAL",pos2,EE_Parameter.NaviWindCorrection,pos4,EE_Parameter.NaviAngleLimitation); |
401 | JetiBox_printfxy(0,1,"%c%3i=NWC%c%3i=NAL",pos2,EE_Parameter.NaviWindCorrection,pos4,EE_Parameter.NaviAngleLimitation); |
371 | 402 | ||
372 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.NaviGpsGain ++; |
403 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.NaviGpsGain ++; |
373 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.NaviGpsGain --; |
404 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.NaviGpsGain --; |
374 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.NaviWindCorrection ++; |
405 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.NaviWindCorrection ++; |
375 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.NaviWindCorrection --; |
406 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.NaviWindCorrection --; |
376 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.NaviSpeedCompensation ++; |
407 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.NaviSpeedCompensation ++; |
377 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.NaviSpeedCompensation --; |
408 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.NaviSpeedCompensation --; |
378 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation ++; |
409 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation ++; |
379 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation --; |
410 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation --; |
380 | } |
411 | } |
381 | 412 | ||
382 | 413 | ||
383 | void Menu_LOOPconf(uint8_t key) |
414 | void Menu_LOOPconf(uint8_t key) |
384 | { //0123456789ABCDEF |
415 | { //0123456789ABCDEF |
385 | 416 | ||
386 | JetiBox_printfxy(0,0," "); |
417 | JetiBox_printfxy(0,0," "); |
387 | 418 | ||
388 | if(EE_Parameter.BitConfig & CFG_LOOP_LINKS) |
419 | if(EE_Parameter.BitConfig & CFG_LOOP_LINKS) |
389 | { |
420 | { |
390 | LIBFC_JetiBox_Putchar(0x3C); |
421 | LIBFC_JetiBox_Putchar(0x3C); |
391 | LIBFC_JetiBox_Putchar(0x00); |
422 | LIBFC_JetiBox_Putchar(0x00); |
392 | 423 | ||
393 | } |
424 | } |
394 | 425 | ||
395 | if(EE_Parameter.BitConfig & CFG_LOOP_OBEN) |
426 | if(EE_Parameter.BitConfig & CFG_LOOP_OBEN) |
396 | { |
427 | { |
397 | LIBFC_JetiBox_Putchar(0X5E); |
428 | LIBFC_JetiBox_Putchar(0X5E); |
398 | LIBFC_JetiBox_Putchar(0x00); |
429 | LIBFC_JetiBox_Putchar(0x00); |
399 | 430 | ||
400 | } |
431 | } |
401 | 432 | ||
402 | if(EE_Parameter.BitConfig & CFG_LOOP_UNTEN) |
433 | if(EE_Parameter.BitConfig & CFG_LOOP_UNTEN) |
403 | { |
434 | { |
404 | LIBFC_JetiBox_Putchar(0x76); |
435 | LIBFC_JetiBox_Putchar(0x76); |
405 | LIBFC_JetiBox_Putchar(0x00); |
436 | LIBFC_JetiBox_Putchar(0x00); |
406 | 437 | ||
407 | } |
438 | } |
408 | 439 | ||
409 | if(EE_Parameter.BitConfig & CFG_LOOP_RECHTS) |
440 | if(EE_Parameter.BitConfig & CFG_LOOP_RECHTS) |
410 | { |
441 | { |
411 | LIBFC_JetiBox_Putchar(0X3E); |
442 | LIBFC_JetiBox_Putchar(0X3E); |
412 | } |
443 | } |
413 | 444 | ||
414 | JetiBox_printfxy(0,1,"Loopingvalue %2id",EE_Parameter.BitConfig); |
445 | JetiBox_printfxy(0,1,"Loopingvalue %2id",EE_Parameter.BitConfig); |
415 | 446 | ||
416 | if((key== JETIBOX_KEY_UP ) & (EE_Parameter.BitConfig <15 )) EE_Parameter.BitConfig ++; |
447 | if((key== JETIBOX_KEY_UP ) & (EE_Parameter.BitConfig <15 )) EE_Parameter.BitConfig ++; |
417 | if((key== JETIBOX_KEY_DOWN) & (EE_Parameter.BitConfig >0 )) EE_Parameter.BitConfig --; |
448 | if((key== JETIBOX_KEY_DOWN) & (EE_Parameter.BitConfig >0 )) EE_Parameter.BitConfig --; |
418 | } |
449 | } |
419 | 450 | ||
420 | 451 | ||
421 | void Menu_loopP(uint8_t key) |
452 | void Menu_loopP(uint8_t key) |
422 | { |
453 | { |
423 | Menu_keynumber(key); |
454 | Menu_keynumber(key); |
424 | 455 | ||
425 | JetiBox_printfxy(0,0,"%c%3i=LGL%c%3i=LHy",pos1,EE_Parameter.LoopGasLimit,pos3,EE_Parameter.LoopHysterese); |
456 | JetiBox_printfxy(0,0,"%c%3i=LGL%c%3i=LHy",pos1,EE_Parameter.LoopGasLimit,pos3,EE_Parameter.LoopHysterese); |
426 | JetiBox_printfxy(0,1,"%c%3i=LTh%c",pos2,EE_Parameter.LoopThreshold,pos4); |
457 | JetiBox_printfxy(0,1,"%c%3i=LTh%c",pos2,EE_Parameter.LoopThreshold,pos4); |
427 | 458 | ||
428 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.LoopGasLimit ++; |
459 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.LoopGasLimit ++; |
429 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.LoopGasLimit --; |
460 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.LoopGasLimit --; |
430 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.LoopThreshold ++; |
461 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.LoopThreshold ++; |
431 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.LoopThreshold --; |
462 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.LoopThreshold --; |
432 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.LoopHysterese ++; |
463 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.LoopHysterese ++; |
433 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.LoopHysterese --; |
464 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.LoopHysterese --; |
434 | //if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation ++; |
465 | //if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation ++; |
435 | //if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation --; |
466 | //if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation --; |
436 | } |
467 | } |
437 | 468 | ||
438 | 469 | ||
439 | void Menu_coup(uint8_t key) |
470 | void Menu_coup(uint8_t key) |
440 | { |
471 | { |
441 | Menu_keynumber(key); |
472 | Menu_keynumber(key); |
442 | 473 | ||
443 | JetiBox_printfxy(0,0,"%c%3i=FGP%c%3i=CYC",pos1,EE_Parameter.AchsKopplung1,pos3,EE_Parameter.CouplingYawCorrection); |
474 | JetiBox_printfxy(0,0,"%c%3i=FGP%c%3i=CYC",pos1,EE_Parameter.AchsKopplung1,pos3,EE_Parameter.CouplingYawCorrection); |
444 | JetiBox_printfxy(0,1,"%c%3i=FNR%c%3i=UP7",pos2,EE_Parameter.AchsKopplung2,pos4,EE_Parameter.UserParam7); |
475 | JetiBox_printfxy(0,1,"%c%3i=FNR%c%3i=UP7",pos2,EE_Parameter.AchsKopplung2,pos4,EE_Parameter.UserParam7); |
445 | 476 | ||
446 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.AchsKopplung1 ++; |
477 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.AchsKopplung1 ++; |
447 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.AchsKopplung1 --; |
478 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.AchsKopplung1 --; |
448 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.AchsKopplung2 ++; |
479 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.AchsKopplung2 ++; |
449 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.AchsKopplung2 --; |
480 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.AchsKopplung2 --; |
450 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.CouplingYawCorrection ++; |
481 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.CouplingYawCorrection ++; |
451 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.CouplingYawCorrection --; |
482 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.CouplingYawCorrection --; |
452 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.UserParam7 ++; |
483 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.UserParam7 ++; |
453 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.UserParam7 --; |
484 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.UserParam7 --; |
454 | } |
485 | } |
455 | 486 | ||
456 | void Menu_gyroGandStab(uint8_t key) |
487 | void Menu_gyroGandStab(uint8_t key) |
457 | { |
488 | { |
458 | Menu_keynumber(key); |
489 | Menu_keynumber(key); |
459 | 490 | ||
460 | JetiBox_printfxy(0,0,"%c%3i=GGP%c%3i=GSt",pos1,EE_Parameter.Gyro_Gier_P,pos3,EE_Parameter.Gyro_Stability); |
491 | JetiBox_printfxy(0,0,"%c%3i=GGP%c%3i=GSt",pos1,EE_Parameter.Gyro_Gier_P,pos3,EE_Parameter.Gyro_Stability); |
461 | JetiBox_printfxy(0,1,"%c%3i=GGI%c%3i=DSt",pos2,EE_Parameter.Gyro_Gier_I,pos4,EE_Parameter.DynamicStability); |
492 | JetiBox_printfxy(0,1,"%c%3i=GGI%c%3i=DSt",pos2,EE_Parameter.Gyro_Gier_I,pos4,EE_Parameter.DynamicStability); |
462 | 493 | ||
463 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Gyro_Gier_P ++; |
494 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Gyro_Gier_P ++; |
464 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Gyro_Gier_P --; |
495 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Gyro_Gier_P --; |
465 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Gyro_Gier_I ++; |
496 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Gyro_Gier_I ++; |
466 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Gyro_Gier_I --; |
497 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Gyro_Gier_I --; |
467 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3) & ( EE_Parameter.Gyro_Stability <15 )) EE_Parameter.Gyro_Stability ++; |
498 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3) & ( EE_Parameter.Gyro_Stability <15 )) EE_Parameter.Gyro_Stability ++; |
468 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3) & ( EE_Parameter.Gyro_Stability >0 )) EE_Parameter.Gyro_Stability --; |
499 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3) & ( EE_Parameter.Gyro_Stability >0 )) EE_Parameter.Gyro_Stability --; |
469 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.DynamicStability ++; |
500 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.DynamicStability ++; |
470 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.DynamicStability --; |
501 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.DynamicStability --; |
471 | } |
502 | } |
- | 503 | ||
- | 504 | void Menu_camera(uint8_t key) |
|
- | 505 | { |
|
- | 506 | Menu_keynumber(key); |
|
- | 507 | ||
- | 508 | JetiBox_printfxy(0,0,"%c%3i=NCT%c%3i=RCT",pos1,EE_Parameter.ServoNickControl,pos3,EE_Parameter.ServoRollControl); |
|
- | 509 | JetiBox_printfxy(0,1,"%c%3i=NCP%c%3i=RCP",pos2,EE_Parameter.ServoNickComp,pos4,EE_Parameter.ServoRollComp); |
|
- | 510 | ||
- | 511 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.ServoNickControl ++; // Wert : 0-247 // Stellung des Servos |
|
- | 512 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.ServoNickControl --; |
|
- | 513 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.ServoNickComp ++; // Wert : 0-247 // Einfluss Gyro/Servo |
|
- | 514 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.ServoNickComp --; |
|
- | 515 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.ServoRollControl ++; // Wert : 0-247 // Stellung des Servos |
|
- | 516 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.ServoRollControl --; |
|
- | 517 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.ServoRollComp ++; // Wert : 0-247 // Einfluss Gyro/Servo |
|
- | 518 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.ServoRollComp --; |
|
- | 519 | } |
|
- | 520 | ||
- | 521 | ||
- | 522 | ||
472 | 523 | ||
473 | void Menu_mtest(uint8_t key) |
524 | void Menu_mtest(uint8_t key) |
474 | { //0123456789ABCDEF |
525 | { //0123456789ABCDEF |
475 | //extern void LIBFC_JetiBox_Putchar(char c); |
526 | //extern void LIBFC_JetiBox_Putchar(char c); |
476 | 527 | ||
477 | PC_MotortestActive = 240; |
528 | PC_MotortestActive = 240; |
478 | 529 | ||
479 | JetiBox_printfxy(0,0,"Mtest <+v <+^"); |
530 | JetiBox_printfxy(0,0,"Mtest <+v <+^%3i",Motor[loop3].Current-(CurrentOffset/RequiredMotors)); //13 chars |
480 | JetiBox_printfxy(0,1,"Motor=%3i Sp=%2i",loop3+1, MotorTest[loop3]); |
531 | JetiBox_printfxy(0,1,"Motor=%2i Sp=%2i",loop3+1, MotorTest[loop3]); |
481 | 532 | ||
482 | if((key== JETIBOX_KEY_UP) & (loop2 <100 )) loop2=loop2 +2;//GESCHW |
533 | if((key== JETIBOX_KEY_UP) & (loop2 <100 )) loop2=loop2 +2;//GESCHW |
483 | if((key== JETIBOX_KEY_DOWN) & (loop2 >0 )) loop2=loop2 -2; |
534 | if((key== JETIBOX_KEY_DOWN) & (loop2 >0 )) loop2=loop2 -2; |
484 | 535 | ||
485 | if((key== JETIBOX_KEY_UPANDL) & (loop3 <15 )) loop3 ++;//motornummer |
536 | if((key== JETIBOX_KEY_UPANDL) & (loop3 <15 )) loop3 ++;//motornummer |
486 | if((key==JETIBOX_KEY_DownANDL) & (loop3 >0 )) loop3 --; |
537 | if((key==JETIBOX_KEY_DownANDL) & (loop3 >0 )) loop3 --; |
487 | MotorTest[loop3]=loop2; |
538 | MotorTest[loop3]=loop2; |
488 | 539 | ||
489 | } |
540 | } |
490 | 541 | ||
491 | void Menu_mem(uint8_t key) |
542 | void Menu_mem(uint8_t key) |
492 | { //0123456789ABCDEF |
- | |
493 | unsigned char i =0; |
- | |
494 | 543 | { |
|
495 | JetiBox_printfxy(0,0,"SETTING=%1i",GetActiveParamSet()); |
544 | JetiBox_printfxy(0,0,"SETTING=%1i",GetActiveParamSet()); |
496 | JetiBox_printfxy(0,1,"< and > to STORE"); |
545 | JetiBox_printfxy(0,1, "< + >toSTOREto %1i",settingdest); |
- | 546 | // 00123456789ABCDEF |
|
497 | //if(key== JETIBOX_KEY_DOWN ) |
547 | //if(key== JETIBOX_KEY_DOWN ) |
- | 548 | ||
498 | if(key== JETIBOX_KEY_LANDR && !MotorenEin) |
549 | if(key== JETIBOX_KEY_LANDR && !MotorenEin) |
499 | - | ||
500 | { |
550 | { |
501 | ParamSet_WriteToEEProm(GetActiveParamSet()); |
551 | ParamSet_WriteToEEProm(settingdest); |
502 | - | ||
503 | //for(i=0; i<5; i++) |
552 | Piep(GetActiveParamSet(),120); |
504 | //{ |
- | |
505 | JetiBox_printfxy(i,0,"OK!"); |
553 | JetiBox_printfxy(13,0,"OK!"); |
506 | //} |
554 | } |
507 | 555 | ||
508 | } |
- | |
- | 556 | if((key== JETIBOX_KEY_UP) & (settingdest <5 )) settingdest++; |
|
- | 557 | ||
- | 558 | ||
- | 559 | if((key== JETIBOX_KEY_DOWN) & (settingdest >1 )) settingdest--; |
|
509 | 560 | ||
510 | } |
561 | } |
511 | 562 | ||
512 | 563 | ||
513 | // ----------------------------------------------------------- |
564 | // ----------------------------------------------------------- |
514 | // the menu topology |
565 | // the menu topology |
515 | // ----------------------------------------------------------- |
566 | // ----------------------------------------------------------- |
516 | typedef void (*pFctMenu) (uint8_t); // the menu item handler function pointer |
567 | typedef void (*pFctMenu) (uint8_t); // the menu item handler function pointer |
517 | 568 | ||
518 | typedef struct{ |
569 | typedef struct{ |
519 | int8_t left; |
570 | int8_t left; |
520 | int8_t right; |
571 | int8_t right; |
521 | int8_t up; |
572 | int8_t up; |
522 | int8_t down; |
573 | int8_t down; |
523 | pFctMenu pHandler; |
574 | pFctMenu pHandler; |
524 | } MENU_ENTRY; |
575 | } MENU_ENTRY; |
525 | 576 | ||
526 | 577 | ||
527 | // the menu navigation structure |
578 | // the menu navigation structure |
528 | /* | |
579 | /* | |
529 | 580 | ||
530 | 3 - 0 - 1 - 2 - 3 - 0 |
581 | 3 - 0 - 1 - 2 - 3 - 0 |
531 | 582 | ||
532 | */ |
583 | */ |
533 | 584 | ||
534 | const MENU_ENTRY JetiBox_Menu[] PROGMEM= |
585 | const MENU_ENTRY JetiBox_Menu[] PROGMEM= |
535 | { // l r u d pHandler links rechts up down |
586 | { // l r u d pHandler links rechts up down |
536 | {23, 1, 0, 0, &Menu_Status }, // Seite 1 |
587 | {22, 1, 0, 0, &Menu_Status }, // Seite 1 |
537 | { 0, 2, 1, 1, &Menu_Temperature }, // 2 |
588 | { 0, 2, 1, 1, &Menu_Temperature }, // 2 |
538 | { 1, 3, 2, 2, &Menu_Battery }, // 3 |
589 | { 1, 3, 2, 2, &Menu_Battery }, // 3 |
539 | { 2, 4, 3, 3, &Menu_PosInfo }, // 4 |
590 | { 2, 4, 3, 3, &Menu_PosInfo }, // 4 |
540 | { 3, 5, 4, 4, &Menu_Current }, // 5 |
591 | { 3, 5, 4, 4, &Menu_Current }, // 5 |
541 | { 4, 6, 5, 5, &Menu_SetPoint }, // 6 |
592 | { 4, 6, 5, 5, &Menu_SetPoint }, // 6 |
542 | { 5, 7, 6, 6, &Menu_I2C }, // 7 |
593 | { 5, 7, 6, 6, &Menu_I2C }, // 7 |
543 | { 6, 8, 7, 7, &Menu_Integal }, // 8 |
594 | { 6, 8, 7, 7, &Menu_Integal }, // 8 |
544 | { 7, 9, 8, 8, &Menu_Info }, // 9 |
595 | { 7, 9, 8, 8, &Menu_Info }, // 9 |
545 | { 8, 10, 9, 9, &Menu_Serialpoti }, // 10 |
596 | { 8, 10, 9, 9, &Menu_Serialpoti }, // 10 |
546 | { 9, 11, 10, 10, &Menu_hoehe1 }, // 11 |
597 | { 9, 11, 10, 10, &Menu_hoehe1 }, // 11 |
547 | {10, 12, 11, 11, &Menu_hoehe2 }, // 12 |
598 | {10, 12, 11, 11, &Menu_hoehe2 }, // 12 |
548 | {11, 13, 12, 12, &Menu_stick }, // 13 |
599 | {11, 13, 12, 12, &Menu_stick }, // 13 |
549 | {12, 14, 13, 13, &Menu_gyro }, // 14 |
600 | {12, 14, 13, 13, &Menu_gyro }, // 14 |
550 | {13, 15, 14, 14, &Menu_gyroGandStab }, // 15 |
601 | {13, 15, 14, 14, &Menu_gyroGandStab }, // 15 |
551 | {14, 16, 15, 15, &Menu_gps }, // 16 |
602 | {14, 16, 15, 15, &Menu_gps }, // 16 |
552 | {15, 17, 16, 16, &Menu_loopP }, // 17 |
603 | {15, 17, 16, 16, &Menu_loopP }, // 17 |
553 | {16, 18, 17, 17, &Menu_coup }, // 18 |
604 | {16, 18, 17, 17, &Menu_coup }, // 18 |
554 | {17, 19, 18, 18, &Menu_LOOPconf }, // 19 |
605 | {17, 19, 18, 18, &Menu_camera }, // 19 |
555 | {18, 20, 19, 19, &Menu_hoeheconf }, // 20 |
606 | {18, 20, 19, 19, &Menu_LOOPconf }, // 20 |
556 | {19, 21, 20, 20, &Menu_mtest }, // 21 |
607 | {19, 21, 20, 20, &Menu_hoeheconf }, // 21 |
557 | {20, 22, 21, 21, &Menu_mem }, // 22 |
608 | {20, 22, 21, 21, &Menu_mtest }, // 22 |
558 | {21, 0, 22, 22, &Menu_mem }, // 23 |
609 | {21, 0, 22, 22, &Menu_mem }, // 23 |
559 | 610 | ||
560 | }; |
611 | }; |
561 | 612 | ||
562 | // ----------------------------------------------------------- |
613 | // ----------------------------------------------------------- |
563 | // Update display buffer |
614 | // Update display buffer |
564 | // ----------------------------------------------------------- |
615 | // ----------------------------------------------------------- |
565 | unsigned char JetiBox_Update(unsigned char key) |
616 | unsigned char JetiBox_Update(unsigned char key) |
566 | { |
617 | { |
567 | //printf(" %3i = keynumber, pos1 =%3i \n\r ", pos1); /// |
618 | //printf(" %3i = keynumber, pos1 =%3i \n\r ", pos1); /// |
568 | 619 | ||
569 | static uint8_t item = 0, last_item = 0; // the menu item |
620 | static uint8_t item = 0, last_item = 0; // the menu item |
570 | 621 | ||
571 | // navigate within the menu by key action |
622 | // navigate within the menu by key action |
572 | last_item = item; |
623 | last_item = item; |
573 | switch(key) |
624 | switch(key) |
574 | { |
625 | { |
575 | case JETIBOX_KEY_LEFT: |
626 | case JETIBOX_KEY_LEFT: |
576 | if (item == 0) return (1); // switch back to jeti expander menu |
627 | ///if (item == 0) return (1); // switch back to jeti expander menu, so no back possible |
577 | else |
628 | ///else |
578 | { |
629 | ///{ |
579 | if (keynumber <= 0 || keynumber >=5) //keynumber normaly 0, only in the parameter pages keyn=1...4 |
630 | if (keynumber <= 0 || keynumber >=5) //keynumber normaly 0, only in the parameter pages keyn=1...4 |
580 | { |
631 | { |
581 | item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
632 | item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
582 | } |
633 | } |
583 | } |
634 | ///} |
584 | 635 | ||
585 | break; |
636 | break; |
586 | case JETIBOX_KEY_RIGHT: |
637 | case JETIBOX_KEY_RIGHT: |
587 | if (keynumber <= 0 || keynumber >=5) |
638 | if (keynumber <= 0 || keynumber >=5) |
588 | { |
639 | { |
589 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
640 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
590 | } |
641 | } |
591 | break; |
642 | break; |
592 | case JETIBOX_KEY_UP: |
643 | case JETIBOX_KEY_UP: |
593 | item = pgm_read_byte(&JetiBox_Menu[item].up); //trigger to up menu item |
644 | item = pgm_read_byte(&JetiBox_Menu[item].up); //trigger to up menu item |
594 | break; |
645 | break; |
595 | case JETIBOX_KEY_DOWN: |
646 | case JETIBOX_KEY_DOWN: |
596 | item = pgm_read_byte(&JetiBox_Menu[item].down); //trigger to down menu item |
647 | item = pgm_read_byte(&JetiBox_Menu[item].down); //trigger to down menu item |
597 | break; |
648 | break; |
598 | 649 | ||
599 | case JETIBOX_KEY_NONE: /// |
650 | case JETIBOX_KEY_NONE: /// |
600 | if (keynumber == 5 ) |
651 | if (keynumber == 5 ) |
601 | { |
652 | { |
602 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
653 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
603 | keynumber=6; |
654 | keynumber=6; |
604 | } |
655 | } |
605 | 656 | ||
606 | if (keynumber == 0) //keynumber normaly 0, only in the parameter pages keyn=1...4 |
657 | if (keynumber == 0) //keynumber normaly 0, only in the parameter pages keyn=1...4 |
607 | { |
658 | { |
608 | item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
659 | item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
609 | keynumber=-1; |
660 | keynumber=-1; |
610 | 661 | ||
611 | } |
662 | } |
612 | break; |
663 | break; |
613 | 664 | ||
614 | default: |
665 | default: |
615 | break; |
666 | break; |
616 | } |
667 | } |
617 | // if the menu item has been changed, do not pass the key to the item handler |
668 | // if the menu item has been changed, do not pass the key to the item handler |
618 | // to avoid jumping over to items |
669 | // to avoid jumping over to items |
619 | if(item != last_item) key = JETIBOX_KEY_UNDEF; |
670 | if(item != last_item) key = JETIBOX_KEY_UNDEF; |
620 | 671 | ||
621 | LIBFC_JetiBox_Clear(); |
672 | LIBFC_JetiBox_Clear(); |
622 | //execute menu item handler |
673 | //execute menu item handler |
623 | ((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key); |
674 | ((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key); |
624 | 675 | ||
625 | return (0); |
676 | return (0); |
626 | } |
677 | } |
627 | 678 | ||
628 | 679 |