Rev 2030 | Rev 2182 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2030 | Rev 2050 | ||
---|---|---|---|
- | 1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 2 | // + Software Nutzungsbedingungen (english version: see below) |
|
- | 3 | // + www.MikroKopter.com |
|
- | 4 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 5 | // + der Fa. HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland - nachfolgend Lizenzgeber genannt - |
|
- | 6 | // + Der Lizenzgeber räumt dem Kunden ein nicht-ausschließliches, zeitlich und räumlich* unbeschränktes Recht ein, die im den |
|
- | 7 | // + Mikrocontroller verwendete Firmware für die Hardware Flight-Ctrl, Navi-Ctrl, BL-Ctrl, MK3Mag & PC-Programm MikroKopter-Tool |
|
- | 8 | // + - nachfolgend Software genannt - nur für private Zwecke zu nutzen. |
|
- | 9 | // + Der Einsatz dieser Software ist nur auf oder mit Produkten des Lizenzgebers zulässig. |
|
- | 10 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 11 | // + Die vom Lizenzgeber gelieferte Software ist urheberrechtlich geschützt. Alle Rechte an der Software sowie an sonstigen im |
|
- | 12 | // + Rahmen der Vertragsanbahnung und Vertragsdurchführung überlassenen Unterlagen stehen im Verhältnis der Vertragspartner ausschließlich dem Lizenzgeber zu. |
|
- | 13 | // + Die in der Software enthaltenen Copyright-Vermerke, Markenzeichen, andere Rechtsvorbehalte, Seriennummern sowie |
|
- | 14 | // + sonstige der Programmidentifikation dienenden Merkmale dürfen vom Kunden nicht verändert oder unkenntlich gemacht werden. |
|
- | 15 | // + Der Kunde trifft angemessene Vorkehrungen für den sicheren Einsatz der Software. Er wird die Software gründlich auf deren |
|
- | 16 | // + Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt. |
|
- | 17 | // + Die Haftung des Lizenzgebers wird - soweit gesetzlich zulässig - begrenzt in Höhe des typischen und vorhersehbaren |
|
- | 18 | // + Schadens. Die gesetzliche Haftung bei Personenschäden und nach dem Produkthaftungsgesetz bleibt unberührt. Dem Lizenzgeber steht jedoch der Einwand |
|
- | 19 | // + des Mitverschuldens offen. |
|
- | 20 | // + Der Kunde trifft angemessene Vorkehrungen für den Fall, dass die Software ganz oder teilweise nicht ordnungsgemäß arbeitet. |
|
- | 21 | // + Er wird die Software gründlich auf deren Verwendbarkeit zu dem von ihm beabsichtigten Zweck testen, bevor er diese operativ einsetzt. |
|
- | 22 | // + Der Kunde wird er seine Daten vor Einsatz der Software nach dem Stand der Technik sichern. |
|
- | 23 | // + Der Kunde ist darüber unterrichtet, dass der Lizenzgeber seine Daten im zur Vertragsdurchführung erforderlichen Umfang |
|
- | 24 | // + und auf Grundlage der Datenschutzvorschriften erhebt, speichert, verarbeitet und, sofern notwendig, an Dritte übermittelt. |
|
- | 25 | // + *) Die räumliche Nutzung bezieht sich nur auf den Einsatzort, nicht auf die Reichweite der programmierten Software. |
|
- | 26 | // + #### ENDE DER NUTZUNGSBEDINGUNGEN ####' |
|
- | 27 | // + Hinweis: Informationen über erweiterte Nutzungsrechte (wie z.B. Nutzung für nicht-private Zwecke) sind auf Anfrage per Email an info(@)hisystems.de verfügbar. |
|
- | 28 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 29 | // + Software LICENSING TERMS |
|
- | 30 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 31 | // + of HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland, Germany - the Licensor - |
|
- | 32 | // + The Licensor grants the customer a non-exclusive license to use the microcontroller firmware of the Flight-Ctrl, Navi-Ctrl, BL-Ctrl, and MK3Mag hardware |
|
- | 33 | // + (the Software) exclusively for private purposes. The License is unrestricted with respect to time and territory*. |
|
- | 34 | // + The Software may only be used with the Licensor's products. |
|
- | 35 | // + The Software provided by the Licensor is protected by copyright. With respect to the relationship between the parties to this |
|
- | 36 | // + agreement, all rights pertaining to the Software and other documents provided during the preparation and execution of this |
|
- | 37 | // + agreement shall be the property of the Licensor. |
|
- | 38 | // + The information contained in the Software copyright notices, trademarks, other legal reservations, serial numbers and other |
|
- | 39 | // + features that can be used to identify the program may not be altered or defaced by the customer. |
|
- | 40 | // + The customer shall be responsible for taking reasonable precautions |
|
- | 41 | // + for the safe use of the Software. The customer shall test the Software thoroughly regarding its suitability for the |
|
- | 42 | // + intended purpose before implementing it for actual operation. The Licensor's liability shall be limited to the extent of typical and |
|
- | 43 | // + foreseeable damage to the extent permitted by law, notwithstanding statutory liability for bodily injury and product |
|
- | 44 | // + liability. However, the Licensor shall be entitled to the defense of contributory negligence. |
|
- | 45 | // + The customer will take adequate precautions in the case, that the software is not working properly. The customer will test |
|
- | 46 | // + the software for his purpose before any operational usage. The customer will backup his data before using the software. |
|
- | 47 | // + The customer understands that the Licensor collects, stores and processes, and, where required, forwards, customer data |
|
- | 48 | // + to third parties to the extent necessary for executing the agreement, subject to applicable data protection and privacy regulations. |
|
- | 49 | // + *) The territory aspect only refers to the place where the Software is used, not its programmed range. |
|
- | 50 | // + #### END OF LICENSING TERMS #### |
|
- | 51 | // + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de. |
|
- | 52 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
1 | #include "jetimenu.h" |
53 | #include "jetimenu.h" |
2 | #include "libfc.h" |
54 | #include "libfc.h" |
3 | #include "printf_P.h" |
55 | #include "printf_P.h" |
4 | #include "main.h" |
56 | #include "main.h" |
5 | #include "spi.h" |
57 | #include "spi.h" |
6 | #include "capacity.h" |
58 | #include "capacity.h" |
7 | #include "hottmenu.h" |
59 | #include "hottmenu.h" |
8 | 60 | ||
9 | #define JETIBOX_KEY_RIGHT 0x1F |
61 | #define JETIBOX_KEY_RIGHT 0x1F |
10 | #define JETIBOX_KEY_UP 0x2F |
62 | #define JETIBOX_KEY_UP 0x2F |
11 | #define JETIBOX_KEY_DOWN 0x4F |
63 | #define JETIBOX_KEY_DOWN 0x4F |
12 | #define JETIBOX_KEY_LEFT 0x8F |
64 | #define JETIBOX_KEY_LEFT 0x8F |
13 | #define JETIBOX_KEY_NONE 0x0F |
65 | #define JETIBOX_KEY_NONE 0x0F |
14 | #define JETIBOX_KEY_UNDEF 0x00 |
66 | #define JETIBOX_KEY_UNDEF 0x00 |
15 | 67 | ||
16 | #define JetiBox_printfxy(x,y,format, args...) { LIBFC_JetiBox_SetPos(y * 16 + x); _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);} |
68 | #define JetiBox_printfxy(x,y,format, args...) { LIBFC_JetiBox_SetPos(y * 16 + x); _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);} |
17 | #define JetiBox_printf(format, args...) { _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);} |
69 | #define JetiBox_printf(format, args...) { _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);} |
18 | 70 | ||
19 | // ----------------------------------------------------------- |
71 | // ----------------------------------------------------------- |
20 | // the menu functions |
72 | // the menu functions |
21 | // ----------------------------------------------------------- |
73 | // ----------------------------------------------------------- |
22 | void Menu_Status(uint8_t key) |
74 | void Menu_Status(uint8_t key) |
23 | { //0123456789ABCDEF |
75 | { //0123456789ABCDEF |
24 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
76 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
25 | JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10); |
77 | JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10); |
26 | if(NaviDataOkay) |
78 | if(NaviDataOkay) |
27 | { |
79 | { |
28 | JetiBox_printfxy(6,0,"%3d%c %03dm%c",ErsatzKompassInGrad, 0xDF, GPSInfo.HomeDistance/10,NC_GPS_ModeCharacter); |
80 | JetiBox_printfxy(6,0,"%3d%c %03dm%c",ErsatzKompassInGrad, 0xDF, GPSInfo.HomeDistance/10,NC_GPS_ModeCharacter); |
29 | } |
81 | } |
30 | else |
82 | else |
31 | { |
83 | { |
32 | JetiBox_printfxy(6,0,"Status"); |
84 | JetiBox_printfxy(6,0,"Status"); |
33 | } |
85 | } |
34 | 86 | ||
35 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
87 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
36 | if(NC_ErrorCode) |
88 | if(NC_ErrorCode) |
37 | { |
89 | { |
38 | static unsigned int timer; |
90 | static unsigned int timer; |
39 | static char toggle = 1; |
91 | static char toggle = 1; |
40 | 92 | ||
41 | if(CheckDelay(timer)) { if(toggle) toggle = 0; else toggle = 1; timer = SetDelay(1500);}; |
93 | if(CheckDelay(timer)) { if(toggle) toggle = 0; else toggle = 1; timer = SetDelay(1500);}; |
42 | if(toggle) |
94 | if(toggle) |
43 | { |
95 | { |
44 | LIBFC_JetiBox_SetPos(0); |
96 | LIBFC_JetiBox_SetPos(0); |
45 | _printf_P(&LIBFC_JetiBox_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0); |
97 | _printf_P(&LIBFC_JetiBox_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0); |
46 | } |
98 | } |
47 | else |
99 | else |
48 | { |
100 | { |
49 | JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); |
101 | JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); |
50 | if(MotorenEin) JetiBeep = 'O'; |
102 | if(MotorenEin) JetiBeep = 'O'; |
51 | } |
103 | } |
52 | } |
104 | } |
53 | #else |
105 | #else |
54 | if(NC_ErrorCode) { JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); if(MotorenEin) JetiBeep = 'O';}; |
106 | if(NC_ErrorCode) { JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); if(MotorenEin) JetiBeep = 'O';}; |
55 | #endif |
107 | #endif |
56 | JetiBox_printfxy(0,1,"%4i %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60); |
108 | JetiBox_printfxy(0,1,"%4i %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60); |
57 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
109 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
58 | { |
110 | { |
59 | JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter); |
111 | JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter); |
60 | } |
112 | } |
61 | #endif |
113 | #endif |
62 | } |
114 | } |
63 | 115 | ||
64 | 116 | ||
65 | void Menu_Temperature(uint8_t key) |
117 | void Menu_Temperature(uint8_t key) |
66 | { //0123456789ABCDEF |
118 | { //0123456789ABCDEF |
67 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
119 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
68 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature); |
120 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature); |
69 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature); |
121 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature); |
70 | if(RequiredMotors <= 4) |
122 | if(RequiredMotors <= 4) |
71 | { |
123 | { |
72 | JetiBox_printfxy(0,1,"Temperatures "); |
124 | JetiBox_printfxy(0,1,"Temperatures "); |
73 | } |
125 | } |
74 | else |
126 | else |
75 | if(RequiredMotors <= 6) |
127 | if(RequiredMotors <= 6) |
76 | { |
128 | { |
77 | JetiBox_printfxy(8,1,"\%cC ",0xdf); |
129 | JetiBox_printfxy(8,1,"\%cC ",0xdf); |
78 | } |
130 | } |
79 | 131 | ||
80 | #endif |
132 | #endif |
81 | } |
133 | } |
82 | 134 | ||
83 | void Menu_Battery(uint8_t key) |
135 | void Menu_Battery(uint8_t key) |
84 | { //0123456789ABCDEF |
136 | { //0123456789ABCDEF |
85 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
137 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
86 | JetiBox_printfxy(0,0,"%2i.%1iV %3i.%1iA", UBat/10, UBat%10, Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
138 | JetiBox_printfxy(0,0,"%2i.%1iV %3i.%1iA", UBat/10, UBat%10, Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
87 | JetiBox_printfxy(0,1,"%4iW %6imAh",Capacity.ActualPower, Capacity.UsedCapacity); |
139 | JetiBox_printfxy(0,1,"%4iW %6imAh",Capacity.ActualPower, Capacity.UsedCapacity); |
88 | #endif |
140 | #endif |
89 | } |
141 | } |
90 | 142 | ||
91 | void Magnet_Values(uint8_t key) |
143 | void Magnet_Values(uint8_t key) |
92 | { //0123456789ABCDEF |
144 | { //0123456789ABCDEF |
93 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
145 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
94 | JetiBox_printfxy(0,0,"Magnet:%3i%% %3i%c",EarthMagneticField, KompassValue,0xDF); |
146 | JetiBox_printfxy(0,0,"Magnet:%3i%% %3i%c",EarthMagneticField, KompassValue,0xDF); |
95 | JetiBox_printfxy(0,1,"Incli.:%3i%c (%i) ",EarthMagneticInclination, 0xDF,EarthMagneticInclinationTheoretic); |
147 | JetiBox_printfxy(0,1,"Incli.:%3i%c (%i) ",EarthMagneticInclination, 0xDF,EarthMagneticInclinationTheoretic); |
96 | #endif |
148 | #endif |
97 | } |
149 | } |
98 | 150 | ||
99 | 151 | ||
100 | void Menu_PosInfo(uint8_t key) |
152 | void Menu_PosInfo(uint8_t key) |
101 | { |
153 | { |
102 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
154 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
103 | if(NaviDataOkay) |
155 | if(NaviDataOkay) |
104 | { |
156 | { |
105 | JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
157 | JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
106 | switch (GPSInfo.SatFix) |
158 | switch (GPSInfo.SatFix) |
107 | { |
159 | { |
108 | case SATFIX_3D: |
160 | case SATFIX_3D: |
109 | JetiBox_printfxy(12,0," 3D"); |
161 | JetiBox_printfxy(12,0," 3D"); |
110 | break; |
162 | break; |
111 | // case SATFIX_2D: |
163 | // case SATFIX_2D: |
112 | // case SATFIX_NONE: |
164 | // case SATFIX_NONE: |
113 | default: |
165 | default: |
114 | JetiBox_printfxy(12,0,"NoFx"); |
166 | JetiBox_printfxy(12,0,"NoFx"); |
115 | break; |
167 | break; |
116 | } |
168 | } |
117 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
169 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
118 | { |
170 | { |
119 | JetiBox_printfxy(12,0,"DGPS"); |
171 | JetiBox_printfxy(12,0,"DGPS"); |
120 | } |
172 | } |
121 | JetiBox_printfxy(0,1,"Home:%3dm %3d%c %c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF,NC_GPS_ModeCharacter); |
173 | JetiBox_printfxy(0,1,"Home:%3dm %3d%c %c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF,NC_GPS_ModeCharacter); |
122 | } |
174 | } |
123 | else |
175 | else |
124 | { //0123456789ABCDEF |
176 | { //0123456789ABCDEF |
125 | JetiBox_printfxy(2,0,"No NaviCtrl!"); |
177 | JetiBox_printfxy(2,0,"No NaviCtrl!"); |
126 | } |
178 | } |
127 | #endif |
179 | #endif |
128 | } |
180 | } |
129 | 181 | ||
130 | 182 | ||
131 | // ----------------------------------------------------------- |
183 | // ----------------------------------------------------------- |
132 | // the menu topology |
184 | // the menu topology |
133 | // ----------------------------------------------------------- |
185 | // ----------------------------------------------------------- |
134 | typedef void (*pFctMenu) (uint8_t); // the menu item handler function pointer |
186 | typedef void (*pFctMenu) (uint8_t); // the menu item handler function pointer |
135 | 187 | ||
136 | typedef struct{ |
188 | typedef struct{ |
137 | int8_t left; |
189 | int8_t left; |
138 | int8_t right; |
190 | int8_t right; |
139 | int8_t up; |
191 | int8_t up; |
140 | int8_t down; |
192 | int8_t down; |
141 | pFctMenu pHandler; |
193 | pFctMenu pHandler; |
142 | } MENU_ENTRY; |
194 | } MENU_ENTRY; |
143 | 195 | ||
144 | 196 | ||
145 | // the menu navigation structure |
197 | // the menu navigation structure |
146 | /* | |
198 | /* | |
147 | 199 | ||
148 | 3 - 0 - 1 - 2 - 3 - 0 |
200 | 3 - 0 - 1 - 2 - 3 - 0 |
149 | 201 | ||
150 | */ |
202 | */ |
151 | 203 | ||
152 | const MENU_ENTRY JetiBox_Menu[] PROGMEM= |
204 | const MENU_ENTRY JetiBox_Menu[] PROGMEM= |
153 | { // l r u d pHandler |
205 | { // l r u d pHandler |
154 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
206 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
155 | {4, 1, 0, 0, &Menu_Status }, // 0 |
207 | {4, 1, 0, 0, &Menu_Status }, // 0 |
156 | {0, 2, 1, 1, &Menu_Temperature }, // 1 |
208 | {0, 2, 1, 1, &Menu_Temperature }, // 1 |
157 | {1, 3, 2, 2, &Menu_Battery }, // 2 |
209 | {1, 3, 2, 2, &Menu_Battery }, // 2 |
158 | {2, 4, 3, 3, &Menu_PosInfo }, // 3 |
210 | {2, 4, 3, 3, &Menu_PosInfo }, // 3 |
159 | {3, 0, 4, 4, &Magnet_Values } // 4 |
211 | {3, 0, 4, 4, &Magnet_Values } // 4 |
160 | #endif |
212 | #endif |
161 | }; |
213 | }; |
162 | 214 | ||
163 | // ----------------------------------------------------------- |
215 | // ----------------------------------------------------------- |
164 | // Update display buffer |
216 | // Update display buffer |
165 | // ----------------------------------------------------------- |
217 | // ----------------------------------------------------------- |
166 | unsigned char JetiBox_Update(unsigned char key) |
218 | unsigned char JetiBox_Update(unsigned char key) |
167 | { |
219 | { |
168 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
220 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
169 | static uint8_t item = 0, last_item = 0; // the menu item |
221 | static uint8_t item = 0, last_item = 0; // the menu item |
170 | 222 | ||
171 | // navigate within the menu by key action |
223 | // navigate within the menu by key action |
172 | last_item = item; |
224 | last_item = item; |
173 | switch(key) |
225 | switch(key) |
174 | { |
226 | { |
175 | case JETIBOX_KEY_LEFT: |
227 | case JETIBOX_KEY_LEFT: |
176 | //if (item == 0) return (1); // switch back to jeti expander menu |
228 | //if (item == 0) return (1); // switch back to jeti expander menu |
177 | // else |
229 | // else |
178 | item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
230 | item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
179 | break; |
231 | break; |
180 | case JETIBOX_KEY_RIGHT: |
232 | case JETIBOX_KEY_RIGHT: |
181 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
233 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
182 | break; |
234 | break; |
183 | case JETIBOX_KEY_UP: |
235 | case JETIBOX_KEY_UP: |
184 | item = pgm_read_byte(&JetiBox_Menu[item].up); //trigger to up menu item |
236 | item = pgm_read_byte(&JetiBox_Menu[item].up); //trigger to up menu item |
185 | break; |
237 | break; |
186 | case JETIBOX_KEY_DOWN: |
238 | case JETIBOX_KEY_DOWN: |
187 | item = pgm_read_byte(&JetiBox_Menu[item].down); //trigger to down menu item |
239 | item = pgm_read_byte(&JetiBox_Menu[item].down); //trigger to down menu item |
188 | break; |
240 | break; |
189 | default: |
241 | default: |
190 | break; |
242 | break; |
191 | } |
243 | } |
192 | // if the menu item has been changed, do not pass the key to the item handler |
244 | // if the menu item has been changed, do not pass the key to the item handler |
193 | // to avoid jumping over to items |
245 | // to avoid jumping over to items |
194 | if(item != last_item) key = JETIBOX_KEY_UNDEF; |
246 | if(item != last_item) key = JETIBOX_KEY_UNDEF; |
195 | 247 | ||
196 | LIBFC_JetiBox_Clear(); |
248 | LIBFC_JetiBox_Clear(); |
197 | //execute menu item handler |
249 | //execute menu item handler |
198 | ((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key); |
250 | ((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key); |
199 | #endif |
251 | #endif |
200 | return (0); |
252 | return (0); |
201 | } |
253 | } |
202 | 254 | ||
203 | 255 |