Rev 2440 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2440 | Rev 2448 | ||
---|---|---|---|
1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 | // + Software Nutzungsbedingungen (english version: see below) |
2 | // + Software Nutzungsbedingungen (english version: see below) |
3 | // + www.MikroKopter.com |
3 | // + www.MikroKopter.com |
4 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
4 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5 | // + der Fa. HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland - nachfolgend Lizenzgeber genannt - |
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 |
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 |
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. |
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. |
9 | // + Der Einsatz dieser Software ist nur auf oder mit Produkten des Lizenzgebers zulässig. |
10 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
10 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
11 | // + Die vom Lizenzgeber gelieferte Software ist urheberrechtlich geschützt. Alle Rechte an der Software sowie an sonstigen im |
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. |
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 |
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. |
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 |
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. |
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 |
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 |
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. |
19 | // + des Mitverschuldens offen. |
20 | // + Der Kunde trifft angemessene Vorkehrungen für den Fall, dass die Software ganz oder teilweise nicht ordnungsgemäß arbeitet. |
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. |
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. |
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 |
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. |
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. |
25 | // + *) Die räumliche Nutzung bezieht sich nur auf den Einsatzort, nicht auf die Reichweite der programmierten Software. |
26 | // + #### ENDE DER NUTZUNGSBEDINGUNGEN ####' |
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. |
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 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
28 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
29 | // + Software LICENSING TERMS |
29 | // + Software LICENSING TERMS |
30 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
30 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
31 | // + of HiSystems GmbH, Flachsmeerstrasse 2, 26802 Moormerland, Germany - the Licensor - |
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 |
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*. |
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. |
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 |
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 |
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. |
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 |
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. |
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 |
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 |
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 |
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 |
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. |
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 |
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. |
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 |
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. |
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. |
49 | // + *) The territory aspect only refers to the place where the Software is used, not its programmed range. |
50 | // + #### END OF LICENSING TERMS #### |
50 | // + #### END OF LICENSING TERMS #### |
51 | // + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de. |
51 | // + Note: For information on license extensions (e.g. commercial use), please contact us at info(@)hisystems.de. |
52 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
52 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
53 | #include "jetimenu.h" |
53 | #include "jetimenu.h" |
54 | #include "libfc.h" |
54 | #include "libfc.h" |
55 | #include "printf_P.h" |
55 | #include "printf_P.h" |
56 | #include "main.h" |
56 | #include "main.h" |
57 | #include "spi.h" |
57 | #include "spi.h" |
58 | #include "capacity.h" |
58 | #include "capacity.h" |
59 | #include "hottmenu.h" |
59 | #include "hottmenu.h" |
60 | 60 | ||
61 | #define JETIBOX_KEY_RIGHT 0x1F |
61 | #define JETIBOX_KEY_RIGHT 0x1F |
62 | #define JETIBOX_KEY_UP 0x2F |
62 | #define JETIBOX_KEY_UP 0x2F |
63 | #define JETIBOX_KEY_DOWN 0x4F |
63 | #define JETIBOX_KEY_DOWN 0x4F |
64 | #define JETIBOX_KEY_LEFT 0x8F |
64 | #define JETIBOX_KEY_LEFT 0x8F |
65 | #define JETIBOX_KEY_NONE 0x0F |
65 | #define JETIBOX_KEY_NONE 0x0F |
66 | #define JETIBOX_KEY_UNDEF 0x00 |
66 | #define JETIBOX_KEY_UNDEF 0x00 |
67 | 67 | ||
68 | #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);} |
69 | #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);} |
70 | 70 | ||
71 | // ----------------------------------------------------------- |
71 | // ----------------------------------------------------------- |
72 | // the menu functions |
72 | // the menu functions |
73 | // ----------------------------------------------------------- |
73 | // ----------------------------------------------------------- |
74 | void Menu_Status(uint8_t key) |
74 | void Menu_Status(uint8_t key) |
75 | { //0123456789ABCDEF |
75 | { //0123456789ABCDEF |
76 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
76 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
77 | JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10); |
77 | JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10); |
78 | if(NaviDataOkay) |
78 | if(NaviDataOkay) |
79 | { |
79 | { |
80 | JetiBox_printfxy(6,0,"%3d%c %03dm%c",CompassCorrected, 0xDF, GPSInfo.HomeDistance/10,NC_GPS_ModeCharacter); |
80 | JetiBox_printfxy(6,0,"%3d%c %03dm%c",CompassCorrected, 0xDF, GPSInfo.HomeDistance/10,NC_GPS_ModeCharacter); |
81 | } |
81 | } |
82 | else |
82 | else |
83 | { |
83 | { |
84 | JetiBox_printfxy(6,0,"Status"); |
84 | JetiBox_printfxy(6,0,"Status"); |
85 | } |
85 | } |
86 | 86 | ||
87 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
87 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
88 | if(NC_ErrorCode) |
88 | if(NC_ErrorCode) |
89 | { |
89 | { |
90 | static unsigned int timer; |
90 | static unsigned int timer; |
91 | static char toggle = 1; |
91 | static char toggle = 1; |
92 | 92 | ||
93 | 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);}; |
94 | if(toggle) |
94 | if(toggle) |
95 | { |
95 | { |
96 | LIBFC_JetiBox_SetPos(0); |
96 | LIBFC_JetiBox_SetPos(0); |
97 | _printf_P(&LIBFC_JetiBox_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0); |
97 | _printf_P(&LIBFC_JetiBox_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0); |
98 | } |
98 | } |
99 | else |
99 | else |
100 | { |
100 | { |
101 | JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); |
101 | JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); |
102 | // if(MotorenEin) JetiBeep = 'O'; |
102 | // if(MotorenEin) JetiBeep = 'O'; |
103 | } |
103 | } |
104 | } |
104 | } |
105 | else |
105 | else |
106 | if(ShowSettingNameTime) |
106 | if(ShowSettingNameTime) |
107 | { |
107 | { |
108 | LIBFC_JetiBox_Clear(); |
108 | LIBFC_JetiBox_Clear(); |
109 | JetiBox_printfxy(0,1,"Set%d:%s ",ActiveParamSet,EE_Parameter.Name); |
109 | JetiBox_printfxy(0,1,"Set%d:%s ",ActiveParamSet,EE_Parameter.Name); |
110 | return; // nichts weiter ausgeben |
110 | return; // nichts weiter ausgeben |
111 | } |
111 | } |
112 | 112 | ||
113 | #else |
113 | #else |
114 | if(NC_ErrorCode) { JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); if(MotorenEin) JetiBeep = 'S';}; |
114 | if(NC_ErrorCode) { JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); if(MotorenEin) JetiBeep = 'S';}; |
115 | #endif |
115 | #endif |
116 | JetiBox_printfxy(0,1,"%4i %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60); |
116 | JetiBox_printfxy(0,1,"%4i %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60); |
117 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
117 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
118 | { |
118 | { |
119 | JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter); |
119 | JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter); |
120 | } |
120 | } |
121 | if(RedundanceBlOperation) JetiBox_printfxy(10,1,"R"); |
121 | if(RedundanceBlOperation) JetiBox_printfxy(10,1,"R"); |
122 | 122 | ||
123 | #endif |
123 | #endif |
124 | } |
124 | } |
125 | 125 | ||
126 | 126 | ||
127 | void Menu_Temperature(uint8_t key) |
127 | void Menu_Temperature(uint8_t key) |
128 | { //0123456789ABCDEF |
128 | { //0123456789ABCDEF |
129 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
129 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
130 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature); |
130 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature); |
131 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature); |
131 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature); |
132 | if(RequiredMotors <= 4) |
132 | if(RequiredMotors <= 4) |
133 | { |
133 | { |
134 | JetiBox_printfxy(0,1,"Temperatures "); |
134 | JetiBox_printfxy(0,1,"Temperatures "); |
135 | } |
135 | } |
136 | else |
136 | else |
137 | if(RequiredMotors <= 6) |
137 | if(RequiredMotors <= 6) |
138 | { |
138 | { |
139 | JetiBox_printfxy(8,1,"\%cC ",0xdf); |
139 | JetiBox_printfxy(8,1,"\%cC ",0xdf); |
140 | } |
140 | } |
141 | 141 | ||
142 | #endif |
142 | #endif |
143 | } |
143 | } |
144 | 144 | ||
145 | void Menu_Battery(uint8_t key) |
145 | void Menu_Battery(uint8_t key) |
146 | { //0123456789ABCDEF |
146 | { //0123456789ABCDEF |
147 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
147 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
148 | JetiBox_printfxy(0,0,"%2i.%1iV %3i.%1iA", UBat/10, UBat%10, Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
148 | JetiBox_printfxy(0,0,"%2i.%1iV %3i.%1iA", UBat/10, UBat%10, Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
149 | JetiBox_printfxy(0,1,"%4iW %6imAh",Capacity.ActualPower, Capacity.UsedCapacity); |
149 | JetiBox_printfxy(0,1,"%4iW %6imAh",Capacity.ActualPower, Capacity.UsedCapacity); |
150 | #endif |
150 | #endif |
151 | } |
151 | } |
152 | 152 | ||
153 | void Magnet_Values(uint8_t key) |
153 | void Magnet_Values(uint8_t key) |
154 | { //0123456789ABCDEF |
154 | { //0123456789ABCDEF |
155 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
155 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
156 | JetiBox_printfxy(0,0,"Magnet:%3i%% %3i%c",EarthMagneticField, KompassValue,0xDF); |
156 | JetiBox_printfxy(0,0,"Magnet:%3i%% %3i%c",EarthMagneticField, KompassValue,0xDF); |
157 | JetiBox_printfxy(0,1,"Incli.:%3i%c (%i) ",EarthMagneticInclination, 0xDF,EarthMagneticInclinationTheoretic); |
157 | JetiBox_printfxy(0,1,"Incli.:%3i%c (%i) ",EarthMagneticInclination, 0xDF,EarthMagneticInclinationTheoretic); |
158 | #endif |
158 | #endif |
159 | } |
159 | } |
160 | 160 | ||
161 | 161 | ||
162 | void Menu_WPL_A1(uint8_t key) |
162 | void Menu_WPL_A1(uint8_t key) |
163 | { //0123456789ABCDEF |
163 | { //0123456789ABCDEF |
164 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
164 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
165 | JetiBox_printfxy(0,0,"Load Waypoints"); |
165 | JetiBox_printfxy(0,0,"Load Waypoints"); |
166 | JetiBox_printfxy(0,1,"(Fixed) "); |
166 | JetiBox_printfxy(0,1,"(Fixed) "); |
167 | #endif |
167 | #endif |
168 | } |
168 | } |
169 | 169 | ||
170 | void Menu_WPL_R1(uint8_t key) |
170 | void Menu_WPL_R1(uint8_t key) |
171 | { //0123456789ABCDEF |
171 | { //0123456789ABCDEF |
172 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
172 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
173 | JetiBox_printfxy(0,0,"Load Waypoints"); |
173 | JetiBox_printfxy(0,0,"Load Waypoints"); |
174 | JetiBox_printfxy(0,1,"(Relative) "); |
174 | JetiBox_printfxy(0,1,"(Relative) "); |
175 | #endif |
175 | #endif |
176 | } |
176 | } |
177 | 177 | ||
178 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
178 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
179 | void Menu_POINT_LD(uint8_t key) |
179 | void Menu_POINT_LD(uint8_t key) |
180 | { //0123456789ABCDEF |
180 | { //0123456789ABCDEF |
181 | JetiBox_printfxy(0,0,"Load singl.Point"); |
181 | JetiBox_printfxy(0,0,"Load singl.Point"); |
182 | // JetiBox_printfxy(0,1,"(Fixed) "); |
182 | // JetiBox_printfxy(0,1,"(Fixed) "); |
183 | } |
183 | } |
184 | #endif |
184 | #endif |
185 | 185 | ||
186 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
186 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
187 | void Menu_POINT_SV(uint8_t key) |
187 | void Menu_POINT_SV(uint8_t key) |
188 | { //0123456789ABCDEF |
188 | { //0123456789ABCDEF |
189 | JetiBox_printfxy(0,0,"Save singl.Point"); |
189 | JetiBox_printfxy(0,0,"Save singl.Point"); |
190 | // JetiBox_printfxy(0,1,"(Relative) "); |
190 | // JetiBox_printfxy(0,1,"(Relative) "); |
191 | } |
191 | } |
192 | #endif |
192 | #endif |
193 | 193 | ||
194 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
194 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
195 | void Menu_POINT_SV2(uint8_t key) |
195 | void Menu_POINT_SV2(uint8_t key) |
196 | { //0123456789ABCDEF |
196 | { //0123456789ABCDEF |
197 | static unsigned char load_waypoint_tmp = 1, changed; |
197 | static unsigned char load_waypoint_tmp = 1, changed; |
198 | 198 | ||
199 | // if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"Relative WPs ") |
199 | // if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"Relative WPs ") |
200 | // else JetiBox_printfxy(0,0,"Rel:%s",WPL_Name); |
200 | // else JetiBox_printfxy(0,0,"Rel:%s",WPL_Name); |
201 | JetiBox_printfxy(0,0,"Save Point:"); |
201 | JetiBox_printfxy(0,0,"Save Point:"); |
202 | 202 | ||
203 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
203 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
204 | else |
204 | else |
205 | if(GPSInfo.SatFix != SATFIX_3D) JetiBox_printfxy(0,1,"no GPS-Fix") |
205 | if(GPSInfo.SatFix != SATFIX_3D) JetiBox_printfxy(0,1,"no GPS-Fix") |
206 | else |
206 | else |
207 | { |
207 | { |
208 | JetiBox_printfxy(11,0,"%2d",load_waypoint_tmp); |
208 | JetiBox_printfxy(11,0,"%2d",load_waypoint_tmp); |
209 | 209 | ||
210 | // if(NaviData_WaypointNumber) JetiBox_printfxy(8,1,"%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
210 | // if(NaviData_WaypointNumber) JetiBox_printfxy(8,1,"%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
211 | // else JetiBox_printfxy(8,1,"--/--") |
211 | // else JetiBox_printfxy(8,1,"--/--") |
212 | JetiBox_printfxy(0,1,"Dir:%3d Alt:%3dm",CompassCorrected,(int16_t)(HoehenWert/100)) |
212 | JetiBox_printfxy(0,1,"Dir:%3d Alt:%3dm",CompassCorrected,(int16_t)(HoehenWert/100)) |
213 | 213 | ||
214 | if(changed) JetiBox_printfxy(14,0,"->") |
214 | if(changed) JetiBox_printfxy(14,0,"->") |
215 | else JetiBox_printfxy(14,0," "); |
215 | else JetiBox_printfxy(14,0," "); |
216 | 216 | ||
217 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
217 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
218 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
218 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
219 | 219 | ||
220 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
220 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
221 | { |
221 | { |
222 | ToNC_Store_SingePoint = load_waypoint_tmp; |
222 | ToNC_Store_SingePoint = load_waypoint_tmp; |
223 | changed = 0; |
223 | changed = 0; |
224 | } |
224 | } |
225 | } |
225 | } |
226 | } |
226 | } |
227 | #endif |
227 | #endif |
228 | 228 | ||
229 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
229 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
230 | void Menu_POINT_LD2(uint8_t key) |
230 | void Menu_POINT_LD2(uint8_t key) |
231 | { //0123456789ABCDEF |
231 | { //0123456789ABCDEF |
232 | static unsigned char load_waypoint_tmp = 1, changed; |
232 | static unsigned char load_waypoint_tmp = 1, changed; |
233 | 233 | ||
234 | // if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"FIX Waypoints") |
234 | // if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"FIX Waypoints") |
235 | // else JetiBox_printfxy(0,0,"FIX:%s",WPL_Name); |
235 | // else JetiBox_printfxy(0,0,"FIX:%s",WPL_Name); |
236 | JetiBox_printfxy(0,0,"Load Point") |
236 | JetiBox_printfxy(0,0,"Load Point") |
237 | 237 | ||
238 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
238 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
239 | else |
239 | else |
240 | { |
240 | { |
241 | JetiBox_printfxy(11,0,"%2d",load_waypoint_tmp); |
241 | JetiBox_printfxy(11,0,"%2d",load_waypoint_tmp); |
242 | 242 | ||
243 | if(NaviData_WaypointNumber) JetiBox_printfxy(0,1,"Dist:%3d Alt:%3d ",NaviData_TargetDistance,(int16_t)(FromNC_AltitudeSetpoint/100)) |
243 | if(NaviData_WaypointNumber) JetiBox_printfxy(0,1,"Dist:%3d Alt:%3d ",NaviData_TargetDistance,(int16_t)(FromNC_AltitudeSetpoint/100)) |
244 | else JetiBox_printfxy(8,1," "); |
244 | else JetiBox_printfxy(8,1," "); |
245 | 245 | ||
246 | if(changed) JetiBox_printfxy(14,0,"->") |
246 | if(changed) JetiBox_printfxy(14,0,"->") |
247 | else JetiBox_printfxy(14,0," "); |
247 | else JetiBox_printfxy(14,0," "); |
248 | 248 | ||
249 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
249 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
250 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
250 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
251 | 251 | ||
252 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
252 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
253 | { |
253 | { |
254 | ToNC_Load_SingePoint = load_waypoint_tmp; |
254 | ToNC_Load_SingePoint = load_waypoint_tmp; |
255 | changed = 0; |
255 | changed = 0; |
256 | } |
256 | } |
257 | } |
257 | } |
258 | } |
258 | } |
259 | #endif |
259 | #endif |
260 | 260 | ||
261 | 261 | ||
262 | void Menu_WPL_A2(uint8_t key) |
262 | void Menu_WPL_A2(uint8_t key) |
263 | { //0123456789ABCDEF |
263 | { //0123456789ABCDEF |
264 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
264 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
265 | static unsigned char load_waypoint_tmp = 1, changed; |
265 | static unsigned char load_waypoint_tmp = 1, changed; |
266 | 266 | ||
267 | if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"FIX Waypoints") |
267 | if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"FIX Waypoints") |
268 | else JetiBox_printfxy(0,0,"FIX:%s",WPL_Name); |
268 | else JetiBox_printfxy(0,0,"FIX:%s",WPL_Name); |
269 | 269 | ||
270 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
270 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
271 | else |
271 | else |
272 | { |
272 | { |
273 | JetiBox_printfxy(0,1,"#%2d WP:",load_waypoint_tmp); |
273 | JetiBox_printfxy(0,1,"#%2d WP:",load_waypoint_tmp); |
274 | if(NaviData_WaypointNumber) JetiBox_printfxy(8,1,"%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
274 | if(NaviData_WaypointNumber) JetiBox_printfxy(8,1,"%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
275 | else JetiBox_printfxy(8,1,"--/--") |
275 | else JetiBox_printfxy(8,1,"--/--") |
276 | 276 | ||
277 | if(changed) JetiBox_printfxy(14,1,"->") |
277 | if(changed) JetiBox_printfxy(14,1,"->") |
278 | else JetiBox_printfxy(14,1," "); |
278 | else JetiBox_printfxy(14,1," "); |
279 | 279 | ||
280 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
280 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
281 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
281 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
282 | 282 | ||
283 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
283 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
284 | { |
284 | { |
285 | ToNC_Load_WP_List = load_waypoint_tmp; |
285 | ToNC_Load_WP_List = load_waypoint_tmp; |
286 | changed = 0; |
286 | changed = 0; |
287 | } |
287 | } |
288 | } |
288 | } |
289 | #endif |
289 | #endif |
290 | } |
290 | } |
291 | 291 | ||
292 | void Menu_WPL_R2(uint8_t key) |
292 | void Menu_WPL_R2(uint8_t key) |
293 | { //0123456789ABCDEF |
293 | { //0123456789ABCDEF |
294 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
294 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
295 | static unsigned char load_waypoint_tmp = 1, changed; |
295 | static unsigned char load_waypoint_tmp = 1, changed; |
296 | 296 | ||
297 | if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"Relative WPs ") |
297 | if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"Relative WPs ") |
298 | else JetiBox_printfxy(0,0,"Rel:%s",WPL_Name); |
298 | else JetiBox_printfxy(0,0,"Rel:%s",WPL_Name); |
299 | 299 | ||
300 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
300 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
301 | else |
301 | else |
302 | if(GPSInfo.SatFix != SATFIX_3D) JetiBox_printfxy(0,1,"no GPS-Fix") |
302 | if(GPSInfo.SatFix != SATFIX_3D) JetiBox_printfxy(0,1,"no GPS-Fix") |
303 | else |
303 | else |
304 | { |
304 | { |
305 | JetiBox_printfxy(0,1,"#%2d WPs:",load_waypoint_tmp); |
305 | JetiBox_printfxy(0,1,"#%2d WPs:",load_waypoint_tmp); |
306 | if(NaviData_WaypointNumber) JetiBox_printfxy(8,1,"%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
306 | if(NaviData_WaypointNumber) JetiBox_printfxy(8,1,"%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
307 | else JetiBox_printfxy(8,1,"--/--") |
307 | else JetiBox_printfxy(8,1,"--/--") |
308 | 308 | ||
309 | if(changed) JetiBox_printfxy(14,1,"->") |
309 | if(changed) JetiBox_printfxy(14,1,"->") |
310 | else JetiBox_printfxy(14,1," "); |
310 | else JetiBox_printfxy(14,1," "); |
311 | 311 | ||
312 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
312 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
313 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
313 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
314 | 314 | ||
315 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
315 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
316 | { |
316 | { |
317 | ToNC_Load_WP_List = load_waypoint_tmp | 0x80; |
317 | ToNC_Load_WP_List = load_waypoint_tmp | 0x80; |
318 | changed = 0; |
318 | changed = 0; |
319 | } |
319 | } |
320 | } |
320 | } |
321 | #endif |
321 | #endif |
322 | } |
322 | } |
323 | 323 | ||
324 | 324 | ||
325 | 325 | ||
326 | void Menu_PosInfo(uint8_t key) |
326 | void Menu_PosInfo(uint8_t key) |
327 | { |
327 | { |
328 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
328 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
329 | if(NaviDataOkay) |
329 | if(NaviDataOkay) |
330 | { |
330 | { |
331 | JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
331 | JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
332 | switch (GPSInfo.SatFix) |
332 | switch (GPSInfo.SatFix) |
333 | { |
333 | { |
334 | case SATFIX_3D: |
334 | case SATFIX_3D: |
335 | JetiBox_printfxy(12,0," 3D"); |
335 | JetiBox_printfxy(12,0," 3D"); |
336 | break; |
336 | break; |
337 | // case SATFIX_2D: |
337 | // case SATFIX_2D: |
338 | // case SATFIX_NONE: |
338 | // case SATFIX_NONE: |
339 | default: |
339 | default: |
340 | JetiBox_printfxy(12,0,"NoFx"); |
340 | JetiBox_printfxy(12,0,"NoFx"); |
341 | break; |
341 | break; |
342 | } |
342 | } |
343 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
343 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
344 | { |
344 | { |
345 | JetiBox_printfxy(12,0,"DGPS"); |
345 | JetiBox_printfxy(12,0,"DGPS"); |
346 | } |
346 | } |
347 | JetiBox_printfxy(0,1,"Home:%3dm %3d%c %c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF,NC_GPS_ModeCharacter); |
347 | JetiBox_printfxy(0,1,"Home:%3dm %3d%c %c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF,NC_GPS_ModeCharacter); |
348 | } |
348 | } |
349 | else |
349 | else |
350 | { //0123456789ABCDEF |
350 | { //0123456789ABCDEF |
351 | JetiBox_printfxy(2,0,"No NaviCtrl!"); |
351 | JetiBox_printfxy(2,0,"No NaviCtrl!"); |
352 | } |
352 | } |
353 | #endif |
353 | #endif |
354 | } |
354 | } |
355 | 355 | ||
356 | 356 | ||
357 | // ----------------------------------------------------------- |
357 | // ----------------------------------------------------------- |
358 | // the menu topology |
358 | // the menu topology |
359 | // ----------------------------------------------------------- |
359 | // ----------------------------------------------------------- |
360 | typedef void (*pFctMenu) (uint8_t); // the menu item handler function pointer |
360 | typedef void (*pFctMenu) (uint8_t); // the menu item handler function pointer |
361 | 361 | ||
362 | typedef struct{ |
362 | typedef struct{ |
363 | int8_t left; |
363 | int8_t left; |
364 | int8_t right; |
364 | int8_t right; |
365 | int8_t up; |
365 | int8_t up; |
366 | int8_t down; |
366 | int8_t down; |
367 | pFctMenu pHandler; |
367 | pFctMenu pHandler; |
368 | } MENU_ENTRY; |
368 | } MENU_ENTRY; |
369 | 369 | ||
370 | 370 | ||
371 | // the menu navigation structure |
371 | // the menu navigation structure |
372 | /* | |
372 | /* | |
373 | 3 - 0 - 1 - 2 - 3 - 0 |
373 | 3 - 0 - 1 - 2 - 3 - 0 |
374 | */ |
374 | */ |
375 | 375 | ||
376 | const MENU_ENTRY JetiBox_Menu[] PROGMEM= |
376 | const MENU_ENTRY JetiBox_Menu[] PROGMEM= |
377 | { // l r u d pHandler |
377 | { // l r u d pHandler |
378 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
378 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
379 | 379 | ||
380 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
380 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
381 | {8, 1, 0, 0, &Menu_Status }, // 0 |
381 | {8, 1, 0, 0, &Menu_Status }, // 0 |
382 | {0, 2, 1, 1, &Menu_Temperature }, // 1 |
382 | {0, 2, 1, 1, &Menu_Temperature }, // 1 |
383 | {1, 3, 2, 2, &Menu_Battery }, // 2 |
383 | {1, 3, 2, 2, &Menu_Battery }, // 2 |
384 | {2, 4, 3, 3, &Menu_PosInfo }, // 3 |
384 | {2, 4, 3, 3, &Menu_PosInfo }, // 3 |
385 | {3, 5, 4, 9, &Menu_WPL_A1 }, // 4 |
385 | {3, 5, 4, 9, &Menu_WPL_A1 }, // 4 |
386 | {4, 6, 5,10, &Menu_WPL_R1 }, // 5 |
386 | {4, 6, 5,10, &Menu_WPL_R1 }, // 5 |
387 | {5, 7, 6,11, &Menu_POINT_LD}, // 6 |
387 | {5, 7, 6,11, &Menu_POINT_LD}, // 6 |
388 | {6, 8, 7,12, &Menu_POINT_SV}, // 7 |
388 | {6, 8, 7,12, &Menu_POINT_SV}, // 7 |
389 | {7, 0, 8, 6, &Magnet_Values }, // 8 |
389 | {7, 0, 8, 6, &Magnet_Values }, // 8 |
390 | 390 | ||
391 | {4, 9, 9, 9, &Menu_WPL_A2 }, // 9 |
391 | {4, 9, 9, 9, &Menu_WPL_A2 }, // 9 |
392 | {5,10,10,10, &Menu_WPL_R2 }, // 10 |
392 | {5,10,10,10, &Menu_WPL_R2 }, // 10 |
393 | {6,11,11,11, &Menu_POINT_LD2}, // 11 |
393 | {6,11,11,11, &Menu_POINT_LD2}, // 11 |
394 | {7,12,12,12, &Menu_POINT_SV2}, // 12 |
394 | {7,12,12,12, &Menu_POINT_SV2}, // 12 |
395 | #else |
395 | #else |
396 | {6, 1, 0, 0, &Menu_Status }, // 0 |
396 | {6, 1, 0, 0, &Menu_Status }, // 0 |
397 | {0, 2, 1, 1, &Menu_Temperature }, // 1 |
397 | {0, 2, 1, 1, &Menu_Temperature }, // 1 |
398 | {1, 3, 2, 2, &Menu_Battery }, // 2 |
398 | {1, 3, 2, 2, &Menu_Battery }, // 2 |
399 | {2, 4, 3, 3, &Menu_PosInfo }, // 3 |
399 | {2, 4, 3, 3, &Menu_PosInfo }, // 3 |
400 | {3, 5, 7, 7, &Menu_WPL_A1 }, // 4 |
400 | {3, 5, 7, 7, &Menu_WPL_A1 }, // 4 |
401 | {4, 6, 8, 8, &Menu_WPL_R1 }, // 5 |
401 | {4, 6, 8, 8, &Menu_WPL_R1 }, // 5 |
402 | {5, 0, 6, 6, &Magnet_Values }, // 6 |
402 | {5, 0, 6, 6, &Magnet_Values }, // 6 |
403 | 403 | ||
404 | {4, 7, 7, 7, &Menu_WPL_A2 }, // 7 |
404 | {4, 7, 7, 7, &Menu_WPL_A2 }, // 7 |
405 | {5, 8, 8, 8, &Menu_WPL_R2 }, // 8 |
405 | {5, 8, 8, 8, &Menu_WPL_R2 }, // 8 |
406 | #endif |
406 | #endif |
407 | 407 | ||
408 | #endif |
408 | #endif |
409 | }; |
409 | }; |
410 | 410 | ||
411 | // ----------------------------------------------------------- |
411 | // ----------------------------------------------------------- |
412 | // Update display buffer |
412 | // Update display buffer |
413 | // ----------------------------------------------------------- |
413 | // ----------------------------------------------------------- |
414 | unsigned char JetiBox_Update(unsigned char key) |
414 | unsigned char JetiBox_Update(unsigned char key) |
415 | { |
415 | { |
416 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
416 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
417 | static uint8_t item = 0, last_item = 0; // the menu item |
417 | static uint8_t item = 0, last_item = 0; // the menu item |
418 | static uint8_t updateDelay = 1 , last_key; |
418 | static uint8_t updateDelay = 1 , last_key; |
419 | 419 | ||
420 | // navigate within the menu by key action |
420 | // navigate within the menu by key action |
421 | last_item = item; |
421 | last_item = item; |
422 | switch(key) |
422 | switch(key) |
423 | { |
423 | { |
424 | case JETIBOX_KEY_LEFT: |
424 | case JETIBOX_KEY_LEFT: |
425 | //if (item == 0) return (1); // switch back to jeti expander menu |
425 | //if (item == 0) return (1); // switch back to jeti expander menu |
426 | // else |
426 | // else |
427 | item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
427 | item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
428 | break; |
428 | break; |
429 | case JETIBOX_KEY_RIGHT: |
429 | case JETIBOX_KEY_RIGHT: |
430 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
430 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
431 | break; |
431 | break; |
432 | case JETIBOX_KEY_UP: |
432 | case JETIBOX_KEY_UP: |
433 | item = pgm_read_byte(&JetiBox_Menu[item].up); //trigger to up menu item |
433 | item = pgm_read_byte(&JetiBox_Menu[item].up); //trigger to up menu item |
434 | break; |
434 | break; |
435 | case JETIBOX_KEY_DOWN: |
435 | case JETIBOX_KEY_DOWN: |
436 | item = pgm_read_byte(&JetiBox_Menu[item].down); //trigger to down menu item |
436 | item = pgm_read_byte(&JetiBox_Menu[item].down); //trigger to down menu item |
437 | break; |
437 | break; |
438 | default: |
438 | default: |
439 | break; |
439 | break; |
440 | } |
440 | } |
441 | // if the menu item has been changed, do not pass the key to the item handler |
441 | // if the menu item has been changed, do not pass the key to the item handler |
442 | // to avoid jumping over to items |
442 | // to avoid jumping over to items |
443 | if(item != last_item) key = JETIBOX_KEY_UNDEF; |
443 | if(item != last_item) key = JETIBOX_KEY_UNDEF; |
444 | 444 | ||
- | 445 | // if((updateDelay++ & 0x01) || (key != last_key)) |
|
445 | if((updateDelay++ & 0x01) || (key != last_key)) |
446 | if((updateDelay++ & 0x01) || (key != JETIBOX_KEY_NONE)) |
446 | { |
447 | { |
447 | last_key = key; |
448 | last_key = key; |
448 | LIBFC_JetiBox_Clear(); |
449 | LIBFC_JetiBox_Clear(); |
449 | //execute menu item handler |
450 | //execute menu item handler |
450 | ((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key); |
451 | ((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key); |
451 | } |
452 | } |
452 | #endif |
453 | #endif |
453 | return (0); |
454 | return (0); |
454 | } |
455 | } |
455 | 456 | ||
456 | 457 |