Rev 1742 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1742 | Rev 1749 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | #include "printf_P.h" |
3 | #include "printf_P.h" |
4 | #include "main.h" |
4 | #include "main.h" |
5 | #include "spi.h" |
5 | #include "spi.h" |
6 | #include "capacity.h" |
6 | #include "capacity.h" |
Line 7... | Line 7... | ||
7 | 7 | ||
8 | #define JETIBOX_KEY_RIGHT 0x1F |
8 | #define JETIBOX_KEY_RIGHT 0x1F // |
9 | #define JETIBOX_KEY_UP 0x2F |
9 | #define JETIBOX_KEY_UP 0x2F // 47 |
10 | #define JETIBOX_KEY_DOWN 0x4F |
10 | #define JETIBOX_KEY_DOWN 0x4F // |
11 | #define JETIBOX_KEY_LEFT 0x8F |
11 | #define JETIBOX_KEY_LEFT 0x8F // |
12 | #define JETIBOX_KEY_NONE 0x0F |
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 |
|
Line 13... | Line 20... | ||
13 | #define JETIBOX_KEY_UNDEF 0x00 |
20 | |
14 | 21 | ||
Line 15... | Line 22... | ||
15 | #define JetiBox_printfxy(x,y,format, args...) { LIBFC_JetiBox_SetPos(y * 16 + x); _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);} |
22 | #define JetiBox_printfxy(x,y,format, args...) { LIBFC_JetiBox_SetPos(y * 16 + x); _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);} |
16 | #define JetiBox_printf(format, args...) { _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);} |
23 | #define JetiBox_printf(format, args...) { _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);} |
17 | 24 | ||
Line -... | Line 25... | ||
- | 25 | // ----------------------------------------------------------- |
|
18 | // ----------------------------------------------------------- |
26 | // the menu functions |
- | 27 | // ----------------------------------------------------------- |
|
- | 28 | ||
- | 29 | ||
19 | // the menu functions |
30 | void Menu_Status(uint8_t key) |
20 | // ----------------------------------------------------------- |
31 | |
21 | 32 | { |
|
22 | void Menu_Status(uint8_t key) |
33 | |
23 | { //0123456789ABCDEF |
34 | //0123456789ABCDEF |
24 | JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10); |
35 | JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10); |
Line 92... | Line 103... | ||
92 | { //0123456789ABCDEF |
103 | { //0123456789ABCDEF |
93 | JetiBox_printfxy(2,0,"No NaviCtrl!"); |
104 | JetiBox_printfxy(2,0,"No NaviCtrl!"); |
94 | } |
105 | } |
95 | } |
106 | } |
Line 96... | Line 107... | ||
96 | 107 | ||
97 | //1 |
108 | |
98 | void Menu_Current(uint8_t key) |
109 | void Menu_Current(uint8_t key) |
Line -... | Line 110... | ||
- | 110 | { //0123456789ABCDEF |
|
Line -... | Line 111... | ||
- | 111 | ||
- | 112 | loop1 ++; |
|
- | 113 | ||
- | 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; |
|
99 | { //0123456789ABCDEF |
123 | Motors6 =Motor[6].Current; |
100 | 124 | Motors7 =Motor[7].Current; |
|
101 | 125 | } |
|
102 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Current-12, Motor[1].Current-12, Motor[2].Current-12, Motor[3].Current-12); |
126 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motors0-12, Motors1-12, Motors2-12, Motors3-12); |
103 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Current-12, Motor[5].Current-12, Motor[6].Current-12, Motor[7].Current-12); |
127 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motors4-12, Motors5-12, Motors6-12, Motors6-12); |
104 | if(RequiredMotors <= 4) |
128 | if(RequiredMotors <= 4) |
105 | { |
129 | { |
106 | JetiBox_printfxy(0,1,"Currents "); |
130 | JetiBox_printfxy(0,1,"Currents "); |
107 | } |
131 | } |
108 | else |
132 | else |
109 | if(RequiredMotors <= 6) |
133 | if(RequiredMotors <= 6) |
110 | { |
134 | { |
- | 135 | JetiBox_printfxy(8,1,"%3i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
|
- | 136 | } |
|
- | 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; |
|
Line -... | Line 149... | ||
- | 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 |
|
111 | JetiBox_printfxy(8,1,"%3i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
156 | |
112 | } |
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); |
113 | 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); |
|
114 | 159 | ||
115 | } |
160 | } |
116 | //1 |
- | |
117 | //1 |
- | |
118 | void Menu_SetPoint(uint8_t key) |
- | |
119 | { //0123456789ABCDEF |
- | |
120 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].SetPoint, Motor[1].SetPoint, Motor[2].SetPoint, Motor[3].SetPoint); |
- | |
121 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].SetPoint, Motor[5].SetPoint, Motor[6].SetPoint, Motor[7].SetPoint); |
- | |
122 | if(RequiredMotors <= 4) |
- | |
123 | { |
- | |
124 | JetiBox_printfxy(0,1,"M SetPoint "); |
- | |
125 | } |
- | |
126 | else |
- | |
Line -... | Line 161... | ||
- | 161 | ||
- | 162 | ||
- | 163 | void Menu_SetPoint(uint8_t key) |
|
- | 164 | { //0123456789ABCDEF |
|
- | 165 | ||
- | 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 | } |
|
127 | if(RequiredMotors <= 6) |
204 | */ |
Line 128... | Line 205... | ||
128 | { |
205 | |
129 | JetiBox_printfxy(8,1,"MSetP "); |
206 | if(key== JETIBOX_KEY_UP) updatemotors = updatemotors+1; |
130 | } |
207 | if(key== JETIBOX_KEY_DOWN) updatemotors = updatemotors-1; |
Line 140... | Line 217... | ||
140 | r=SummeRoll >> 9; |
217 | r=SummeRoll >> 9; |
141 | g=Mess_Integral_Gier >> 9; |
218 | g=Mess_Integral_Gier >> 9; |
Line 142... | Line 219... | ||
142 | 219 | ||
143 | JetiBox_printfxy(0,0,"%3iN %3iR +N",n, r); |
220 | JetiBox_printfxy(0,0,"%3iN %3iR +N",n, r); |
144 | JetiBox_printfxy(0,1,"%3iG +R -N -R",g); |
- | |
145 | //1 |
- | |
146 | - | ||
147 | 221 | JetiBox_printfxy(0,1,"%3iG +R -N -R",g); |
|
Line 148... | Line 222... | ||
148 | } |
222 | } |
149 | 223 | ||
Line 150... | Line 224... | ||
150 | void Menu_Info(uint8_t key) |
224 | void Menu_Info(uint8_t key) |
151 | { //0123456789ABCDEF |
225 | { //0123456789ABCDEF |
152 | 226 | ||
153 | JetiBox_printfxy(0,0,"%3i=Hovergas",HoverGas); |
227 | // JetiBox_printfxy(0,0,"%3i=Hovergas",HoverGas); |
154 | JetiBox_printfxy(0,1,"%3i=HG/4 %3i=Gas",HoverGas/4,StickGas); |
228 | JetiBox_printfxy(0,1,"%3i=HG/4 %3i=Gas",HoverGas/4,StickGas); |
155 | } |
229 | } |
Line 156... | Line 230... | ||
156 | 230 | /* |
|
157 | void Menu_spoti1(uint8_t key) |
231 | void Menu_spoti1(uint8_t key) |
158 | { //0123456789ABCDEF |
232 | { //0123456789ABCDEF |
159 | 233 | ||
160 | JetiBox_printfxy(0,0,">%3i=Serialpot1",PPM_in[13]); |
234 | JetiBox_printfxy(0,0,">%3i=SPot1",PPM_in[13]); |
Line 161... | Line 235... | ||
161 | JetiBox_printfxy(0,1," %3i=Serialpot2",PPM_in[14]); |
235 | JetiBox_printfxy(0,1," %3i=SPot2",PPM_in[14]); |
162 | if(key== JETIBOX_KEY_UP) PPM_in[13] = PPM_in[13]+1; |
236 | if(key== JETIBOX_KEY_UP) PPM_in[13] = PPM_in[13]+1; |
Line 163... | Line 237... | ||
163 | if(key== JETIBOX_KEY_DOWN) PPM_in[13] = PPM_in[13]-1; |
237 | if(key== JETIBOX_KEY_DOWN) PPM_in[13] = PPM_in[13]-1; |
164 | } |
238 | } |
165 | 239 | ||
166 | void Menu_spoti2(uint8_t key) |
240 | void Menu_spoti2(uint8_t key) |
167 | { //0123456789ABCDEF |
241 | { //0123456789ABCDEF |
- | 242 | ||
- | 243 | JetiBox_printfxy(0,0," %3i=SPot1",PPM_in[13]); |
|
- | 244 | JetiBox_printfxy(0,1,">%3i=SPot2",PPM_in[14],key); |
|
- | 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 | } |
|
- | 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] ++; |
|
168 | 262 | if((key== JETIBOX_KEY_DOWN) & (keynumber ==3)) PPM_in[15] --; |
|
169 | JetiBox_printfxy(0,0," %3i=Serialpot1",PPM_in[13]); |
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) |
|
- | 269 | { //0123456789ABCDEF |
|
- | 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 | } |
|
- | 288 | ||
- | 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 --; |
|
Line -... | Line 324... | ||
- | 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 | ||
170 | JetiBox_printfxy(0,1,">%3i=Serialpot2",PPM_in[14],key); |
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 | ||
171 | if(key== JETIBOX_KEY_UP) PPM_in[14] = PPM_in[14]+5; |
407 | } |
- | 408 | ||
172 | if(key== JETIBOX_KEY_DOWN) PPM_in[14] = PPM_in[14]-5; |
409 | if(EE_Parameter.BitConfig & CFG_LOOP_RECHTS) |
173 | } |
410 | { |
174 | void Menu_hoeheD(uint8_t key) |
411 | LIBFC_JetiBox_Putchar(0X3E); |
- | 412 | } |
|
- | 413 | ||
175 | { //0123456789ABCDEF |
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 --; |
|
- | 418 | } |
|
- | 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 --; |
|
176 | 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) |
|
Line 177... | Line 474... | ||
177 | JetiBox_printfxy(0,0,">%3i=HD",EE_Parameter.Luftdruck_D); |
474 | { //0123456789ABCDEF |
178 | JetiBox_printfxy(0,1," %3i=HP",EE_Parameter.Hoehe_P); |
475 | //extern void LIBFC_JetiBox_Putchar(char c); |
- | 476 | ||
179 | if(key== JETIBOX_KEY_UP) EE_Parameter.Luftdruck_D = EE_Parameter.Luftdruck_D+1; |
477 | PC_MotortestActive = 240; |
180 | if(key== JETIBOX_KEY_DOWN) EE_Parameter.Luftdruck_D = EE_Parameter.Luftdruck_D-1; |
478 | |
- | 479 | JetiBox_printfxy(0,0,"Mtest <+v <+^"); |
|
- | 480 | JetiBox_printfxy(0,1,"Motor=%3i Sp=%2i",loop3+1, MotorTest[loop3]); |
|
181 | } |
481 | |
- | 482 | if((key== JETIBOX_KEY_UP) & (loop2 <100 )) loop2=loop2 +2;//GESCHW |
|
182 | void Menu_hoeheP(uint8_t key) |
483 | if((key== JETIBOX_KEY_DOWN) & (loop2 >0 )) loop2=loop2 -2; |
183 | { //0123456789ABCDEF |
484 | |
- | 485 | if((key== JETIBOX_KEY_UPANDL) & (loop3 <15 )) loop3 ++;//motornummer |
|
- | 486 | if((key==JETIBOX_KEY_DownANDL) & (loop3 >0 )) loop3 --; |
|
184 | 487 | MotorTest[loop3]=loop2; |
|
185 | JetiBox_printfxy(0,0," %3i=HD",EE_Parameter.Luftdruck_D); |
488 | |
- | 489 | } |
|
186 | JetiBox_printfxy(0,1,">%3i=HP",EE_Parameter.Hoehe_P); |
490 | |
- | 491 | void Menu_mem(uint8_t key) |
|
- | 492 | { //0123456789ABCDEF |
|
187 | if(key== JETIBOX_KEY_UP) EE_Parameter.Hoehe_P = EE_Parameter.Hoehe_P+1; |
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 ) |
|
188 | if(key== JETIBOX_KEY_DOWN) EE_Parameter.Hoehe_P = EE_Parameter.Hoehe_P-1; |
498 | if(key== JETIBOX_KEY_LANDR && !MotorenEin) |
- | 499 | ||
- | 500 | { |
|
- | 501 | ParamSet_WriteToEEProm(GetActiveParamSet()); |
|
- | 502 | ||
- | 503 | //for(i=0; i<5; i++) |
|
- | 504 | //{ |
|
189 | } |
505 | JetiBox_printfxy(i,0,"OK!"); |
190 | //#define JETIBOX_KEY_UP 0x2F |
506 | //} |
191 | //#define JETIBOX_KEY_DOWN 0x4F |
507 | |
192 | //unsigned char Parameter_Luftdruck_D = 48; // Wert : 0-250 |
508 | } |
Line 215... | Line 531... | ||
215 | 531 | ||
Line 216... | Line 532... | ||
216 | */ |
532 | */ |
217 | 533 | ||
218 | const MENU_ENTRY JetiBox_Menu[] PROGMEM= |
534 | const MENU_ENTRY JetiBox_Menu[] PROGMEM= |
219 | { // l r u d pHandler links rechts up down |
535 | { // l r u d pHandler links rechts up down |
220 | {11, 1, 0, 0, &Menu_Status }, // 0 /// |
536 | {23, 1, 0, 0, &Menu_Status }, // Seite 1 |
221 | {0, 2, 1, 1, &Menu_Temperature }, // 1 |
537 | { 0, 2, 1, 1, &Menu_Temperature }, // 2 |
222 | {1, 3, 2, 2, &Menu_Battery }, // 2 |
- | |
223 | {2, 4, 3, 3, &Menu_PosInfo }, // 3 |
538 | { 1, 3, 2, 2, &Menu_Battery }, // 3 |
224 | //1 |
539 | { 2, 4, 3, 3, &Menu_PosInfo }, // 4 |
225 | {3, 5, 4, 4, &Menu_Current }, // 4 /// |
540 | { 3, 5, 4, 4, &Menu_Current }, // 5 |
226 | {4, 6, 5, 5, &Menu_SetPoint }, // 5 /// |
541 | { 4, 6, 5, 5, &Menu_SetPoint }, // 6 |
227 | {5, 7, 6, 6, &Menu_Integal }, // 6 /// |
542 | { 5, 7, 6, 6, &Menu_I2C }, // 7 |
228 | {6, 8, 7, 7, &Menu_Info }, // 7 /// |
543 | { 6, 8, 7, 7, &Menu_Integal }, // 8 |
229 | {7, 9, 8, 8, &Menu_spoti1 }, // 8 /// |
544 | { 7, 9, 8, 8, &Menu_Info }, // 9 |
230 | {8, 10, 9, 9, &Menu_spoti2 }, // 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 |
|
231 | {9, 11, 10, 10, &Menu_hoeheD }, // 10 /// |
557 | {20, 22, 21, 21, &Menu_mem }, // 22 |
232 | {10, 0, 11, 11, &Menu_hoeheP }, // 11 /// |
- | |
233 | 558 | {21, 0, 22, 22, &Menu_mem }, // 23 |
|
Line 234... | Line 559... | ||
234 | //1 |
559 | |
235 | }; |
560 | }; |
236 | 561 | ||
237 | // ----------------------------------------------------------- |
562 | // ----------------------------------------------------------- |
238 | // Update display buffer |
563 | // Update display buffer |
- | 564 | // ----------------------------------------------------------- |
|
- | 565 | unsigned char JetiBox_Update(unsigned char key) |
|
239 | // ----------------------------------------------------------- |
566 | { |
Line 240... | Line 567... | ||
240 | unsigned char JetiBox_Update(unsigned char key) |
567 | //printf(" %3i = keynumber, pos1 =%3i \n\r ", pos1); /// |
241 | { |
568 | |
242 | static uint8_t item = 0, last_item = 0; // the menu item |
569 | static uint8_t item = 0, last_item = 0; // the menu item |
243 | 570 | ||
244 | // navigate within the menu by key action |
571 | // navigate within the menu by key action |
245 | last_item = item; |
572 | last_item = item; |
- | 573 | switch(key) |
|
- | 574 | { |
|
- | 575 | case JETIBOX_KEY_LEFT: |
|
- | 576 | if (item == 0) return (1); // switch back to jeti expander menu |
|
246 | switch(key) |
577 | else |
- | 578 | { |
|
- | 579 | if (keynumber <= 0 || keynumber >=5) //keynumber normaly 0, only in the parameter pages keyn=1...4 |
|
- | 580 | { |
|
247 | { |
581 | item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
248 | case JETIBOX_KEY_LEFT: |
582 | } |
- | 583 | } |
|
- | 584 | ||
249 | if (item == 0) return (1); // switch back to jeti expander menu |
585 | break; |
- | 586 | case JETIBOX_KEY_RIGHT: |
|
250 | else item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
587 | if (keynumber <= 0 || keynumber >=5) |
251 | break; |
588 | { |
252 | case JETIBOX_KEY_RIGHT: |
589 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
253 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
590 | } |
254 | break; |
591 | break; |
255 | case JETIBOX_KEY_UP: |
592 | case JETIBOX_KEY_UP: |
256 | item = pgm_read_byte(&JetiBox_Menu[item].up); //trigger to up menu item |
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; |
|
- | 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; |
|
257 | break; |
610 | |
258 | case JETIBOX_KEY_DOWN: |
611 | } |
259 | item = pgm_read_byte(&JetiBox_Menu[item].down); //trigger to down menu item |
612 | break; |
260 | break; |
613 | |
261 | default: |
614 | default: |