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