Subversion Repositories FlightCtrl

Rev

Rev 1793 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1793 Rev 1799
1
#include "jetimenu.h"
1
#include "jetimenu.h"
2
#include "libfc.h"
2
#include "libfc.h"
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"
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
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
13
#define JETIBOX_KEY_UNDEF       0x00
13
#define JETIBOX_KEY_UNDEF       0x00
-
 
14
 
-
 
15
//MartinW added Key's
-
 
16
#define JETIBOX_KEY_LANDR       0x9F // 159
-
 
17
#define JETIBOX_KEY_DownANDR    0x5F // 95
-
 
18
#define JETIBOX_KEY_DownANDL    0xCF // 207
-
 
19
#define JETIBOX_KEY_DownANDUP   0x6F // 111
-
 
20
#define JETIBOX_KEY_UPANDL      0xAF // 175
-
 
21
#define JETIBOX_KEY_UPANDR      0x3F // 63
-
 
22
//MartinW added Key's
14
 
23
 
15
#define JetiBox_printfxy(x,y,format, args...)  { LIBFC_JetiBox_SetPos(y * 16 + x); _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);}
24
#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);}
25
#define JetiBox_printf(format, args...)        {  _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);}
17
 
26
 
18
// -----------------------------------------------------------
27
// -----------------------------------------------------------
19
// the menu functions
28
// the menu functions
20
// -----------------------------------------------------------
29
// -----------------------------------------------------------
-
 
30
 
21
 
31
 
22
void Menu_Status(uint8_t key)
32
void Menu_Status(uint8_t key)  
23
{                                               //0123456789ABCDEF
33
{                               //0123456789ABCDEF
24
        JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10);
34
        JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10);
25
        if(NaviDataOkay)
35
        if(NaviDataOkay)
26
        {
36
        {
27
//              JetiBox_printfxy(6,0,"%03dm %03d%c", GPSInfo.HomeDistance/10,GPSInfo.HomeBearing, 0xDF);
37
//              JetiBox_printfxy(6,0,"%03dm %03d%c", GPSInfo.HomeDistance/10,GPSInfo.HomeBearing, 0xDF);
28
                JetiBox_printfxy(6,0,"%3d%c %03dm",(int)(ErsatzKompass / GIER_GRAD_FAKTOR), 0xDF, GPSInfo.HomeDistance/10);
38
                JetiBox_printfxy(6,0,"%3d%c %03dm",(int)(ErsatzKompass / GIER_GRAD_FAKTOR), 0xDF, GPSInfo.HomeDistance/10);
29
        }
39
        }
30
        else
40
        else
31
        {
41
        {
32
                JetiBox_printfxy(6,0,"Status");
42
                JetiBox_printfxy(6,0,"Status");
33
        }
43
        }
34
        if(NC_ErrorCode) JetiBox_printfxy(6,0,"ERROR: %2d",NC_ErrorCode);
44
        if(NC_ErrorCode) JetiBox_printfxy(6,0,"ERROR: %2d",NC_ErrorCode);
35
        JetiBox_printfxy(0,1,"%4i %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60);
45
        JetiBox_printfxy(0,1,"%4i %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60);
36
        if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)
46
        if(EE_Parameter.GlobalConfig & CFG_HOEHENREGELUNG)
37
        {
47
        {
38
                JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter);
48
                JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter);
39
        }
49
        }
40
}
50
}
41
 
51
 
42
 
52
 
43
void Menu_Temperature(uint8_t key)
53
void Menu_Temperature(uint8_t key)
44
{                       //0123456789ABCDEF
54
{                       //0123456789ABCDEF
45
  JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature);
55
  JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature);
46
  JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature);
56
  JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature);
47
  if(RequiredMotors <= 4)
57
  if(RequiredMotors <= 4)
48
        {
58
        {
49
         JetiBox_printfxy(0,1,"Temperatures    ");
59
         JetiBox_printfxy(0,1,"Temperatures");
50
    }
60
    }
51
        else
61
        else
52
    if(RequiredMotors <= 6)
62
    if(RequiredMotors <= 6)
