Rev 1749 | 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 |
1756 | - | 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 | { |
||
83 | JetiBox_printfxy(10,0,"%3i.%1iA",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
||
84 | } |
||
1739 | - | 85 | JetiBox_printfxy(0,1,"%4iW %6imAH",Capacity.ActualPower, Capacity.UsedCapacity); |
1756 | - | 86 | |
1500 | killagreg | 87 | } |
88 | |||
1680 | holgerb | 89 | |
1517 | killagreg | 90 | void Menu_PosInfo(uint8_t key) |
1484 | killagreg | 91 | { |
92 | if(NaviDataOkay) |
||
93 | { |
||
1690 | holgerb | 94 | JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
1517 | killagreg | 95 | switch (GPSInfo.SatFix) |
96 | { |
||
1690 | holgerb | 97 | case SATFIX_3D: |
98 | JetiBox_printfxy(12,0," 3D"); |
||
1517 | killagreg | 99 | break; |
1690 | holgerb | 100 | |
1517 | killagreg | 101 | case SATFIX_2D: |
1690 | holgerb | 102 | case SATFIX_NONE: |
1517 | killagreg | 103 | default: |
1690 | holgerb | 104 | JetiBox_printfxy(12,0,"NoFx"); |
1517 | killagreg | 105 | break; |
106 | } |
||
107 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
||
108 | { |
||
1690 | holgerb | 109 | JetiBox_printfxy(12,0,"DGPS"); |
1517 | killagreg | 110 | } |
1690 | holgerb | 111 | JetiBox_printfxy(0,1,"Home:%3dm %3d%c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF); |
1484 | killagreg | 112 | } |
113 | else |
||
1517 | killagreg | 114 | { //0123456789ABCDEF |
115 | JetiBox_printfxy(2,0,"No NaviCtrl!"); |
||
1484 | killagreg | 116 | } |
117 | } |
||
118 | |||
1749 | - | 119 | |
1739 | - | 120 | void Menu_Current(uint8_t key) |
121 | { //0123456789ABCDEF |
||
1749 | - | 122 | loop1 ++; |
1742 | - | 123 | |
1749 | - | 124 | if(loop1 >= updatemotors) |
125 | { |
||
126 | loop1=0; |
||
127 | Motors0 =Motor[0].Current; |
||
128 | Motors1 =Motor[1].Current; |
||
129 | Motors2 =Motor[2].Current; |
||
130 | Motors3 =Motor[3].Current; |
||
131 | Motors4 =Motor[4].Current; |
||
132 | Motors5 =Motor[5].Current; |
||
133 | Motors6 =Motor[6].Current; |
||
134 | Motors7 =Motor[7].Current; |
||
135 | } |
||
1756 | - | 136 | |
137 | if(Motor[0].Current > Motors0max) Motors0max = Motor[0].Current; |
||
138 | if(Motor[1].Current > Motors1max) Motors1max = Motor[1].Current; |
||
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 | |||
1742 | - | 154 | if(RequiredMotors <= 4) |
155 | { |
||
1756 | - | 156 | JetiBox_printfxy(0,1,"Currents T%3i.%1iA",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
1742 | - | 157 | } |
1756 | - | 158 | |
1742 | - | 159 | else |
160 | if(RequiredMotors <= 6) |
||
161 | { |
||
162 | JetiBox_printfxy(8,1,"%3i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
||
163 | } |
||
1749 | - | 164 | |
165 | if(key== JETIBOX_KEY_UP) updatemotors = updatemotors+1; |
||
166 | if(key== JETIBOX_KEY_DOWN) updatemotors = updatemotors-1; |
||
167 | } |
||
168 | |||
169 | |||
170 | void Menu_keynumber(uint8_t key) |
||
171 | { |
||
172 | pos1=0;pos2=0;pos3=0;pos4=0; |
||
173 | if(keynumber <= 0 ) keynumber=1; |
||
174 | if(keynumber >= 5 ) keynumber=1; |
||
175 | if(keynumber== 1) pos1=0X3E;if(keynumber== 2) pos2=0X3E;if(keynumber== 3) pos3=0X3E;if(keynumber== 4) pos4=0X3E; |
||
176 | if(key== JETIBOX_KEY_LEFT) keynumber--; |
||
177 | if(key== JETIBOX_KEY_RIGHT) keynumber++; |
||
178 | } |
||
179 | |||
180 | |||
181 | void Menu_I2C(uint8_t key) |
||
182 | { //0123456789ABCDEF |
||
183 | |||
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); |
||
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); |
||
1742 | - | 186 | |
1749 | - | 187 | } |
1742 | - | 188 | |
1749 | - | 189 | |
1739 | - | 190 | void Menu_SetPoint(uint8_t key) |
191 | { //0123456789ABCDEF |
||
192 | |||
1749 | - | 193 | loop1 ++; |
194 | if(loop1 >= updatemotors) |
||
195 | { |
||
196 | loop1=0; |
||
197 | Motors0 =Motor[0].SetPoint; |
||
198 | Motors1 =Motor[1].SetPoint; |
||
199 | Motors2 =Motor[2].SetPoint; |
||
200 | Motors3 =Motor[3].SetPoint; |
||
201 | Motors4 =Motor[4].SetPoint; |
||
202 | Motors5 =Motor[5].SetPoint; |
||
203 | Motors6 =Motor[6].SetPoint; |
||
204 | Motors7 =Motor[7].SetPoint; |
||
205 | } |
||
206 | |||
207 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motors0, Motors1, Motors2, Motors3); |
||
208 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motors4, Motors5, Motors6, Motors7); |
||
209 | if(RequiredMotors <= 4) |
||
210 | { |
||
211 | JetiBox_printfxy(0,1,"M SetPoint "); |
||
212 | } |
||
213 | else |
||
214 | if(RequiredMotors <= 6) |
||
215 | { |
||
216 | JetiBox_printfxy(8,1,"MSetP%3i",updatemotors); |
||
217 | } |
||
218 | |||
219 | /* |
||
220 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].SetPoint, Motor[1].SetPoint, Motor[2].SetPoint, Motor[3].SetPoint); |
||
221 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].SetPoint, Motor[5].SetPoint, Motor[6].SetPoint, Motor[7].SetPoint); |
||
222 | if(RequiredMotors <= 4) |
||
223 | { |
||
224 | JetiBox_printfxy(0,1,"M SetPoint "); |
||
225 | } |
||
226 | else |
||
227 | if(RequiredMotors <= 6) |
||
228 | { |
||
229 | JetiBox_printfxy(8,1,"MSetP "); |
||
230 | } |
||
231 | */ |
||
232 | |||
233 | if(key== JETIBOX_KEY_UP) updatemotors = updatemotors+1; |
||
234 | if(key== JETIBOX_KEY_DOWN) updatemotors = updatemotors-1; |
||
235 | |||
1739 | - | 236 | } |
237 | |||
238 | void Menu_Integal(uint8_t key) |
||
239 | { //0123456789ABCDEF |
||
240 | int r=0; |
||
241 | int n=0; |
||
242 | int g=0; |
||
243 | n=SummeNick >> 9; |
||
244 | r=SummeRoll >> 9; |
||
245 | g=Mess_Integral_Gier >> 9; |
||
246 | |||
247 | JetiBox_printfxy(0,0,"%3iN %3iR +N",n, r); |
||
248 | JetiBox_printfxy(0,1,"%3iG +R -N -R",g); |
||
249 | } |
||
250 | |||
251 | void Menu_Info(uint8_t key) |
||
252 | { //0123456789ABCDEF |
||
253 | |||
1756 | - | 254 | JetiBox_printfxy(0,0,"%3i=VSpeed",VarioMeter); |
1739 | - | 255 | JetiBox_printfxy(0,1,"%3i=HG/4 %3i=Gas",HoverGas/4,StickGas); |
256 | } |
||
257 | |||
258 | |||
259 | |||
1749 | - | 260 | |
1756 | - | 261 | |
1749 | - | 262 | void Menu_Serialpoti(uint8_t key) |
263 | { |
||
264 | Menu_keynumber(key); |
||
265 | |||
1756 | - | 266 | JetiBox_printfxy(0,0,"%c%3i=SP1%c%3i=SP3",pos1,PPM_in[13]+127,pos3,PPM_in[15]+127); |
267 | JetiBox_printfxy(0,1,"%c%3i=SP2%c%3i=SP4",pos2,PPM_in[14]+127,pos4,PPM_in[16]+127); |
||
1749 | - | 268 | |
269 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) PPM_in[13] ++; |
||
270 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) PPM_in[13] --; |
||
271 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) PPM_in[14] ++; |
||
272 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) PPM_in[14] --; |
||
273 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) PPM_in[15] ++; |
||
274 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) PPM_in[15] --; |
||
275 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) PPM_in[16] ++; |
||
276 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) PPM_in[16] --; |
||
277 | } |
||
278 | |||
279 | |||
280 | void Menu_hoeheconf(uint8_t key) |
||
1756 | - | 281 | { |
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 | |||
301 | if((EE_Parameter.ExtraConfig & CFG2_HEIGHT_LIMIT) == 1) //EE_Parameter.ExtraConfig == 1 =switched Hightv+ variopiepser |
||
1749 | - | 302 | { |
1756 | - | 303 | JetiBox_printfxy(0,0,"switched Hight v"); |
1749 | - | 304 | } |
1756 | - | 305 | |
306 | if((EE_Parameter.ExtraConfig & CFG2_HEIGHT_LIMIT) == 0) |
||
1749 | - | 307 | { |
308 | JetiBox_printfxy(0,1,"Vario withbeep ^"); |
||
309 | } |
||
1756 | - | 310 | |
311 | if(key== JETIBOX_KEY_UP) EE_Parameter.ExtraConfig |= (1 << 0) ;// set bit 0 |
||
312 | |||
313 | if(key== JETIBOX_KEY_DOWN) |
||
314 | { |
||
315 | EE_Parameter.ExtraConfig &= ~(1 << 0) ; //delete bit 0 |
||
316 | EE_Parameter.ExtraConfig |= (1 << 1) ; //set bit 1 +piep |
||
317 | } |
||
1749 | - | 318 | } |
1739 | - | 319 | |
1749 | - | 320 | |
321 | |||
322 | void Menu_hoehe1(uint8_t key) |
||
323 | { |
||
324 | Menu_keynumber(key); |
||
325 | |||
326 | JetiBox_printfxy(0,0,"%c%3i=HD %c%3i=HA",pos1,EE_Parameter.Luftdruck_D,pos3,EE_Parameter.Hoehe_ACC_Wirkung); |
||
327 | JetiBox_printfxy(0,1,"%c%3i=HP %c%3i=HM",pos2,EE_Parameter.Hoehe_P,pos4,EE_Parameter.Hoehe_MinGas); |
||
328 | |||
329 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Luftdruck_D ++; |
||
330 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Luftdruck_D --; |
||
331 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Hoehe_P ++; |
||
332 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Hoehe_P --; |
||
333 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Hoehe_ACC_Wirkung ++; |
||
334 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Hoehe_ACC_Wirkung --; |
||
335 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.Hoehe_MinGas ++; |
||
336 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.Hoehe_MinGas --; |
||
337 | } |
||
338 | |||
339 | |||
340 | void Menu_hoehe2(uint8_t key) |
||
341 | { |
||
342 | Menu_keynumber(key); |
||
343 | |||
344 | JetiBox_printfxy(0,0,"%c%3i=HV %c%3i=HZ",pos1,EE_Parameter.Hoehe_HoverBand,pos3,EE_Parameter.Hoehe_GPS_Z); |
||
345 | JetiBox_printfxy(0,1,"%c%3i=HG %c%3i=HS",pos2,EE_Parameter.Hoehe_Verstaerkung,pos4,EE_Parameter.MaxHoehe); |
||
346 | |||
347 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Hoehe_HoverBand ++; |
||
348 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Hoehe_HoverBand --; |
||
349 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Hoehe_Verstaerkung ++; |
||
350 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Hoehe_Verstaerkung --; |
||
351 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Hoehe_GPS_Z ++; |
||
352 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Hoehe_GPS_Z --; |
||
353 | //if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.MaxHoehe ++; |
||
354 | //if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.MaxHoehe --; |
||
355 | } |
||
356 | |||
357 | |||
358 | void Menu_stick(uint8_t key) |
||
359 | { |
||
360 | Menu_keynumber(key); |
||
361 | |||
362 | JetiBox_printfxy(0,0,"%c%3i=StP%c%3i=SGP",pos1,EE_Parameter.Stick_P,pos3,EE_Parameter.Gier_P); |
||
363 | JetiBox_printfxy(0,1,"%c%3i=StD%c%3i=DrC",pos2,EE_Parameter.Stick_D,pos4,EE_Parameter.Driftkomp); |
||
364 | |||
365 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Stick_P ++; |
||
366 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Stick_P --; |
||
367 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Stick_D ++; |
||
368 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Stick_D --; |
||
369 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Gier_P ++; |
||
370 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Gier_P --; |
||
371 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.Driftkomp ++; |
||
372 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.Driftkomp --; |
||
373 | } |
||
374 | |||
375 | |||
376 | |||
377 | void Menu_gyro(uint8_t key) |
||
378 | { |
||
379 | Menu_keynumber(key); |
||
380 | |||
381 | |||
382 | JetiBox_printfxy(0,0,"%c%3i=GYP%c%3i=GYI",pos1,EE_Parameter.Gyro_P,pos3,EE_Parameter.Gyro_I); |
||
383 | JetiBox_printfxy(0,1,"%c%3i=GYD%c%3i=MaI",pos2,EE_Parameter.Gyro_D,pos4,EE_Parameter.I_Faktor); |
||
384 | |||
385 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Gyro_P ++; |
||
386 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Gyro_P --; |
||
387 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Gyro_D ++; |
||
388 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Gyro_D --; |
||
389 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.Gyro_I ++; |
||
390 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.Gyro_I --; |
||
391 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.I_Faktor ++; |
||
392 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.I_Faktor --; |
||
393 | } |
||
394 | |||
395 | void Menu_gps(uint8_t key) |
||
396 | { |
||
397 | Menu_keynumber(key); |
||
398 | |||
399 | |||
400 | JetiBox_printfxy(0,0,"%c%3i=NGG%c%3i=NSC",pos1,EE_Parameter.NaviGpsGain,pos3,EE_Parameter.NaviSpeedCompensation); |
||
401 | JetiBox_printfxy(0,1,"%c%3i=NWC%c%3i=NAL",pos2,EE_Parameter.NaviWindCorrection,pos4,EE_Parameter.NaviAngleLimitation); |
||
402 | |||
403 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.NaviGpsGain ++; |
||
404 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.NaviGpsGain --; |
||
405 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.NaviWindCorrection ++; |
||
406 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.NaviWindCorrection --; |
||
407 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.NaviSpeedCompensation ++; |
||
408 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.NaviSpeedCompensation --; |
||
409 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation ++; |
||
410 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation --; |
||
411 | } |
||
412 | |||
413 | |||
414 | void Menu_LOOPconf(uint8_t key) |
||
415 | { //0123456789ABCDEF |
||
416 | |||
417 | JetiBox_printfxy(0,0," "); |
||
418 | |||
419 | if(EE_Parameter.BitConfig & CFG_LOOP_LINKS) |
||
420 | { |
||
421 | LIBFC_JetiBox_Putchar(0x3C); |
||
422 | LIBFC_JetiBox_Putchar(0x00); |
||
423 | |||
424 | } |
||
425 | |||
426 | if(EE_Parameter.BitConfig & CFG_LOOP_OBEN) |
||
427 | { |
||
428 | LIBFC_JetiBox_Putchar(0X5E); |
||
429 | LIBFC_JetiBox_Putchar(0x00); |
||
430 | |||
431 | } |
||
432 | |||
433 | if(EE_Parameter.BitConfig & CFG_LOOP_UNTEN) |
||
434 | { |
||
435 | LIBFC_JetiBox_Putchar(0x76); |
||
436 | LIBFC_JetiBox_Putchar(0x00); |
||
437 | |||
438 | } |
||
439 | |||
440 | if(EE_Parameter.BitConfig & CFG_LOOP_RECHTS) |
||
441 | { |
||
442 | LIBFC_JetiBox_Putchar(0X3E); |
||
443 | } |
||
444 | |||
445 | JetiBox_printfxy(0,1,"Loopingvalue %2id",EE_Parameter.BitConfig); |
||
446 | |||
447 | if((key== JETIBOX_KEY_UP ) & (EE_Parameter.BitConfig <15 )) EE_Parameter.BitConfig ++; |
||
448 | if((key== JETIBOX_KEY_DOWN) & (EE_Parameter.BitConfig >0 )) EE_Parameter.BitConfig --; |
||
1742 | - | 449 | } |
1749 | - | 450 | |
451 | |||
452 | void Menu_loopP(uint8_t key) |
||
453 | { |
||
454 | Menu_keynumber(key); |
||
455 | |||
456 | JetiBox_printfxy(0,0,"%c%3i=LGL%c%3i=LHy",pos1,EE_Parameter.LoopGasLimit,pos3,EE_Parameter.LoopHysterese); |
||
457 | JetiBox_printfxy(0,1,"%c%3i=LTh%c",pos2,EE_Parameter.LoopThreshold,pos4); |
||
458 | |||
459 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.LoopGasLimit ++; |
||
460 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.LoopGasLimit --; |
||
461 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.LoopThreshold ++; |
||
462 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.LoopThreshold --; |
||
463 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.LoopHysterese ++; |
||
464 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.LoopHysterese --; |
||
465 | //if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation ++; |
||
466 | //if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.NaviAngleLimitation --; |
||
467 | } |
||
468 | |||
469 | |||
470 | void Menu_coup(uint8_t key) |
||
471 | { |
||
472 | Menu_keynumber(key); |
||
473 | |||
474 | JetiBox_printfxy(0,0,"%c%3i=FGP%c%3i=CYC",pos1,EE_Parameter.AchsKopplung1,pos3,EE_Parameter.CouplingYawCorrection); |
||
475 | JetiBox_printfxy(0,1,"%c%3i=FNR%c%3i=UP7",pos2,EE_Parameter.AchsKopplung2,pos4,EE_Parameter.UserParam7); |
||
476 | |||
477 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.AchsKopplung1 ++; |
||
478 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.AchsKopplung1 --; |
||
479 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.AchsKopplung2 ++; |
||
480 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.AchsKopplung2 --; |
||
481 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3)) EE_Parameter.CouplingYawCorrection ++; |
||
482 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) EE_Parameter.CouplingYawCorrection --; |
||
483 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.UserParam7 ++; |
||
484 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.UserParam7 --; |
||
485 | } |
||
486 | |||
487 | void Menu_gyroGandStab(uint8_t key) |
||
488 | { |
||
489 | Menu_keynumber(key); |
||
490 | |||
491 | JetiBox_printfxy(0,0,"%c%3i=GGP%c%3i=GSt",pos1,EE_Parameter.Gyro_Gier_P,pos3,EE_Parameter.Gyro_Stability); |
||
492 | JetiBox_printfxy(0,1,"%c%3i=GGI%c%3i=DSt",pos2,EE_Parameter.Gyro_Gier_I,pos4,EE_Parameter.DynamicStability); |
||
493 | |||
494 | if((key== JETIBOX_KEY_UP ) & (keynumber ==1)) EE_Parameter.Gyro_Gier_P ++; |
||
495 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==1)) EE_Parameter.Gyro_Gier_P --; |
||
496 | if((key== JETIBOX_KEY_UP ) & (keynumber ==2)) EE_Parameter.Gyro_Gier_I ++; |
||
497 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==2)) EE_Parameter.Gyro_Gier_I --; |
||
498 | if((key== JETIBOX_KEY_UP ) & (keynumber ==3) & ( EE_Parameter.Gyro_Stability <15 )) EE_Parameter.Gyro_Stability ++; |
||
499 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3) & ( EE_Parameter.Gyro_Stability >0 )) EE_Parameter.Gyro_Stability --; |
||
500 | if((key== JETIBOX_KEY_UP ) & (keynumber ==4)) EE_Parameter.DynamicStability ++; |
||
501 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==4)) EE_Parameter.DynamicStability --; |
||
502 | } |
||
503 | |||
1756 | - | 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 | |||
523 | |||
1749 | - | 524 | void Menu_mtest(uint8_t key) |
1742 | - | 525 | { //0123456789ABCDEF |
1749 | - | 526 | //extern void LIBFC_JetiBox_Putchar(char c); |
527 | |||
528 | PC_MotortestActive = 240; |
||
529 | |||
1756 | - | 530 | JetiBox_printfxy(0,0,"Mtest <+v <+^%3i",Motor[loop3].Current-(CurrentOffset/RequiredMotors)); //13 chars |
531 | JetiBox_printfxy(0,1,"Motor=%2i Sp=%2i",loop3+1, MotorTest[loop3]); |
||
1742 | - | 532 | |
1749 | - | 533 | if((key== JETIBOX_KEY_UP) & (loop2 <100 )) loop2=loop2 +2;//GESCHW |
534 | if((key== JETIBOX_KEY_DOWN) & (loop2 >0 )) loop2=loop2 -2; |
||
535 | |||
536 | if((key== JETIBOX_KEY_UPANDL) & (loop3 <15 )) loop3 ++;//motornummer |
||
537 | if((key==JETIBOX_KEY_DownANDL) & (loop3 >0 )) loop3 --; |
||
538 | MotorTest[loop3]=loop2; |
||
539 | |||
1742 | - | 540 | } |
1749 | - | 541 | |
542 | void Menu_mem(uint8_t key) |
||
1756 | - | 543 | { |
1749 | - | 544 | JetiBox_printfxy(0,0,"SETTING=%1i",GetActiveParamSet()); |
1756 | - | 545 | JetiBox_printfxy(0,1, "< + >toSTOREto %1i",settingdest); |
546 | // 00123456789ABCDEF |
||
1749 | - | 547 | //if(key== JETIBOX_KEY_DOWN ) |
1756 | - | 548 | |
1749 | - | 549 | if(key== JETIBOX_KEY_LANDR && !MotorenEin) |
1756 | - | 550 | { |
551 | ParamSet_WriteToEEProm(settingdest); |
||
552 | Piep(GetActiveParamSet(),120); |
||
553 | JetiBox_printfxy(13,0,"OK!"); |
||
554 | } |
||
555 | |||
556 | if((key== JETIBOX_KEY_UP) & (settingdest <5 )) settingdest++; |
||
1749 | - | 557 | |
1756 | - | 558 | |
559 | if((key== JETIBOX_KEY_DOWN) & (settingdest >1 )) settingdest--; |
||
560 | |||
1749 | - | 561 | } |
562 | |||
563 | |||
1484 | killagreg | 564 | // ----------------------------------------------------------- |
565 | // the menu topology |
||
566 | // ----------------------------------------------------------- |
||
567 | typedef void (*pFctMenu) (uint8_t); // the menu item handler function pointer |
||
568 | |||
569 | typedef struct{ |
||
570 | int8_t left; |
||
571 | int8_t right; |
||
572 | int8_t up; |
||
573 | int8_t down; |
||
574 | pFctMenu pHandler; |
||
575 | } MENU_ENTRY; |
||
576 | |||
577 | |||
578 | // the menu navigation structure |
||
1517 | killagreg | 579 | /* | |
1484 | killagreg | 580 | |
1517 | killagreg | 581 | 3 - 0 - 1 - 2 - 3 - 0 |
582 | |||
1484 | killagreg | 583 | */ |
584 | |||
585 | const MENU_ENTRY JetiBox_Menu[] PROGMEM= |
||
1739 | - | 586 | { // l r u d pHandler links rechts up down |
1756 | - | 587 | {22, 1, 0, 0, &Menu_Status }, // Seite 1 |
1749 | - | 588 | { 0, 2, 1, 1, &Menu_Temperature }, // 2 |
589 | { 1, 3, 2, 2, &Menu_Battery }, // 3 |
||
590 | { 2, 4, 3, 3, &Menu_PosInfo }, // 4 |
||
591 | { 3, 5, 4, 4, &Menu_Current }, // 5 |
||
592 | { 4, 6, 5, 5, &Menu_SetPoint }, // 6 |
||
593 | { 5, 7, 6, 6, &Menu_I2C }, // 7 |
||
594 | { 6, 8, 7, 7, &Menu_Integal }, // 8 |
||
595 | { 7, 9, 8, 8, &Menu_Info }, // 9 |
||
596 | { 8, 10, 9, 9, &Menu_Serialpoti }, // 10 |
||
597 | { 9, 11, 10, 10, &Menu_hoehe1 }, // 11 |
||
598 | {10, 12, 11, 11, &Menu_hoehe2 }, // 12 |
||
599 | {11, 13, 12, 12, &Menu_stick }, // 13 |
||
600 | {12, 14, 13, 13, &Menu_gyro }, // 14 |
||
601 | {13, 15, 14, 14, &Menu_gyroGandStab }, // 15 |
||
602 | {14, 16, 15, 15, &Menu_gps }, // 16 |
||
603 | {15, 17, 16, 16, &Menu_loopP }, // 17 |
||
604 | {16, 18, 17, 17, &Menu_coup }, // 18 |
||
1756 | - | 605 | {17, 19, 18, 18, &Menu_camera }, // 19 |
606 | {18, 20, 19, 19, &Menu_LOOPconf }, // 20 |
||
607 | {19, 21, 20, 20, &Menu_hoeheconf }, // 21 |
||
608 | {20, 22, 21, 21, &Menu_mtest }, // 22 |
||
1749 | - | 609 | {21, 0, 22, 22, &Menu_mem }, // 23 |
610 | |||
1484 | killagreg | 611 | }; |
612 | |||
613 | // ----------------------------------------------------------- |
||
614 | // Update display buffer |
||
615 | // ----------------------------------------------------------- |
||
1583 | ingob | 616 | unsigned char JetiBox_Update(unsigned char key) |
1484 | killagreg | 617 | { |
1749 | - | 618 | //printf(" %3i = keynumber, pos1 =%3i \n\r ", pos1); /// |
619 | |||
1484 | killagreg | 620 | static uint8_t item = 0, last_item = 0; // the menu item |
621 | |||
622 | // navigate within the menu by key action |
||
623 | last_item = item; |
||
624 | switch(key) |
||
625 | { |
||
626 | case JETIBOX_KEY_LEFT: |
||
1756 | - | 627 | ///if (item == 0) return (1); // switch back to jeti expander menu, so no back possible |
628 | ///else |
||
629 | ///{ |
||
1749 | - | 630 | if (keynumber <= 0 || keynumber >=5) //keynumber normaly 0, only in the parameter pages keyn=1...4 |
631 | { |
||
632 | item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
||
633 | } |
||
1756 | - | 634 | ///} |
1749 | - | 635 | |
1484 | killagreg | 636 | break; |
637 | case JETIBOX_KEY_RIGHT: |
||
1749 | - | 638 | if (keynumber <= 0 || keynumber >=5) |
639 | { |
||
1484 | killagreg | 640 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
1749 | - | 641 | } |
1484 | killagreg | 642 | break; |
1742 | - | 643 | case JETIBOX_KEY_UP: |
1484 | killagreg | 644 | item = pgm_read_byte(&JetiBox_Menu[item].up); //trigger to up menu item |
645 | break; |
||
646 | case JETIBOX_KEY_DOWN: |
||
647 | item = pgm_read_byte(&JetiBox_Menu[item].down); //trigger to down menu item |
||
648 | break; |
||
1749 | - | 649 | |
650 | case JETIBOX_KEY_NONE: /// |
||
651 | if (keynumber == 5 ) |
||
652 | { |
||
653 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
||
654 | keynumber=6; |
||
655 | } |
||
656 | |||
657 | if (keynumber == 0) //keynumber normaly 0, only in the parameter pages keyn=1...4 |
||
658 | { |
||
659 | item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
||
660 | keynumber=-1; |
||
661 | |||
662 | } |
||
663 | break; |
||
664 | |||
1484 | killagreg | 665 | default: |
666 | break; |
||
667 | } |
||
668 | // if the menu item has been changed, do not pass the key to the item handler |
||
669 | // to avoid jumping over to items |
||
670 | if(item != last_item) key = JETIBOX_KEY_UNDEF; |
||
671 | |||
672 | LIBFC_JetiBox_Clear(); |
||
673 | //execute menu item handler |
||
674 | ((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key); |
||
1583 | ingob | 675 | |
676 | return (0); |
||
1484 | killagreg | 677 | } |
678 |