Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2050 | holgerb | 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 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
1484 | killagreg | 53 | #include "jetimenu.h" |
54 | #include "libfc.h" |
||
55 | #include "printf_P.h" |
||
56 | #include "main.h" |
||
57 | #include "spi.h" |
||
1500 | killagreg | 58 | #include "capacity.h" |
1930 | holgerb | 59 | #include "hottmenu.h" |
1484 | killagreg | 60 | |
61 | #define JETIBOX_KEY_RIGHT 0x1F |
||
62 | #define JETIBOX_KEY_UP 0x2F |
||
63 | #define JETIBOX_KEY_DOWN 0x4F |
||
64 | #define JETIBOX_KEY_LEFT 0x8F |
||
65 | #define JETIBOX_KEY_NONE 0x0F |
||
66 | #define JETIBOX_KEY_UNDEF 0x00 |
||
67 | |||
68 | #define JetiBox_printfxy(x,y,format, args...) { LIBFC_JetiBox_SetPos(y * 16 + x); _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);} |
||
69 | #define JetiBox_printf(format, args...) { _printf_P(&LIBFC_JetiBox_Putchar, PSTR(format) , ## args);} |
||
70 | |||
71 | // ----------------------------------------------------------- |
||
72 | // the menu functions |
||
73 | // ----------------------------------------------------------- |
||
1517 | killagreg | 74 | void Menu_Status(uint8_t key) |
75 | { //0123456789ABCDEF |
||
2030 | holgerb | 76 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
1512 | holgerb | 77 | JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10); |
78 | if(NaviDataOkay) |
||
1484 | killagreg | 79 | { |
2482 | holgerb | 80 | JetiBox_printfxy(6,0,"%3d%c %3dm%c",CompassCorrected, 0xDF, GPSInfo.HomeDistance/10,NC_GPS_ModeCharacter); |
1484 | killagreg | 81 | } |
1517 | killagreg | 82 | else |
83 | { |
||
2482 | holgerb | 84 | JetiBox_printfxy(6,0,"Status "); |
1517 | killagreg | 85 | } |
1930 | holgerb | 86 | |
87 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
||
88 | if(NC_ErrorCode) |
||
89 | { |
||
90 | static unsigned int timer; |
||
91 | static char toggle = 1; |
||
92 | |||
93 | if(CheckDelay(timer)) { if(toggle) toggle = 0; else toggle = 1; timer = SetDelay(1500);}; |
||
94 | if(toggle) |
||
95 | { |
||
96 | LIBFC_JetiBox_SetPos(0); |
||
97 | _printf_P(&LIBFC_JetiBox_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0); |
||
98 | } |
||
99 | else |
||
100 | { |
||
101 | JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); |
||
2327 | holgerb | 102 | // if(MotorenEin) JetiBeep = 'O'; |
1930 | holgerb | 103 | } |
104 | } |
||
2344 | holgerb | 105 | else |
2482 | holgerb | 106 | if(NC_To_FC_Flags & NC_TO_FC_SIMULATION_ACTIVE) |
107 | { |
||
108 | JetiBox_printfxy(6,0,"SIMULATION"); |
||
109 | } |
||
110 | else |
||
2345 | holgerb | 111 | if(ShowSettingNameTime) |
2344 | holgerb | 112 | { |
113 | LIBFC_JetiBox_Clear(); |
||
2482 | holgerb | 114 | JetiBox_printfxy(0,0,"Set%d:%s",ActiveParamSet,EE_Parameter.Name); |
115 | if(FC_StatusFlags3 & FC_STATUS3_BOAT) JetiBox_printfxy(0,1,"(Boat-Mode)"); |
||
2344 | holgerb | 116 | return; // nichts weiter ausgeben |
117 | } |
||
118 | |||
1930 | holgerb | 119 | #else |
2327 | holgerb | 120 | if(NC_ErrorCode) { JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); if(MotorenEin) JetiBeep = 'S';}; |
1930 | holgerb | 121 | #endif |
1591 | holgerb | 122 | JetiBox_printfxy(0,1,"%4i %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60); |
1916 | holgerb | 123 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
1517 | killagreg | 124 | { |
1591 | holgerb | 125 | JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter); |
1517 | killagreg | 126 | } |
2482 | holgerb | 127 | if(FC_StatusFlags3 & FC_STATUS3_REDUNDANCE) JetiBox_printfxy(10,1,"R"); |
2437 | holgerb | 128 | |
2030 | holgerb | 129 | #endif |
1517 | killagreg | 130 | } |
1512 | holgerb | 131 | |
1705 | holgerb | 132 | |
1693 | holgerb | 133 | void Menu_Temperature(uint8_t key) |
1517 | killagreg | 134 | { //0123456789ABCDEF |
2030 | holgerb | 135 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
1687 | holgerb | 136 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature); |
1693 | holgerb | 137 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature); |
1690 | holgerb | 138 | if(RequiredMotors <= 4) |
139 | { |
||
140 | JetiBox_printfxy(0,1,"Temperatures "); |
||
141 | } |
||
142 | else |
||
143 | if(RequiredMotors <= 6) |
||
144 | { |
||
145 | JetiBox_printfxy(8,1,"\%cC ",0xdf); |
||
146 | } |
||
1692 | holgerb | 147 | |
2030 | holgerb | 148 | #endif |
1484 | killagreg | 149 | } |
1517 | killagreg | 150 | |
151 | void Menu_Battery(uint8_t key) |
||
1500 | killagreg | 152 | { //0123456789ABCDEF |
2030 | holgerb | 153 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
1972 | holgerb | 154 | JetiBox_printfxy(0,0,"%2i.%1iV %3i.%1iA", UBat/10, UBat%10, Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
1529 | killagreg | 155 | JetiBox_printfxy(0,1,"%4iW %6imAh",Capacity.ActualPower, Capacity.UsedCapacity); |
2030 | holgerb | 156 | #endif |
1500 | killagreg | 157 | } |
158 | |||
1972 | holgerb | 159 | void Magnet_Values(uint8_t key) |
160 | { //0123456789ABCDEF |
||
2030 | holgerb | 161 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
1972 | holgerb | 162 | JetiBox_printfxy(0,0,"Magnet:%3i%% %3i%c",EarthMagneticField, KompassValue,0xDF); |
163 | JetiBox_printfxy(0,1,"Incli.:%3i%c (%i) ",EarthMagneticInclination, 0xDF,EarthMagneticInclinationTheoretic); |
||
2030 | holgerb | 164 | #endif |
1972 | holgerb | 165 | } |
1680 | holgerb | 166 | |
1972 | holgerb | 167 | |
2418 | holgerb | 168 | void Menu_WPL_A1(uint8_t key) |
169 | { //0123456789ABCDEF |
||
170 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
||
171 | JetiBox_printfxy(0,0,"Load Waypoints"); |
||
2420 | holgerb | 172 | JetiBox_printfxy(0,1,"(Fixed) "); |
2418 | holgerb | 173 | #endif |
174 | } |
||
175 | |||
176 | void Menu_WPL_R1(uint8_t key) |
||
177 | { //0123456789ABCDEF |
||
178 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
||
179 | JetiBox_printfxy(0,0,"Load Waypoints"); |
||
180 | JetiBox_printfxy(0,1,"(Relative) "); |
||
181 | #endif |
||
182 | } |
||
183 | |||
2440 | holgerb | 184 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
2439 | holgerb | 185 | void Menu_POINT_LD(uint8_t key) |
186 | { //0123456789ABCDEF |
||
187 | JetiBox_printfxy(0,0,"Load singl.Point"); |
||
188 | // JetiBox_printfxy(0,1,"(Fixed) "); |
||
2440 | holgerb | 189 | } |
2439 | holgerb | 190 | #endif |
191 | |||
2440 | holgerb | 192 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
2439 | holgerb | 193 | void Menu_POINT_SV(uint8_t key) |
194 | { //0123456789ABCDEF |
||
195 | JetiBox_printfxy(0,0,"Save singl.Point"); |
||
196 | // JetiBox_printfxy(0,1,"(Relative) "); |
||
2440 | holgerb | 197 | } |
2439 | holgerb | 198 | #endif |
199 | |||
2440 | holgerb | 200 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
2439 | holgerb | 201 | void Menu_POINT_SV2(uint8_t key) |
202 | { //0123456789ABCDEF |
||
203 | static unsigned char load_waypoint_tmp = 1, changed; |
||
204 | |||
205 | // if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"Relative WPs ") |
||
206 | // else JetiBox_printfxy(0,0,"Rel:%s",WPL_Name); |
||
207 | JetiBox_printfxy(0,0,"Save Point:"); |
||
208 | |||
209 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
||
210 | else |
||
211 | if(GPSInfo.SatFix != SATFIX_3D) JetiBox_printfxy(0,1,"no GPS-Fix") |
||
212 | else |
||
213 | { |
||
214 | JetiBox_printfxy(11,0,"%2d",load_waypoint_tmp); |
||
215 | |||
216 | // if(NaviData_WaypointNumber) JetiBox_printfxy(8,1,"%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
||
217 | // else JetiBox_printfxy(8,1,"--/--") |
||
218 | JetiBox_printfxy(0,1,"Dir:%3d Alt:%3dm",CompassCorrected,(int16_t)(HoehenWert/100)) |
||
219 | |||
220 | if(changed) JetiBox_printfxy(14,0,"->") |
||
221 | else JetiBox_printfxy(14,0," "); |
||
222 | |||
223 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
||
224 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
||
225 | |||
226 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
||
227 | { |
||
228 | ToNC_Store_SingePoint = load_waypoint_tmp; |
||
229 | changed = 0; |
||
230 | } |
||
231 | } |
||
2440 | holgerb | 232 | } |
2439 | holgerb | 233 | #endif |
234 | |||
2440 | holgerb | 235 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
2439 | holgerb | 236 | void Menu_POINT_LD2(uint8_t key) |
237 | { //0123456789ABCDEF |
||
238 | static unsigned char load_waypoint_tmp = 1, changed; |
||
239 | |||
240 | // if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"FIX Waypoints") |
||
241 | // else JetiBox_printfxy(0,0,"FIX:%s",WPL_Name); |
||
242 | JetiBox_printfxy(0,0,"Load Point") |
||
243 | |||
244 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
||
245 | else |
||
246 | { |
||
247 | JetiBox_printfxy(11,0,"%2d",load_waypoint_tmp); |
||
248 | |||
249 | if(NaviData_WaypointNumber) JetiBox_printfxy(0,1,"Dist:%3d Alt:%3d ",NaviData_TargetDistance,(int16_t)(FromNC_AltitudeSetpoint/100)) |
||
250 | else JetiBox_printfxy(8,1," "); |
||
251 | |||
252 | if(changed) JetiBox_printfxy(14,0,"->") |
||
253 | else JetiBox_printfxy(14,0," "); |
||
254 | |||
255 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
||
256 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
||
257 | |||
258 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
||
259 | { |
||
260 | ToNC_Load_SingePoint = load_waypoint_tmp; |
||
261 | changed = 0; |
||
262 | } |
||
263 | } |
||
2440 | holgerb | 264 | } |
2439 | holgerb | 265 | #endif |
266 | |||
267 | |||
2418 | holgerb | 268 | void Menu_WPL_A2(uint8_t key) |
269 | { //0123456789ABCDEF |
||
270 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
||
2420 | holgerb | 271 | static unsigned char load_waypoint_tmp = 1, changed; |
2424 | holgerb | 272 | |
273 | if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"FIX Waypoints") |
||
274 | else JetiBox_printfxy(0,0,"FIX:%s",WPL_Name); |
||
2418 | holgerb | 275 | |
2420 | holgerb | 276 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
277 | else |
||
278 | { |
||
279 | JetiBox_printfxy(0,1,"#%2d WP:",load_waypoint_tmp); |
||
280 | if(NaviData_WaypointNumber) JetiBox_printfxy(8,1,"%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
||
281 | else JetiBox_printfxy(8,1,"--/--") |
||
282 | |||
2418 | holgerb | 283 | if(changed) JetiBox_printfxy(14,1,"->") |
284 | else JetiBox_printfxy(14,1," "); |
||
285 | |||
2420 | holgerb | 286 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
287 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
||
2418 | holgerb | 288 | |
289 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
||
290 | { |
||
291 | ToNC_Load_WP_List = load_waypoint_tmp; |
||
292 | changed = 0; |
||
293 | } |
||
2420 | holgerb | 294 | } |
2418 | holgerb | 295 | #endif |
296 | } |
||
297 | |||
298 | void Menu_WPL_R2(uint8_t key) |
||
299 | { //0123456789ABCDEF |
||
300 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
||
2420 | holgerb | 301 | static unsigned char load_waypoint_tmp = 1, changed; |
2418 | holgerb | 302 | |
2425 | holgerb | 303 | if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"Relative WPs ") |
2424 | holgerb | 304 | else JetiBox_printfxy(0,0,"Rel:%s",WPL_Name); |
305 | |||
2420 | holgerb | 306 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
307 | else |
||
2425 | holgerb | 308 | if(GPSInfo.SatFix != SATFIX_3D) JetiBox_printfxy(0,1,"no GPS-Fix") |
309 | else |
||
2420 | holgerb | 310 | { |
311 | JetiBox_printfxy(0,1,"#%2d WPs:",load_waypoint_tmp); |
||
312 | if(NaviData_WaypointNumber) JetiBox_printfxy(8,1,"%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
||
313 | else JetiBox_printfxy(8,1,"--/--") |
||
2418 | holgerb | 314 | |
315 | if(changed) JetiBox_printfxy(14,1,"->") |
||
316 | else JetiBox_printfxy(14,1," "); |
||
317 | |||
2420 | holgerb | 318 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
319 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
||
2418 | holgerb | 320 | |
321 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
||
322 | { |
||
323 | ToNC_Load_WP_List = load_waypoint_tmp | 0x80; |
||
324 | changed = 0; |
||
325 | } |
||
2420 | holgerb | 326 | } |
2418 | holgerb | 327 | #endif |
328 | } |
||
329 | |||
330 | |||
331 | |||
1517 | killagreg | 332 | void Menu_PosInfo(uint8_t key) |
1484 | killagreg | 333 | { |
2030 | holgerb | 334 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
1484 | killagreg | 335 | if(NaviDataOkay) |
336 | { |
||
1690 | holgerb | 337 | JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
1517 | killagreg | 338 | switch (GPSInfo.SatFix) |
339 | { |
||
1690 | holgerb | 340 | case SATFIX_3D: |
341 | JetiBox_printfxy(12,0," 3D"); |
||
1517 | killagreg | 342 | break; |
1933 | holgerb | 343 | // case SATFIX_2D: |
344 | // case SATFIX_NONE: |
||
1517 | killagreg | 345 | default: |
1690 | holgerb | 346 | JetiBox_printfxy(12,0,"NoFx"); |
1517 | killagreg | 347 | break; |
348 | } |
||
349 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
||
350 | { |
||
1690 | holgerb | 351 | JetiBox_printfxy(12,0,"DGPS"); |
1517 | killagreg | 352 | } |
1923 | holgerb | 353 | JetiBox_printfxy(0,1,"Home:%3dm %3d%c %c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF,NC_GPS_ModeCharacter); |
1484 | killagreg | 354 | } |
355 | else |
||
1517 | killagreg | 356 | { //0123456789ABCDEF |
357 | JetiBox_printfxy(2,0,"No NaviCtrl!"); |
||
1484 | killagreg | 358 | } |
2030 | holgerb | 359 | #endif |
1484 | killagreg | 360 | } |
361 | |||
1517 | killagreg | 362 | |
1484 | killagreg | 363 | // ----------------------------------------------------------- |
364 | // the menu topology |
||
365 | // ----------------------------------------------------------- |
||
366 | typedef void (*pFctMenu) (uint8_t); // the menu item handler function pointer |
||
367 | |||
368 | typedef struct{ |
||
369 | int8_t left; |
||
370 | int8_t right; |
||
371 | int8_t up; |
||
372 | int8_t down; |
||
373 | pFctMenu pHandler; |
||
374 | } MENU_ENTRY; |
||
375 | |||
376 | |||
377 | // the menu navigation structure |
||
1517 | killagreg | 378 | /* | |
379 | 3 - 0 - 1 - 2 - 3 - 0 |
||
1484 | killagreg | 380 | */ |
381 | |||
382 | const MENU_ENTRY JetiBox_Menu[] PROGMEM= |
||
383 | { // l r u d pHandler |
||
2030 | holgerb | 384 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
2440 | holgerb | 385 | |
386 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
||
2439 | holgerb | 387 | {8, 1, 0, 0, &Menu_Status }, // 0 |
1693 | holgerb | 388 | {0, 2, 1, 1, &Menu_Temperature }, // 1 |
1517 | killagreg | 389 | {1, 3, 2, 2, &Menu_Battery }, // 2 |
1972 | holgerb | 390 | {2, 4, 3, 3, &Menu_PosInfo }, // 3 |
2439 | holgerb | 391 | {3, 5, 4, 9, &Menu_WPL_A1 }, // 4 |
392 | {4, 6, 5,10, &Menu_WPL_R1 }, // 5 |
||
393 | {5, 7, 6,11, &Menu_POINT_LD}, // 6 |
||
394 | {6, 8, 7,12, &Menu_POINT_SV}, // 7 |
||
395 | {7, 0, 8, 6, &Magnet_Values }, // 8 |
||
2418 | holgerb | 396 | |
2439 | holgerb | 397 | {4, 9, 9, 9, &Menu_WPL_A2 }, // 9 |
398 | {5,10,10,10, &Menu_WPL_R2 }, // 10 |
||
399 | {6,11,11,11, &Menu_POINT_LD2}, // 11 |
||
400 | {7,12,12,12, &Menu_POINT_SV2}, // 12 |
||
2440 | holgerb | 401 | #else |
402 | {6, 1, 0, 0, &Menu_Status }, // 0 |
||
403 | {0, 2, 1, 1, &Menu_Temperature }, // 1 |
||
404 | {1, 3, 2, 2, &Menu_Battery }, // 2 |
||
405 | {2, 4, 3, 3, &Menu_PosInfo }, // 3 |
||
406 | {3, 5, 7, 7, &Menu_WPL_A1 }, // 4 |
||
407 | {4, 6, 8, 8, &Menu_WPL_R1 }, // 5 |
||
408 | {5, 0, 6, 6, &Magnet_Values }, // 6 |
||
409 | |||
410 | {4, 7, 7, 7, &Menu_WPL_A2 }, // 7 |
||
411 | {5, 8, 8, 8, &Menu_WPL_R2 }, // 8 |
||
412 | #endif |
||
2418 | holgerb | 413 | |
2030 | holgerb | 414 | #endif |
1484 | killagreg | 415 | }; |
416 | |||
417 | // ----------------------------------------------------------- |
||
418 | // Update display buffer |
||
419 | // ----------------------------------------------------------- |
||
1583 | ingob | 420 | unsigned char JetiBox_Update(unsigned char key) |
1484 | killagreg | 421 | { |
2030 | holgerb | 422 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
1484 | killagreg | 423 | static uint8_t item = 0, last_item = 0; // the menu item |
2418 | holgerb | 424 | static uint8_t updateDelay = 1 , last_key; |
1484 | killagreg | 425 | |
426 | // navigate within the menu by key action |
||
427 | last_item = item; |
||
428 | switch(key) |
||
429 | { |
||
430 | case JETIBOX_KEY_LEFT: |
||
1972 | holgerb | 431 | //if (item == 0) return (1); // switch back to jeti expander menu |
432 | // else |
||
433 | item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
||
1484 | killagreg | 434 | break; |
435 | case JETIBOX_KEY_RIGHT: |
||
436 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
||
437 | break; |
||
438 | case JETIBOX_KEY_UP: |
||
439 | item = pgm_read_byte(&JetiBox_Menu[item].up); //trigger to up menu item |
||
440 | break; |
||
441 | case JETIBOX_KEY_DOWN: |
||
442 | item = pgm_read_byte(&JetiBox_Menu[item].down); //trigger to down menu item |
||
443 | break; |
||
444 | default: |
||
445 | break; |
||
446 | } |
||
447 | // if the menu item has been changed, do not pass the key to the item handler |
||
448 | // to avoid jumping over to items |
||
449 | if(item != last_item) key = JETIBOX_KEY_UNDEF; |
||
450 | |||
2448 | holgerb | 451 | // if((updateDelay++ & 0x01) || (key != last_key)) |
452 | if((updateDelay++ & 0x01) || (key != JETIBOX_KEY_NONE)) |
||
2182 | ingob | 453 | { |
2418 | holgerb | 454 | last_key = key; |
2182 | ingob | 455 | LIBFC_JetiBox_Clear(); |
456 | //execute menu item handler |
||
457 | ((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key); |
||
458 | } |
||
2030 | holgerb | 459 | #endif |
1583 | ingob | 460 | return (0); |
1484 | killagreg | 461 | } |
462 |