53
        {
63
        {
54
         JetiBox_printfxy(8,1,"\%cC     ",0xdf);
64
         JetiBox_printfxy(8,1,"\%cC     ",0xdf);
55
        }
65
        }
56
 
66
 
57
}
67
}
58
 
68
 
59
void Menu_Battery(uint8_t key)
69
void Menu_Battery(uint8_t key)
60
{                       //0123456789ABCDEF
70
{                       //0123456789ABCDEF
-
 
71
 
-
 
72
if(Capacity.ActualCurrent > MotorsTmax) MotorsTmax = Capacity.ActualCurrent;    ///
-
 
73
 
-
 
74
JetiBox_printfxy(0,0,"%2i.%1iV", UBat/10, UBat%10);
-
 
75
                                        //0123456789ABCDEF
-
 
76
        if(!MotorenEin)
-
 
77
                        {
-
 
78
                        JetiBox_printfxy(10,0,"%3i.%1iA",MotorsTmax/10, MotorsTmax%10);
-
 
79
                        }
-
 
80
                else
-
 
81
                {
61
        JetiBox_printfxy(0,0,"%2i.%1iV  %3i.%1iA", UBat/10, UBat%10, Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
82
                JetiBox_printfxy(10,0,"%3i.%1iA",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
-
 
83
                }
62
        JetiBox_printfxy(0,1,"%4iW %6imAh",Capacity.ActualPower, Capacity.UsedCapacity);
84
        JetiBox_printfxy(0,1,"%4iW %6imAH",Capacity.ActualPower, Capacity.UsedCapacity);
-
 
85
       
63
}
86
}
64
 
87
 
65
 
88
 
66
void Menu_PosInfo(uint8_t key)
89
void Menu_PosInfo(uint8_t key)
67
{
90
{
68
        if(NaviDataOkay)
91
        if(NaviDataOkay)
69
        {
92
        {
70
                JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats);
93
                JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats);
71
                switch (GPSInfo.SatFix)
94
                switch (GPSInfo.SatFix)
72
                {
95
                {
73
                        case SATFIX_3D:
96
                        case SATFIX_3D:
74
                                JetiBox_printfxy(12,0,"  3D");
97
                                JetiBox_printfxy(12,0,"  3D");
75
                                break;
98
                                break;
76
 
99
 
77
                        case SATFIX_2D:
100
                        case SATFIX_2D:
78
                        case SATFIX_NONE:
101
                        case SATFIX_NONE:
79
                        default:
102
                        default:
80
                                JetiBox_printfxy(12,0,"NoFx");
103
                                JetiBox_printfxy(12,0,"NoFx");
81
                                break;
104
                                break;
82
                }
105
                }
83
                if(GPSInfo.Flags & FLAG_DIFFSOLN)
106
                if(GPSInfo.Flags & FLAG_DIFFSOLN)
84
                {
107
                {
85
                        JetiBox_printfxy(12,0,"DGPS");
108
                        JetiBox_printfxy(12,0,"DGPS");
86
                }
109
                }
87
                JetiBox_printfxy(0,1,"Home:%3dm %3d%c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF);
110
                JetiBox_printfxy(0,1,"Home:%3dm %3d%c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF);
88
        }
111
        }
89
        else
112
        else
90
        {                     //0123456789ABCDEF
113
        {                     //0123456789ABCDEF
91
                JetiBox_printfxy(2,0,"No NaviCtrl!");
114
                JetiBox_printfxy(2,0,"No NaviCtrl!");
92
        }
115
        }
93
}
116
}
-
 
117
 
-
 
118
 
-
 
119
void Menu_Current(uint8_t key)
-
 
120
{                       //0123456789ABCDEF
-
 
121
        loop1 ++;
-
 
122
       
-
 
123
         if(loop1 >= updatemotors)
-
 
124
                        {
-
 
125
                        loop1=0;
-
 
126
                        Motors0 =Motor[0].Current;
-
 
127
                        Motors1 =Motor[1].Current;
-
 
128
                        Motors2 =Motor[2].Current;
-
 
129
                        Motors3 =Motor[3].Current;
-
 
130
                        Motors4 =Motor[4].Current;
-
 
131
                        Motors5 =Motor[5].Current;
-
 
132
                        Motors6 =Motor[6].Current;
-
 
133
                        Motors7 =Motor[7].Current;
-
 
134
                        }
-
 
135
                       
-
 
136
                if(Motor[0].Current > Motors0max) Motors0max = Motor[0].Current;       
-
 
137
                if(Motor[1].Current > Motors1max) Motors1max = Motor[1].Current;       
-
 
138
                if(Motor[2].Current > Motors2max) Motors2max = Motor[2].Current;       
-
 
139
                if(Motor[3].Current > Motors3max) Motors3max = Motor[3].Current;       
-
 
140
                if(Motor[4].Current > Motors4max) Motors4max = Motor[4].Current;       
-
 
141
                if(Motor[5].Current > Motors5max) Motors5max = Motor[5].Current;       
-
 
142
                if(Motor[6].Current > Motors6max) Motors6max = Motor[6].Current;       
-
 
143
                if(Motor[7].Current > Motors7max) Motors7max = Motor[7].Current;       
-
 
144
 
-
 
145
                        if(!MotorenEin)
-
 
146
                        {
-
 
147
                        Motors0=Motors0max;Motors1=Motors1max;Motors2=Motors2max;Motors3=Motors3max;Motors4=Motors4max;Motors5=Motors5max;Motors6=Motors6max;Motors7=Motors7max;
-
 
148
                        }
-
 
149
                               
-
 
150
                JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motors0-(CurrentOffset/RequiredMotors), Motors1-(CurrentOffset/RequiredMotors), Motors2-(CurrentOffset/RequiredMotors), Motors3-(CurrentOffset/RequiredMotors));
-
 
151
                JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motors4-(CurrentOffset/RequiredMotors), Motors5-(CurrentOffset/RequiredMotors), Motors6-(CurrentOffset/RequiredMotors), Motors6-(CurrentOffset/RequiredMotors));
-
 
152
                       
-
 
153
                if(RequiredMotors <= 4)
-
 
154
                {
-
 
155
                JetiBox_printfxy(0,1,"Currents T%3i.%1iA",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
-
 
156
                }
-
 
157
               
-
 
158
                else
-
 
159
                if(RequiredMotors <= 6)
-
 
160
                {
-
 
161
                JetiBox_printfxy(8,1,"%3i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10);
-
 
162
                }
-
 
163
               
-
 
164
        if(key== JETIBOX_KEY_UP) updatemotors = updatemotors+1;
-
 
165
        if(key== JETIBOX_KEY_DOWN) updatemotors = updatemotors-1;
-
 
166
}
-
 
167
 
-
 
168
 
-
 
169
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
}
94
 
584
 
95
 
585
 
96
// -----------------------------------------------------------
586
// -----------------------------------------------------------
97
// the menu topology
587
// the menu topology
98
// -----------------------------------------------------------
588
// -----------------------------------------------------------
99
typedef void (*pFctMenu) (uint8_t);  // the menu item handler function pointer
589
typedef void (*pFctMenu) (uint8_t);  // the menu item handler function pointer
100
 
590
 
101
typedef struct{
591
typedef struct{
102
  int8_t left;
592
  int8_t left;
103
  int8_t right;
593
  int8_t right;
104
  int8_t up;
594
  int8_t up;
105
  int8_t down;
595
  int8_t down;
106
  pFctMenu pHandler;
596
  pFctMenu pHandler;
107
} MENU_ENTRY;
597
} MENU_ENTRY;
108
 
598
 
109
 
599
 
110
// the menu navigation structure
600
// the menu navigation structure
111
/*                                              |
601
/*                                              |
112
 
602
 
113
3 - 0 - 1 - 2 - 3 - 0
603
3 - 0 - 1 - 2 - 3 - 0
114
 
604
 
115
*/
605
*/
116
 
606
 
117
const MENU_ENTRY JetiBox_Menu[] PROGMEM=
607
const MENU_ENTRY JetiBox_Menu[] PROGMEM=
118
{ // l  r  u  d  pHandler
608
{ // l  r  u  d  pHandler links rechts up down
119
        {3, 1, 0, 0, &Menu_Status },    // 0
609
        {23,  1,  0,  0, &Menu_Status },                // Seite 1
120
        {0, 2, 1, 1, &Menu_Temperature },       // 1
610
        { 0,  2,  1,  1, &Menu_Temperature },   // 2
121
        {1, 3, 2, 2, &Menu_Battery },   // 2
611
        { 1,  3,  2,  2, &Menu_Battery },               // 3
122
        {2, 0, 3, 3, &Menu_PosInfo },   // 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
             
123
};
634
};
-
 
635
//void Menu_gpspid(uint8_t key)
-
 
636
 
124
 
637
 
125
// -----------------------------------------------------------
638
// -----------------------------------------------------------
126
// Update display buffer
639
// Update display buffer
127
// -----------------------------------------------------------
640
// -----------------------------------------------------------
128
unsigned char JetiBox_Update(unsigned char key)
641
unsigned char JetiBox_Update(unsigned char key)
129
{
642
{
-
 
643
//printf(" %3i = keynumber, pos1 =%3i \n\r ", pos1); ///
-
 
644
 
130
        static uint8_t item = 0, last_item = 0; // the menu item
645
        static uint8_t item = 0, last_item = 0; // the menu item
131
 
646
 
132
        // navigate within the menu by key action
647
        // navigate within the menu by key action
133
        last_item = item;
648
        last_item = item;
134
        switch(key)
649
        switch(key)
135
        {
650
        {
136
                case JETIBOX_KEY_LEFT:
651
                case JETIBOX_KEY_LEFT:
137
                        if (item == 0) return (1);                                                                      // switch back to jeti expander menu
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
                                        {
138
                         else item = pgm_read_byte(&JetiBox_Menu[item].left);           //trigger to left menu item
657
                                        item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item
-
 
658
                                        }
-
 
659
                                ///} 
-
 
660
                         
139
                        break;
661
                        break;
140
                case JETIBOX_KEY_RIGHT:
662
                case JETIBOX_KEY_RIGHT:
-
 
663
                if (keynumber <= 0 || keynumber >=5)
-
 
664
                        {
141
                        item = pgm_read_byte(&JetiBox_Menu[item].right);        //trigger to right menu item
665
                        item = pgm_read_byte(&JetiBox_Menu[item].right);        //trigger to right menu item
-
 
666
                        }
142
                        break;
667
                        break;
143
                case JETIBOX_KEY_UP:
668
                case JETIBOX_KEY_UP:   
144
                        item = pgm_read_byte(&JetiBox_Menu[item].up);           //trigger to up menu item
669
                        item = pgm_read_byte(&JetiBox_Menu[item].up);           //trigger to up menu item
145
                        break;
670
                        break;
146
                case JETIBOX_KEY_DOWN:
671
                case JETIBOX_KEY_DOWN:
147
                        item = pgm_read_byte(&JetiBox_Menu[item].down);         //trigger to down menu item
672
                        item = pgm_read_byte(&JetiBox_Menu[item].down);         //trigger to down menu item
148
                        break;
673
                        break;
-
 
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
                               
149
                default:
690
                default:
150
                        break;
691
                        break;
151
        }
692
        }
152
        // if the menu item has been changed, do not pass the key to the item handler
693
        // if the menu item has been changed, do not pass the key to the item handler
153
        // to avoid jumping over to items
694
        // to avoid jumping over to items
154
        if(item != last_item) key = JETIBOX_KEY_UNDEF;
695
        if(item != last_item) key = JETIBOX_KEY_UNDEF;
155
 
696
 
156
        LIBFC_JetiBox_Clear();
697
        LIBFC_JetiBox_Clear();
157
        //execute menu item handler
698
        //execute menu item handler
158
        ((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key);
699
        ((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key);
159
       
700
       
160
        return (0);
701
        return (0);
161
}
702
}
162
 
703
 
163
 
704