Rev 2542 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2542 | Rev 2554 | ||
---|---|---|---|
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 | unsigned char JumpToMenu = 0xff; |
71 | unsigned char JumpToMenu = 0xff; |
72 | 72 | ||
73 | // ----------------------------------------------------------- |
73 | // ----------------------------------------------------------- |
74 | // the menu functions |
74 | // the menu functions |
75 | // ----------------------------------------------------------- |
75 | // ----------------------------------------------------------- |
76 | void Menu_Status(uint8_t key) |
76 | void Menu_Status(uint8_t key) |
77 | { //0123456789ABCDEF |
77 | { //0123456789ABCDEF |
78 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
78 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
79 | JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10); |
79 | JetiBox_printfxy(0,0,"%2i.%1iV",UBat/10, UBat%10); |
80 | if(NaviDataOkay) |
80 | if(NaviDataOkay) |
81 | { |
81 | { |
82 | JetiBox_printfxy(6,0,"%3d%c %3dm%c",CompassCorrected, 0xDF, GPSInfo.HomeDistance/10,NC_GPS_ModeCharacter); |
82 | JetiBox_printfxy(6,0,"%3d%c %3dm%c",CompassCorrected, 0xDF, GPSInfo.HomeDistance/10,NC_GPS_ModeCharacter); |
83 | } |
83 | } |
84 | else |
84 | else |
85 | { |
85 | { |
86 | JetiBox_printfxy(6,0,"Status "); |
86 | JetiBox_printfxy(6,0,"Status "); |
87 | } |
87 | } |
88 | 88 | ||
89 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
89 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
90 | if(NC_ErrorCode) |
90 | if(NC_ErrorCode) |
91 | { |
91 | { |
92 | static unsigned int timer; |
92 | static unsigned int timer; |
93 | static char toggle = 1; |
93 | static char toggle = 1; |
94 | 94 | ||
95 | if(CheckDelay(timer)) { if(toggle) toggle = 0; else toggle = 1; timer = SetDelay(1500);}; |
95 | if(CheckDelay(timer)) { if(toggle) toggle = 0; else toggle = 1; timer = SetDelay(1500);}; |
96 | if(toggle) |
96 | if(toggle) |
97 | { |
97 | { |
98 | LIBFC_JetiBox_SetPos(0); |
98 | LIBFC_JetiBox_SetPos(0); |
99 | _printf_P(&LIBFC_JetiBox_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0); |
99 | _printf_P(&LIBFC_JetiBox_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0); |
100 | } |
100 | } |
101 | else |
101 | else |
102 | { |
102 | { |
103 | JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); |
103 | JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); |
104 | // if(MotorenEin) JetiBeep = 'O'; |
104 | // if(MotorenEin) JetiBeep = 'O'; |
105 | } |
105 | } |
106 | } |
106 | } |
107 | else |
107 | else |
108 | if(NC_To_FC_Flags & NC_TO_FC_SIMULATION_ACTIVE) |
108 | if(NC_To_FC_Flags & NC_TO_FC_SIMULATION_ACTIVE) |
109 | { |
109 | { |
110 | JetiBox_printfxy(6,0,"SIMULATION"); |
110 | JetiBox_printfxy(6,0,"SIMULATION"); |
111 | } |
111 | } |
112 | else |
112 | else |
113 | if(ShowSettingNameTime) |
113 | if(ShowSettingNameTime) |
114 | { |
114 | { |
115 | LIBFC_JetiBox_Clear(); |
115 | LIBFC_JetiBox_Clear(); |
116 | JetiBox_printfxy(0,0,"Set%d:%s",ActiveParamSet,EE_Parameter.Name); |
116 | JetiBox_printfxy(0,0,"Set%d:%s",ActiveParamSet,EE_Parameter.Name); |
117 | if(FC_StatusFlags3 & FC_STATUS3_BOAT) JetiBox_printfxy(0,1,"(Boat-Mode)"); |
117 | if(FC_StatusFlags3 & FC_STATUS3_BOAT) JetiBox_printfxy(0,1,"(Boat-Mode)"); |
118 | return; // nichts weiter ausgeben |
118 | return; // nichts weiter ausgeben |
119 | } |
119 | } |
120 | 120 | ||
121 | #else |
121 | #else |
122 | if(NC_ErrorCode) { JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); if(MotorenEin) JetiBeep = 'S';}; |
122 | if(NC_ErrorCode) { JetiBox_printfxy(6,0,"ERROR: %2d ",NC_ErrorCode); if(MotorenEin) JetiBeep = 'S';}; |
123 | #endif |
123 | #endif |
124 | JetiBox_printfxy(0,1,"%4i %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60); |
124 | JetiBox_printfxy(0,1,"%4i %2i:%02i",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60); |
125 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
125 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
126 | { |
126 | { |
127 | JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter); |
127 | JetiBox_printfxy(10,1,"%4im%c", (int16_t)(HoehenWert/100),VarioCharacter); |
128 | } |
128 | } |
129 | if(FC_StatusFlags3 & FC_STATUS3_REDUNDANCE_AKTIVE) JetiBox_printfxy(10,1,"R"); |
129 | if(FC_StatusFlags3 & FC_STATUS3_REDUNDANCE_AKTIVE) JetiBox_printfxy(10,1,"R"); |
130 | 130 | ||
131 | #endif |
131 | #endif |
132 | } |
132 | } |
133 | 133 | ||
134 | 134 | ||
135 | void Menu_Temperature(uint8_t key) |
135 | void Menu_Temperature(uint8_t key) |
136 | { //0123456789ABCDEF |
136 | { //0123456789ABCDEF |
137 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
137 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
138 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature); |
138 | JetiBox_printfxy(0,0,"%3i %3i %3i %3i", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature); |
139 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature); |
139 | JetiBox_printfxy(0,1,"%3i %3i %3i %3i", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature); |
140 | if(RequiredMotors <= 4) |
140 | if(RequiredMotors <= 4) |
141 | { |
141 | { |
142 | JetiBox_printfxy(0,1,"Temperatures "); |
142 | JetiBox_printfxy(0,1,"Temperatures "); |
143 | } |
143 | } |
144 | else |
144 | else |
145 | if(RequiredMotors <= 6) |
145 | if(RequiredMotors <= 6) |
146 | { |
146 | { |
147 | JetiBox_printfxy(8,1,"\%cC ",0xdf); |
147 | JetiBox_printfxy(8,1,"\%cC ",0xdf); |
148 | } |
148 | } |
149 | 149 | ||
150 | #endif |
150 | #endif |
151 | } |
151 | } |
152 | 152 | ||
153 | void Menu_Battery(uint8_t key) |
153 | void Menu_Battery(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,"%2i.%1iV %3i.%1iA", UBat/10, UBat%10, Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
156 | JetiBox_printfxy(0,0,"%2i.%1iV %3i.%1iA", UBat/10, UBat%10, Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
157 | JetiBox_printfxy(0,1,"%4iW %6imAh",Capacity.ActualPower, Capacity.UsedCapacity); |
157 | JetiBox_printfxy(0,1,"%4iW %6imAh",Capacity.ActualPower, Capacity.UsedCapacity); |
158 | #endif |
158 | #endif |
159 | } |
159 | } |
160 | 160 | ||
161 | void Magnet_Values(uint8_t key) |
161 | void Magnet_Values(uint8_t key) |
162 | { //0123456789ABCDEF |
162 | { //0123456789ABCDEF |
163 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
163 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
164 | JetiBox_printfxy(0,0,"Magnet:%3i%% %3i%c",EarthMagneticField, KompassValue,0xDF); |
164 | JetiBox_printfxy(0,0,"Magnet:%3i%% %3i%c",EarthMagneticField, KompassValue,0xDF); |
165 | JetiBox_printfxy(0,1,"Incli.:%3i%c (%i) ",EarthMagneticInclination, 0xDF,EarthMagneticInclinationTheoretic); |
165 | JetiBox_printfxy(0,1,"Incli.:%3i%c (%i) ",EarthMagneticInclination, 0xDF,EarthMagneticInclinationTheoretic); |
166 | #endif |
166 | #endif |
167 | } |
167 | } |
168 | 168 | ||
169 | 169 | ||
170 | void Menu_WPL_A1(uint8_t key) |
170 | void Menu_WPL_A1(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,"(Fixed) "); |
174 | JetiBox_printfxy(0,1,"(Fixed) "); |
175 | #endif |
175 | #endif |
176 | } |
176 | } |
177 | 177 | ||
178 | void Menu_WPL_R1(uint8_t key) |
178 | void Menu_WPL_R1(uint8_t key) |
179 | { //0123456789ABCDEF |
179 | { //0123456789ABCDEF |
180 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
180 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
181 | JetiBox_printfxy(0,0,"Load Waypoints"); |
181 | JetiBox_printfxy(0,0,"Load Waypoints"); |
182 | JetiBox_printfxy(0,1,"(Relative) "); |
182 | JetiBox_printfxy(0,1,"(Relative) "); |
183 | #endif |
183 | #endif |
184 | } |
184 | } |
185 | 185 | ||
186 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
186 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
187 | void Menu_POINT_LD(uint8_t key) |
187 | void Menu_POINT_LD(uint8_t key) |
188 | { //0123456789ABCDEF |
188 | { //0123456789ABCDEF |
189 | JetiBox_printfxy(0,0,"Load singl.Point"); |
189 | JetiBox_printfxy(0,0,"Load singl.Point"); |
190 | // JetiBox_printfxy(0,1,"(Fixed) "); |
190 | // JetiBox_printfxy(0,1,"(Fixed) "); |
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_SV(uint8_t key) |
195 | void Menu_POINT_SV(uint8_t key) |
196 | { //0123456789ABCDEF |
196 | { //0123456789ABCDEF |
197 | JetiBox_printfxy(0,0,"Save singl.Point"); |
197 | JetiBox_printfxy(0,0,"Save singl.Point"); |
198 | // JetiBox_printfxy(0,1,"(Relative) "); |
198 | // JetiBox_printfxy(0,1,"(Relative) "); |
199 | } |
199 | } |
200 | 200 | ||
201 | void Menu_AccCal_Ask(uint8_t key) |
201 | void Menu_AccCal_Ask(uint8_t key) |
202 | { //0123456789ABCDEF |
202 | { //0123456789ABCDEF |
203 | JetiBox_printfxy(0,0,"ACC calibration"); |
203 | JetiBox_printfxy(0,0,"ACC calibration"); |
204 | // JetiBox_printfxy(0,1,"(Relative) "); |
204 | // JetiBox_printfxy(0,1,"(Relative) "); |
205 | } |
205 | } |
206 | 206 | ||
207 | void Menu_AccCal(uint8_t key) |
207 | void Menu_AccCal(uint8_t key) |
208 | { |
208 | { |
209 | static unsigned char changed = 0; |
209 | static unsigned char changed = 0; |
210 | //0123456789ABCDEF |
210 | //0123456789ABCDEF |
211 | JetiBox_printfxy(0,0,"ACC calibration"); |
211 | JetiBox_printfxy(0,0,"ACC calibration"); |
212 | 212 | ||
213 | if((FC_StatusFlags & FC_STATUS_MOTOR_RUN) && ((NC_GPS_ModeCharacter == ' ') || (NC_GPS_ModeCharacter == '/') || (NC_GPS_ModeCharacter == '-'))) |
213 | if((FC_StatusFlags & FC_STATUS_MOTOR_RUN) && ((NC_GPS_ModeCharacter == ' ') || (NC_GPS_ModeCharacter == '/') || (NC_GPS_ModeCharacter == '-'))) |
214 | { |
214 | { |
215 | if(!EE_Parameter.Driftkomp) EE_Parameter.Driftkomp = 6; // enables the Gyro-Drift compensation to make sure that a litlte calibration error won't effect the attitude |
215 | if(!EE_Parameter.Driftkomp) EE_Parameter.Driftkomp = 6; // enables the Gyro-Drift compensation to make sure that a litlte calibration error won't effect the attitude |
216 | JetiBox_printfxy(0,0,"ACC N=%3i R=%3i",NeutralAccX,NeutralAccY); |
216 | JetiBox_printfxy(0,0,"ACC N=%3i R=%3i",NeutralAccX,NeutralAccY); |
217 | if(ChannelNick || ChannelRoll) |
217 | if(ChannelNick || ChannelRoll) |
218 | JetiBox_printfxy(0,1,"Stick! (%i/%i)",ChannelNick,ChannelRoll) |
218 | JetiBox_printfxy(0,1,"Stick! (%i/%i)",ChannelNick,ChannelRoll) |
219 | else //0123456789ABCDEF |
219 | else //0123456789ABCDEF |
220 | if(changed) JetiBox_printfxy(0,1,"land to save ") |
220 | if(changed) JetiBox_printfxy(0,1,"land to save ") |
221 | else JetiBox_printfxy(0,1,"use keys now ") |
221 | else JetiBox_printfxy(0,1,"use keys now ") |
222 | 222 | ||
223 | if(key== JETIBOX_KEY_UP ) {NeutralAccX++;JetiBeep=130; changed = 1;} |
223 | if(key== JETIBOX_KEY_UP ) {NeutralAccX++;JetiBeep=130; changed = 1;} |
224 | if(key== JETIBOX_KEY_DOWN ) {NeutralAccX--;JetiBeep=130; changed = 1;} |
224 | if(key== JETIBOX_KEY_DOWN ) {NeutralAccX--;JetiBeep=130; changed = 1;} |
225 | if(key== JETIBOX_KEY_RIGHT ) {NeutralAccY++;JetiBeep=130; changed = 1;} |
225 | if(key== JETIBOX_KEY_RIGHT ) {NeutralAccY++;JetiBeep=130; changed = 1;} |
226 | if(key== JETIBOX_KEY_LEFT) {NeutralAccY--;JetiBeep=130; changed = 1;} |
226 | if(key== JETIBOX_KEY_LEFT) {NeutralAccY--;JetiBeep=130; changed = 1;} |
227 | } |
227 | } |
228 | else |
228 | else |
229 | { |
229 | { |
230 | if(!(FC_StatusFlags & FC_STATUS_MOTOR_RUN)) // motors are off |
230 | if(!(FC_StatusFlags & FC_STATUS_MOTOR_RUN)) // motors are off |
231 | { |
231 | { |
232 | if(key == JETIBOX_KEY_LEFT) { JumpToMenu = 0; changed = 0; }// Exit |
232 | if(key == JETIBOX_KEY_LEFT) { JumpToMenu = 0; changed = 0; }// Exit |
233 | 233 | ||
234 | if(changed == 0) JetiBox_printfxy(0,1,"Fly with GPS off") |
234 | if(changed == 0) JetiBox_printfxy(0,1,"Fly with GPS off") |
235 | else |
235 | else |
236 | if(changed == 1) |
236 | if(changed == 1) |
237 | { |
237 | { |
238 | JetiBox_printfxy(0,1," save -->") |
238 | JetiBox_printfxy(0,1," save -->") |
239 | if(key== JETIBOX_KEY_RIGHT) |
239 | if(key== JETIBOX_KEY_RIGHT) |
240 | { |
240 | { |
241 | StoreNeutralToEeprom(); |
241 | StoreNeutralToEeprom(); |
242 | JetiBeep = 130; |
242 | JetiBeep = 130; |
243 | changed = 2; |
243 | changed = 2; |
244 | } |
244 | } |
245 | } |
245 | } |
246 | else |
246 | else |
247 | if(changed == 2) |
247 | if(changed == 2) |
248 | { |
248 | { |
249 | JetiBox_printfxy(0,1," values stored "); |
249 | JetiBox_printfxy(0,1," values stored "); |
250 | } |
250 | } |
251 | } //0123456789ABCDEF |
251 | } //0123456789ABCDEF |
252 | else JetiBox_printfxy(0,1,"switch GPS off ") |
252 | else JetiBox_printfxy(0,1,"switch GPS off ") |
253 | } |
253 | } |
254 | // JetiBox_printfxy(0,1,"(Relative) "); |
254 | // JetiBox_printfxy(0,1,"(Relative) "); |
255 | } |
255 | } |
256 | #endif |
256 | #endif |
257 | 257 | ||
258 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
258 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
259 | void Menu_POINT_SV2(uint8_t key) |
259 | void Menu_POINT_SV2(uint8_t key) |
260 | { //0123456789ABCDEF |
260 | { //0123456789ABCDEF |
261 | static unsigned char load_waypoint_tmp = 1, changed; |
261 | static unsigned char load_waypoint_tmp = 1, changed, hyterese = 1; |
262 | 262 | ||
263 | // if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"Relative WPs ") |
263 | // if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"Relative WPs ") |
264 | // else JetiBox_printfxy(0,0,"Rel:%s",WPL_Name); |
264 | // else JetiBox_printfxy(0,0,"Rel:%s",WPL_Name); |
265 | JetiBox_printfxy(0,0,"Save Point:"); |
265 | JetiBox_printfxy(0,0,"Save Point:"); |
266 | 266 | ||
267 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
267 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
268 | else |
268 | else |
269 | if(GPSInfo.SatFix != SATFIX_3D) JetiBox_printfxy(0,1,"no GPS-Fix") |
269 | if(GPSInfo.SatFix != SATFIX_3D) JetiBox_printfxy(0,1,"no GPS-Fix") |
270 | else |
270 | else |
271 | { |
271 | { |
272 | JetiBox_printfxy(11,0,"%2d",load_waypoint_tmp); |
272 | JetiBox_printfxy(11,0,"%2d",load_waypoint_tmp); |
273 | 273 | ||
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 | JetiBox_printfxy(0,1,"Dir:%3d Alt:%3dm",CompassCorrected,(int16_t)(HoehenWert/100)) |
276 | JetiBox_printfxy(0,1,"Dir:%3d Alt:%3dm",CompassCorrected,(int16_t)(HoehenWert/100)) |
277 | 277 | ||
278 | if(changed) JetiBox_printfxy(14,0,"->") |
278 | if(changed) JetiBox_printfxy(14,0,"->") |
279 | else JetiBox_printfxy(14,0," "); |
279 | else JetiBox_printfxy(14,0," "); |
280 | 280 | ||
281 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
281 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
282 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
282 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
283 | 283 | ||
284 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
284 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
285 | { |
285 | { |
286 | ToNC_Store_SingePoint = load_waypoint_tmp; |
286 | ToNC_Store_SingePoint = load_waypoint_tmp; |
287 | changed = 0; |
287 | changed = 0; |
288 | } |
288 | } |
- | 289 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 290 | // Bedienung per Taster am Sender |
|
- | 291 | if(Parameter_UserParam5 > 120 && !hyterese) // |
|
- | 292 | { |
|
- | 293 | hyterese = 1; |
|
- | 294 | if(load_waypoint_tmp < NaviData_MaxWpListIndex) |
|
- | 295 | { |
|
- | 296 | load_waypoint_tmp++; |
|
- | 297 | ToNC_Store_SingePoint = load_waypoint_tmp; |
|
- | 298 | // SpeakHoTT = SPEAK_MIKROKOPTER; |
|
- | 299 | changed = 0; |
|
- | 300 | } |
|
- | 301 | } |
|
- | 302 | else |
|
- | 303 | if(Parameter_UserParam5 < 100) |
|
- | 304 | { |
|
- | 305 | hyterese = 0; |
|
- | 306 | } |
|
- | 307 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
289 | } |
308 | } |
290 | } |
309 | } |
291 | #endif |
310 | #endif |
292 | 311 | ||
293 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
312 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
294 | void Menu_POINT_LD2(uint8_t key) |
313 | void Menu_POINT_LD2(uint8_t key) |
295 | { //0123456789ABCDEF |
314 | { //0123456789ABCDEF |
296 | static unsigned char load_waypoint_tmp = 1, changed; |
315 | static unsigned char load_waypoint_tmp = 1, changed, hyterese = 1; |
297 | 316 | ||
298 | // if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"FIX Waypoints") |
317 | // if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"FIX Waypoints") |
299 | // else JetiBox_printfxy(0,0,"FIX:%s",WPL_Name); |
318 | // else JetiBox_printfxy(0,0,"FIX:%s",WPL_Name); |
300 | JetiBox_printfxy(0,0,"Load Point") |
319 | JetiBox_printfxy(0,0,"Load Point") |
301 | 320 | ||
302 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
321 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
303 | else |
322 | else |
304 | { |
323 | { |
305 | JetiBox_printfxy(11,0,"%2d",load_waypoint_tmp); |
324 | JetiBox_printfxy(11,0,"%2d",load_waypoint_tmp); |
306 | 325 | ||
307 | if(NaviData_WaypointNumber) JetiBox_printfxy(0,1,"Dist:%3d Alt:%3d ",NaviData_TargetDistance,(int16_t)(FromNC_AltitudeSetpoint/100)) |
326 | if(NaviData_WaypointNumber) JetiBox_printfxy(0,1,"Dist:%3d Alt:%3d ",NaviData_TargetDistance,(int16_t)(FromNC_AltitudeSetpoint/100)) |
308 | else JetiBox_printfxy(8,1," "); |
327 | else JetiBox_printfxy(8,1," "); |
309 | 328 | ||
310 | if(changed) JetiBox_printfxy(14,0,"->") |
329 | if(changed) JetiBox_printfxy(14,0,"->") |
311 | else JetiBox_printfxy(14,0," "); |
330 | else JetiBox_printfxy(14,0," "); |
312 | 331 | ||
313 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
332 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
314 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
333 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
315 | 334 | ||
316 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
335 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
317 | { |
336 | { |
318 | ToNC_Load_SingePoint = load_waypoint_tmp; |
337 | ToNC_Load_SingePoint = load_waypoint_tmp; |
319 | changed = 0; |
338 | changed = 0; |
320 | } |
339 | } |
- | 340 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
- | 341 | // Bedienung per Taster am Sender |
|
- | 342 | if(Parameter_UserParam5 > 120 && !hyterese) // |
|
- | 343 | { |
|
- | 344 | hyterese = 1; |
|
- | 345 | if(load_waypoint_tmp < NaviData_MaxWpListIndex) |
|
- | 346 | { |
|
- | 347 | load_waypoint_tmp++; |
|
- | 348 | ToNC_Load_SingePoint = load_waypoint_tmp; |
|
- | 349 | changed = 0; |
|
- | 350 | } |
|
- | 351 | } |
|
- | 352 | else |
|
- | 353 | if(Parameter_UserParam5 < 100) |
|
- | 354 | { |
|
- | 355 | hyterese = 0; |
|
- | 356 | } |
|
- | 357 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
321 | } |
358 | } |
322 | } |
359 | } |
323 | #endif |
360 | #endif |
324 | 361 | ||
325 | 362 | ||
326 | void Menu_WPL_A2(uint8_t key) |
363 | void Menu_WPL_A2(uint8_t key) |
327 | { //0123456789ABCDEF |
364 | { //0123456789ABCDEF |
328 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
365 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
329 | static unsigned char load_waypoint_tmp = 1, changed; |
366 | static unsigned char load_waypoint_tmp = 1, changed; |
330 | 367 | ||
331 | if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"FIX Waypoints") |
368 | if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"FIX Waypoints") |
332 | else JetiBox_printfxy(0,0,"FIX:%s",WPL_Name); |
369 | else JetiBox_printfxy(0,0,"FIX:%s",WPL_Name); |
333 | 370 | ||
334 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
371 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
335 | else |
372 | else |
336 | { |
373 | { |
337 | JetiBox_printfxy(0,1,"#%2d WP:",load_waypoint_tmp); |
374 | JetiBox_printfxy(0,1,"#%2d WP:",load_waypoint_tmp); |
338 | if(NaviData_WaypointNumber) JetiBox_printfxy(8,1,"%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
375 | if(NaviData_WaypointNumber) JetiBox_printfxy(8,1,"%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
339 | else JetiBox_printfxy(8,1,"--/--") |
376 | else JetiBox_printfxy(8,1,"--/--") |
340 | 377 | ||
341 | if(changed) JetiBox_printfxy(14,1,"->") |
378 | if(changed) JetiBox_printfxy(14,1,"->") |
342 | else JetiBox_printfxy(14,1," "); |
379 | else JetiBox_printfxy(14,1," "); |
343 | 380 | ||
344 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
381 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
345 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
382 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
346 | 383 | ||
347 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
384 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
348 | { |
385 | { |
349 | ToNC_Load_WP_List = load_waypoint_tmp; |
386 | ToNC_Load_WP_List = load_waypoint_tmp; |
350 | changed = 0; |
387 | changed = 0; |
351 | } |
388 | } |
352 | } |
389 | } |
353 | #endif |
390 | #endif |
354 | } |
391 | } |
355 | 392 | ||
356 | void Menu_WPL_R2(uint8_t key) |
393 | void Menu_WPL_R2(uint8_t key) |
357 | { //0123456789ABCDEF |
394 | { //0123456789ABCDEF |
358 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
395 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
359 | static unsigned char load_waypoint_tmp = 1, changed; |
396 | static unsigned char load_waypoint_tmp = 1, changed; |
360 | 397 | ||
361 | if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"Relative WPs ") |
398 | if(WPL_Name[0] == 0) JetiBox_printfxy(0,0,"Relative WPs ") |
362 | else JetiBox_printfxy(0,0,"Rel:%s",WPL_Name); |
399 | else JetiBox_printfxy(0,0,"Rel:%s",WPL_Name); |
363 | 400 | ||
364 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
401 | if(NaviData_MaxWpListIndex == 0) JetiBox_printfxy(0,1,"no SD-Card") |
365 | else |
402 | else |
366 | if(GPSInfo.SatFix != SATFIX_3D) JetiBox_printfxy(0,1,"no GPS-Fix") |
403 | if(GPSInfo.SatFix != SATFIX_3D) JetiBox_printfxy(0,1,"no GPS-Fix") |
367 | else |
404 | else |
368 | { |
405 | { |
369 | JetiBox_printfxy(0,1,"#%2d WPs:",load_waypoint_tmp); |
406 | JetiBox_printfxy(0,1,"#%2d WPs:",load_waypoint_tmp); |
370 | if(NaviData_WaypointNumber) JetiBox_printfxy(8,1,"%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
407 | if(NaviData_WaypointNumber) JetiBox_printfxy(8,1,"%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
371 | else JetiBox_printfxy(8,1,"--/--") |
408 | else JetiBox_printfxy(8,1,"--/--") |
372 | 409 | ||
373 | if(changed) JetiBox_printfxy(14,1,"->") |
410 | if(changed) JetiBox_printfxy(14,1,"->") |
374 | else JetiBox_printfxy(14,1," "); |
411 | else JetiBox_printfxy(14,1," "); |
375 | 412 | ||
376 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
413 | if(key == JETIBOX_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { load_waypoint_tmp++; changed = 1;} |
377 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
414 | if(key == JETIBOX_KEY_DOWN && load_waypoint_tmp > 1) { load_waypoint_tmp--; changed = 1; } |
378 | 415 | ||
379 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
416 | if(key == JETIBOX_KEY_RIGHT && load_waypoint_tmp) |
380 | { |
417 | { |
381 | ToNC_Load_WP_List = load_waypoint_tmp | 0x80; |
418 | ToNC_Load_WP_List = load_waypoint_tmp | 0x80; |
382 | changed = 0; |
419 | changed = 0; |
383 | } |
420 | } |
384 | } |
421 | } |
385 | #endif |
422 | #endif |
386 | } |
423 | } |
387 | 424 | ||
388 | 425 | ||
389 | 426 | ||
390 | void Menu_PosInfo(uint8_t key) |
427 | void Menu_PosInfo(uint8_t key) |
391 | { |
428 | { |
392 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
429 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
393 | if(NaviDataOkay) |
430 | if(NaviDataOkay) |
394 | { |
431 | { |
395 | JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
432 | JetiBox_printfxy(0,0,"%2um/s Sat:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
396 | switch (GPSInfo.SatFix) |
433 | switch (GPSInfo.SatFix) |
397 | { |
434 | { |
398 | case SATFIX_3D: |
435 | case SATFIX_3D: |
399 | JetiBox_printfxy(12,0," 3D"); |
436 | JetiBox_printfxy(12,0," 3D"); |
400 | break; |
437 | break; |
401 | // case SATFIX_2D: |
438 | // case SATFIX_2D: |
402 | // case SATFIX_NONE: |
439 | // case SATFIX_NONE: |
403 | default: |
440 | default: |
404 | JetiBox_printfxy(12,0,"NoFx"); |
441 | JetiBox_printfxy(12,0,"NoFx"); |
405 | break; |
442 | break; |
406 | } |
443 | } |
407 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
444 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
408 | { |
445 | { |
409 | JetiBox_printfxy(12,0,"DGPS"); |
446 | JetiBox_printfxy(12,0,"DGPS"); |
410 | } |
447 | } |
411 | JetiBox_printfxy(0,1,"Home:%3dm %3d%c %c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF,NC_GPS_ModeCharacter); |
448 | JetiBox_printfxy(0,1,"Home:%3dm %3d%c %c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, 0xDF,NC_GPS_ModeCharacter); |
412 | } |
449 | } |
413 | else |
450 | else |
414 | { //0123456789ABCDEF |
451 | { //0123456789ABCDEF |
415 | JetiBox_printfxy(2,0,"No NaviCtrl!"); |
452 | JetiBox_printfxy(2,0,"No NaviCtrl!"); |
416 | } |
453 | } |
417 | #endif |
454 | #endif |
418 | } |
455 | } |
419 | 456 | ||
420 | 457 | ||
421 | // ----------------------------------------------------------- |
458 | // ----------------------------------------------------------- |
422 | // the menu topology |
459 | // the menu topology |
423 | // ----------------------------------------------------------- |
460 | // ----------------------------------------------------------- |
424 | typedef void (*pFctMenu) (uint8_t); // the menu item handler function pointer |
461 | typedef void (*pFctMenu) (uint8_t); // the menu item handler function pointer |
425 | 462 | ||
426 | typedef struct{ |
463 | typedef struct{ |
427 | int8_t left; |
464 | int8_t left; |
428 | int8_t right; |
465 | int8_t right; |
429 | int8_t up; |
466 | int8_t up; |
430 | int8_t down; |
467 | int8_t down; |
431 | pFctMenu pHandler; |
468 | pFctMenu pHandler; |
432 | } MENU_ENTRY; |
469 | } MENU_ENTRY; |
433 | 470 | ||
434 | 471 | ||
435 | // the menu navigation structure |
472 | // the menu navigation structure |
436 | /* | |
473 | /* | |
437 | 3 - 0 - 1 - 2 - 3 - 0 |
474 | 3 - 0 - 1 - 2 - 3 - 0 |
438 | */ |
475 | */ |
439 | 476 | ||
440 | const MENU_ENTRY JetiBox_Menu[] PROGMEM= |
477 | const MENU_ENTRY JetiBox_Menu[] PROGMEM= |
441 | { // l r u d pHandler |
478 | { // l r u d pHandler |
442 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
479 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
443 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
480 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
444 | #define ACC_CAL 13 |
481 | #define ACC_CAL 13 |
445 | {8, 1, 0, 0, &Menu_Status }, // 0 |
482 | {8, 1, 0, 0, &Menu_Status }, // 0 |
446 | {0, 2, 1, 1, &Menu_Temperature }, // 1 |
483 | {0, 2, 1, 1, &Menu_Temperature }, // 1 |
447 | {1, 3, 2, 2, &Menu_Battery }, // 2 |
484 | {1, 3, 2, 2, &Menu_Battery }, // 2 |
448 | {2, 4, 3, 3, &Menu_PosInfo }, // 3 |
485 | {2, 4, 3, 3, &Menu_PosInfo }, // 3 |
449 | {3, 5, 4,10, &Menu_WPL_A1 }, // 4 |
486 | {3, 5, 4,10, &Menu_WPL_A1 }, // 4 |
450 | {4, 6, 5,11, &Menu_WPL_R1 }, // 5 |
487 | {4, 6, 5,11, &Menu_WPL_R1 }, // 5 |
451 | {5, 7, 6,12, &Menu_POINT_LD}, // 6 |
488 | {5, 7, 6,12, &Menu_POINT_LD}, // 6 |
452 | {6, 8, 7,13, &Menu_POINT_SV}, // 7 |
489 | {6, 8, 7,13, &Menu_POINT_SV}, // 7 |
453 | {7, 9, 8, 8, &Magnet_Values }, // 8 |
490 | {7, 9, 8, 8, &Magnet_Values }, // 8 |
454 | {8, 0, 9,14, &Menu_AccCal_Ask},// 9 |
491 | {8, 0, 9,14, &Menu_AccCal_Ask},// 9 |
455 | 492 | ||
456 | {4,10,10,10, &Menu_WPL_A2 }, // 10 |
493 | {4,10,10,10, &Menu_WPL_A2 }, // 10 |
457 | {5,11,11,11, &Menu_WPL_R2 }, // 11 |
494 | {5,11,11,11, &Menu_WPL_R2 }, // 11 |
458 | {6,12,12,12, &Menu_POINT_LD2}, // 12 |
495 | {6,12,12,12, &Menu_POINT_LD2}, // 12 |
459 | {7,13,13,13, &Menu_POINT_SV2}, // 13 |
496 | {7,13,13,13, &Menu_POINT_SV2}, // 13 |
460 | 497 | ||
461 | {14,14,14,14, &Menu_AccCal}, // 14 |
498 | {14,14,14,14, &Menu_AccCal}, // 14 |
462 | #else |
499 | #else |
463 | {6, 1, 0, 0, &Menu_Status }, // 0 |
500 | {6, 1, 0, 0, &Menu_Status }, // 0 |
464 | {0, 2, 1, 1, &Menu_Temperature }, // 1 |
501 | {0, 2, 1, 1, &Menu_Temperature }, // 1 |
465 | {1, 3, 2, 2, &Menu_Battery }, // 2 |
502 | {1, 3, 2, 2, &Menu_Battery }, // 2 |
466 | {2, 4, 3, 3, &Menu_PosInfo }, // 3 |
503 | {2, 4, 3, 3, &Menu_PosInfo }, // 3 |
467 | {3, 5, 7, 7, &Menu_WPL_A1 }, // 4 |
504 | {3, 5, 7, 7, &Menu_WPL_A1 }, // 4 |
468 | {4, 6, 8, 8, &Menu_WPL_R1 }, // 5 |
505 | {4, 6, 8, 8, &Menu_WPL_R1 }, // 5 |
469 | {5, 0, 6, 6, &Magnet_Values }, // 6 |
506 | {5, 0, 6, 6, &Magnet_Values }, // 6 |
470 | 507 | ||
471 | {4, 7, 7, 7, &Menu_WPL_A2 }, // 7 |
508 | {4, 7, 7, 7, &Menu_WPL_A2 }, // 7 |
472 | {5, 8, 8, 8, &Menu_WPL_R2 }, // 8 |
509 | {5, 8, 8, 8, &Menu_WPL_R2 }, // 8 |
473 | #endif |
510 | #endif |
474 | 511 | ||
475 | #endif |
512 | #endif |
476 | }; |
513 | }; |
477 | 514 | ||
478 | // ----------------------------------------------------------- |
515 | // ----------------------------------------------------------- |
479 | // Update display buffer |
516 | // Update display buffer |
480 | // ----------------------------------------------------------- |
517 | // ----------------------------------------------------------- |
481 | unsigned char JetiBox_Update(unsigned char key) |
518 | unsigned char JetiBox_Update(unsigned char key) |
482 | { |
519 | { |
483 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
520 | #if !defined (RECEIVER_SPEKTRUM_DX7EXP) && !defined (RECEIVER_SPEKTRUM_DX8EXP) |
484 | static uint8_t item = 0, last_item = 0; // the menu item |
521 | static uint8_t item = 0, last_item = 0; // the menu item |
485 | static uint8_t updateDelay = 1 , last_key; |
522 | static uint8_t updateDelay = 1 , last_key; |
486 | // navigate within the menu by key action |
523 | // navigate within the menu by key action |
487 | last_item = item; |
524 | last_item = item; |
488 | switch(key) |
525 | switch(key) |
489 | { |
526 | { |
490 | case JETIBOX_KEY_LEFT: |
527 | case JETIBOX_KEY_LEFT: |
491 | //if (item == 0) return (1); // switch back to jeti expander menu |
528 | //if (item == 0) return (1); // switch back to jeti expander menu |
492 | // else |
529 | // else |
493 | item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
530 | item = pgm_read_byte(&JetiBox_Menu[item].left); //trigger to left menu item |
494 | break; |
531 | break; |
495 | case JETIBOX_KEY_RIGHT: |
532 | case JETIBOX_KEY_RIGHT: |
496 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
533 | item = pgm_read_byte(&JetiBox_Menu[item].right); //trigger to right menu item |
497 | break; |
534 | break; |
498 | case JETIBOX_KEY_UP: |
535 | case JETIBOX_KEY_UP: |
499 | item = pgm_read_byte(&JetiBox_Menu[item].up); //trigger to up menu item |
536 | item = pgm_read_byte(&JetiBox_Menu[item].up); //trigger to up menu item |
500 | break; |
537 | break; |
501 | case JETIBOX_KEY_DOWN: |
538 | case JETIBOX_KEY_DOWN: |
502 | item = pgm_read_byte(&JetiBox_Menu[item].down); //trigger to down menu item |
539 | item = pgm_read_byte(&JetiBox_Menu[item].down); //trigger to down menu item |
503 | break; |
540 | break; |
504 | default: |
541 | default: |
505 | break; |
542 | break; |
506 | } |
543 | } |
507 | if(JumpToMenu != 0xff) { item = JumpToMenu; JumpToMenu = 0xff;}; |
544 | if(JumpToMenu != 0xff) { item = JumpToMenu; JumpToMenu = 0xff;}; |
508 | // if the menu item has been changed, do not pass the key to the item handler |
545 | // if the menu item has been changed, do not pass the key to the item handler |
509 | // to avoid jumping over to items |
546 | // to avoid jumping over to items |
510 | if(item != last_item) key = JETIBOX_KEY_UNDEF; |
547 | if(item != last_item) key = JETIBOX_KEY_UNDEF; |
511 | 548 | ||
512 | // if((updateDelay++ & 0x01) || (key != last_key)) |
549 | // if((updateDelay++ & 0x01) || (key != last_key)) |
513 | if((updateDelay++ & 0x01) || (key != JETIBOX_KEY_NONE)) |
550 | if((updateDelay++ & 0x01) || (key != JETIBOX_KEY_NONE)) |
514 | { |
551 | { |
515 | last_key = key; |
552 | last_key = key; |
516 | LIBFC_JetiBox_Clear(); |
553 | LIBFC_JetiBox_Clear(); |
517 | //execute menu item handler |
554 | //execute menu item handler |
518 | ((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key); |
555 | ((pFctMenu)(pgm_read_word(&(JetiBox_Menu[item].pHandler))))(key); |
519 | } |
556 | } |
520 | #endif |
557 | #endif |
521 | return (0); |
558 | return (0); |
522 | } |
559 | } |
523 | 560 | ||
524 | 561 |