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