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