Rev 2575 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2050 | holgerb | 1 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 | // + www.MikroKopter.com |
||
3 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
4 | // + Software Nutzungsbedingungen (english version: see below) |
||
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 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
1917 | holgerb | 53 | #include "libfc.h" |
54 | #include "printf_P.h" |
||
55 | #include "main.h" |
||
56 | #include "spi.h" |
||
57 | #include "capacity.h" |
||
58 | |||
2426 | holgerb | 59 | unsigned char NaviData_WaypointIndex = 0; |
60 | unsigned char NaviData_WaypointNumber = 0, NaviData_TargetHoldTime = 0, ToNC_Load_WP_List = 0, NaviData_MaxWpListIndex = 0; |
||
2575 | holgerb | 61 | unsigned char ToNC_Load_SingePoint = 0, ToNC_Store_SingePoint = 0, Show_Load_Time = 0, Show_Load_Value = 0, Show_Store_Time = 0, Show_Store_Value = 0; |
2426 | holgerb | 62 | char WPL_Name[10];// = {" \0"}; |
2570 | holgerb | 63 | |
1925 | holgerb | 64 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
65 | |||
1920 | holgerb | 66 | #define HoTT_printf(format, args...) { _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);} |
2527 | holgerb | 67 | #define HoTT_printfxy(x,y,format, args...) { LIBFC_HoTT_SetPos((y) * 21 + (x)); _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);} |
68 | #define HoTT_printfxy_INV(x,y,format, args...) { LIBFC_HoTT_SetPos((y) * 21 + (x)); _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);} |
||
69 | #define HoTT_printfxy_BLINK(x,y,format, args...) { LIBFC_HoTT_SetPos((y) * 21 + (x)); _printf_P(&LIBFC_HoTT_Putchar_BLINK, PSTR(format) , ## args);} |
||
1921 | holgerb | 70 | #define HoTT_printf_BLINK(format, args...) { _printf_P(&LIBFC_HoTT_Putchar_BLINK, PSTR(format) , ## args);} |
71 | #define HoTT_printf_INV(format, args...) { _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);} |
||
1917 | holgerb | 72 | |
1919 | holgerb | 73 | #define VOICE_MINIMALE_EINGANSSPANNUNG 16 |
74 | #define VOICE_BEEP 5 |
||
1920 | holgerb | 75 | #define HoTT_GRAD 96 |
76 | #define HoTT_LINKS 123 |
||
77 | #define HoTT_RECHTS 124 |
||
78 | #define HoTT_OBEN 125 |
||
79 | #define HoTT_UNTEN 126 |
||
1917 | holgerb | 80 | |
1949 | holgerb | 81 | #define HOTT_KEY_RIGHT 1 |
82 | #define HOTT_KEY_DOWN 2 |
||
83 | #define HOTT_KEY_UP 4 |
||
84 | #define HOTT_KEY_SET 6 |
||
85 | #define HOTT_KEY_LEFT 8 |
||
86 | |||
2322 | holgerb | 87 | #define VARIO_ZERO 30000 |
2178 | holgerb | 88 | unsigned int NaviData_TargetDistance = 0; |
89 | |||
2373 | holgerb | 90 | unsigned char MaxBlTemperture = 0; |
91 | unsigned char MinBlTemperture = 0; |
||
92 | unsigned char HottestBl = 0; |
||
93 | |||
1943 | holgerb | 94 | GPSPacket_t GPSPacket; |
95 | VarioPacket_t VarioPacket; |
||
96 | ASCIIPacket_t ASCIIPacket; |
||
97 | ElectricAirPacket_t ElectricAirPacket; |
||
98 | HoTTGeneral_t HoTTGeneral; |
||
2090 | holgerb | 99 | unsigned char SpeakHoTT = SPEAK_MIKROKOPTER; |
2345 | holgerb | 100 | unsigned char ToNC_SpeakHoTT = 0, ShowSettingNameTime = 0; |
1944 | holgerb | 101 | int HoTTVarioMeter = 0; |
2090 | holgerb | 102 | const char PROGMEM MIKROKOPTER[] = {" MikroKopter "}; |
2120 | holgerb | 103 | const char PROGMEM UNDERVOLTAGE[] = {" !! LiPo voltage !! "}; |
2390 | holgerb | 104 | const char PROGMEM LANDING[] = {" !! LANDING !! "}; |
2475 | holgerb | 105 | const char PROGMEM SIMULATION[] = {" SIMULATION active "}; |
106 | const char PROGMEM BOAT_MODE[] = {" MikroKopter (Boat) "}; |
||
2570 | holgerb | 107 | const char PROGMEM STORE[] = {" Store Position SP1 "}; |
108 | const char PROGMEM LOAD[] = {" Load Position SP1 "}; |
||
2344 | holgerb | 109 | const char PROGMEM SETTING[] = {"Set :"}; |
1930 | holgerb | 110 | const char PROGMEM NC_ERROR_TEXT[MAX_ERR_NUMBER][17] = |
111 | { |
||
112 | //0123456789123456 |
||
113 | "No Error \0", // 0 |
||
114 | "Not compatible \0", // 1 |
||
115 | "MK3Mag not compa\0", // 2 |
||
116 | "No FC communicat\0", // 3 |
||
2188 | holgerb | 117 | "Compass communic\0", // 4 |
1930 | holgerb | 118 | "GPS communicatio\0", // 5 |
119 | "compass value \0", // 6 |
||
120 | "RC Signal lost \0", // 7 |
||
121 | "FC spi rx error \0", // 8 |
||
122 | "No NC communicat\0", // 9 |
||
123 | "FC Nick Gyro \0", // 10 |
||
124 | "FC Roll Gyro \0", // 11 |
||
125 | "FC Yaw Gyro \0", // 12 |
||
126 | "FC Nick ACC \0", // 13 |
||
127 | "FC Roll ACC \0", // 14 |
||
128 | "FC Z-ACC \0", // 15 |
||
129 | "Pressure sensor \0", // 16 |
||
1936 | holgerb | 130 | "I2C FC->BL-Ctrl \0", // 17 |
1930 | holgerb | 131 | "Bl Missing \0", // 18 |
132 | "Mixer Error \0", // 19 |
||
1937 | holgerb | 133 | "Carefree Error \0", // 20 |
1944 | holgerb | 134 | "GPS Fix lost \0", // 21 |
1948 | holgerb | 135 | "Magnet Error \0", // 22 |
136 | "Motor restart \0", // 23 |
||
2008 | holgerb | 137 | "BL Limitation \0", // 24 |
138 | "GPS Range \0", // 25 |
||
2009 | holgerb | 139 | "No SD-Card \0", // 26 |
140 | "SD-Logging error\0", // 27 |
||
2034 | holgerb | 141 | "Flying range! \0", // 28 |
2146 | holgerb | 142 | "Max Altitude! \0", // 29 |
2186 | holgerb | 143 | "No GPS fix \0", // 30 |
2388 | holgerb | 144 | "compass not cal.\0", // 31 |
2408 | holgerb | 145 | "BL-Selftest \0", // 32 |
146 | "no ext. compass \0", // 33 |
||
2531 | holgerb | 147 | "compass sensor \0", // 34 |
148 | "Failsafe postion\0", // 35 |
||
149 | "No Redundancy! \0", // 36 |
||
2561 | holgerb | 150 | "Redundancy test \0", // 37 |
151 | "GPS Update Rate \0" // 38 |
||
152 | }; |
||
2531 | holgerb | 153 | |
1919 | holgerb | 154 | |
2090 | holgerb | 155 | const char PROGMEM HOTT_ERROR[MAX_ERR_NUMBER][2] = |
156 | { // 1 -> only in flight 0 -> also on ground |
||
157 | //0123456789123456 |
||
158 | {0,0},// "No Error \0", // 0 |
||
2531 | holgerb | 159 | {SPEAK_ERROR,0}, // "Not compatible \0", // 1 |
160 | {SPEAK_ERROR,0}, // "MK3Mag not compa\0", // 2 |
||
161 | {SPEAK_ERR_NAVI,1}, // "No FC communicat\0", // 3 |
||
162 | {SPEAK_ERR_COMPASS,1}, // "MK3Mag communica\0", // 4 |
||
163 | {SPEAK_ERR_GPS,0}, // "GPS communicatio\0", // 5 |
||
164 | {SPEAK_ERR_COMPASS,1}, // "compass value \0", // 6 |
||
165 | {SPEAK_ERR_RECEICER,0},// "RC Signal lost \0", // 7 |
||
166 | {SPEAK_ERR_NAVI,0}, // "FC spi rx error \0", // 8 |
||
167 | {SPEAK_ERR_NAVI,0}, // "No NC communicat\0", // 9 |
||
168 | {SPEAK_ERR_SENSOR,0}, // "FC Nick Gyro \0", // 10 |
||
169 | {SPEAK_ERR_SENSOR,0}, // "FC Roll Gyro \0", // 11 |
||
170 | {SPEAK_ERR_SENSOR,0}, // "FC Yaw Gyro \0", // 12 |
||
171 | {SPEAK_ERR_SENSOR,0}, // "FC Nick ACC \0", // 13 |
||
172 | {SPEAK_ERR_SENSOR,0}, // "FC Roll ACC \0", // 14 |
||
173 | {SPEAK_ERR_SENSOR,0}, // "FC Z-ACC \0", // 15 |
||
174 | {SPEAK_ERR_SENSOR,0}, // "Pressure sensor \0", // 16 |
||
175 | {SPEAK_ERR_DATABUS,1}, // "I2C FC->BL-Ctrl \0", // 17 |
||
176 | {SPEAK_ERR_DATABUS,1}, // "Bl Missing \0", // 18 |
||
177 | {SPEAK_ERROR,0}, // "Mixer Error \0", // 19 |
||
178 | {SPEAK_CF_OFF,1}, // "Carefree Error \0", // 20 |
||
179 | {SPEAK_GPS_FIX,1}, // "GPS Fix lost \0", // 21 |
||
180 | {SPEAK_ERR_COMPASS,0}, // "Magnet Error \0", // 22 |
||
181 | {SPEAK_ERR_MOTOR,1}, // "Motor restart \0", // 23 |
||
182 | {SPEAK_MAX_TEMPERAT,1},// "BL Limitation \0", // 24 |
||
183 | {SPEAK_MAX_RANGE,1}, // "GPS Range \0", // 25 |
||
184 | {SPEAK_ERROR,1}, // "No SD-Card \0", // 26 |
||
185 | {SPEAK_ERROR,1}, // "SD-Logging error\0", // 27 |
||
186 | {SPEAK_MAX_RANGE,1}, // "Flying range! \0", // 28 |
||
187 | {SPEAK_MAX_ALTITUD,1}, // "Max Altitude! \0" // 29 |
||
188 | {SPEAK_GPS_FIX,1}, // "No GPS fix \0" // 30 |
||
189 | {SPEAK_ERR_CALIBARTION,0},// "compass not cal." // 31 |
||
190 | {SPEAK_ERR_MOTOR,0}, // "BL-Selftest \0" // 32 |
||
191 | {SPEAK_ERR_COMPASS,0}, // "no ext. compass" // 33 |
||
192 | {SPEAK_ERR_COMPASS,0}, // "compass sensor" // 34 |
||
193 | {SPEAK_ERROR,1}, // "Failsafe postion0", // 35 |
||
194 | {SPEAK_ERROR,0}, // "No Redundancy!", // 36 |
||
2561 | holgerb | 195 | {0,0}, // "Redundancy test", // 37 |
196 | {SPEAK_ERR_GPS,0}, // "GPS Update Rate", // 38 |
||
2090 | holgerb | 197 | }; |
198 | |||
2527 | holgerb | 199 | /* |
200 | //------------------------------------------------------------------------------------------ |
||
201 | // HoTT-Plus |
||
202 | //------------------------------------------------------------------------------------------ |
||
203 | char dummy=0; |
||
204 | const Parameter_List_t Parameter_List[] = |
||
205 | { //offset,min,max,name,variable |
||
206 | {127, 0, 247,"SP1", (unsigned char *) &PPM_in[13] }, |
||
207 | {127, 0, 247,"SP2", (unsigned char *) &PPM_in[14] }, |
||
208 | {127, 0, 247,"SP3", (unsigned char *) &PPM_in[15] }, |
||
209 | {127, 0, 247,"SP4", (unsigned char *) &PPM_in[16] }, |
||
210 | { 0, 0, 247,"HD ", (unsigned char *) &EE_Parameter.Luftdruck_D }, |
||
211 | { 0, 0, 247,"HP ", (unsigned char *) &EE_Parameter.Hoehe_P }, |
||
212 | { 0, 0, 247,"HA ", (unsigned char *) &EE_Parameter.Hoehe_ACC_Wirkung }, |
||
213 | { 0, 0, 247,"HM ", (unsigned char *) &EE_Parameter.Hoehe_MinGas }, |
||
214 | { 0, 0, 247,"HV ", (unsigned char *) &EE_Parameter.Hoehe_HoverBand }, |
||
215 | { 0, 0, 247,"HG ", (unsigned char *) &EE_Parameter.Hoehe_Verstaerkung }, |
||
216 | { 0, 0, 247,"NG ", (unsigned char *) &EE_Parameter.NotGas }, |
||
217 | { 0, 0, 247,"StP", (unsigned char *) &EE_Parameter.Stick_P }, |
||
218 | { 0, 0, 247,"StD", (unsigned char *) &EE_Parameter.Stick_D }, |
||
219 | { 0, 0, 247,"SGP", (unsigned char *) &EE_Parameter.StickGier_P }, |
||
220 | { 0, 0, 247,"DrC", (unsigned char *) &EE_Parameter.Driftkomp }, |
||
221 | { 0, 0, 247,"GYP", (unsigned char *) &EE_Parameter.Gyro_P }, |
||
222 | { 0, 0, 247,"GYD", (unsigned char *) &EE_Parameter.Gyro_D }, |
||
223 | { 0, 0, 247,"GYI", (unsigned char *) &EE_Parameter.Gyro_I }, |
||
224 | { 0, 0, 247,"MaI", (unsigned char *) &EE_Parameter.I_Faktor }, |
||
225 | { 0, 0, 247,"GGP", (unsigned char *) &EE_Parameter.Gyro_Gier_P }, |
||
226 | { 0, 0, 247,"GGI", (unsigned char *) &EE_Parameter.Gyro_Gier_I }, |
||
227 | { 0, 0, 15,"GSt", (unsigned char *) &EE_Parameter.Gyro_Stability }, |
||
228 | { 0, 0, 247,"DSt", (unsigned char *) &EE_Parameter.DynamicStability }, |
||
229 | { 0, 0, 247,"NGG", (unsigned char *) &EE_Parameter.NaviGpsGain }, |
||
230 | { 0, 0, 247,"NWC", (unsigned char *) &EE_Parameter.NaviWindCorrection }, |
||
231 | { 0, 0, 247,"NSC", (unsigned char *) &EE_Parameter.NaviAccCompensation }, |
||
232 | { 0, 0, 247,"NAL", (unsigned char *) &EE_Parameter.NaviAngleLimitation }, |
||
233 | { 0, 0, 247,"NP ", (unsigned char *) &EE_Parameter.NaviGpsP }, |
||
234 | { 0, 0, 247,"ND ", (unsigned char *) &EE_Parameter.NaviGpsI }, |
||
235 | { 0, 0, 247,"NI ", (unsigned char *) &EE_Parameter.NaviGpsD }, |
||
236 | { 0, 0, 247,"LGL", (unsigned char *) &EE_Parameter.LoopGasLimit }, |
||
237 | { 0, 0, 247,"LHy", (unsigned char *) &EE_Parameter.LoopHysterese }, |
||
238 | { 0, 0, 247,"LTh", (unsigned char *) &EE_Parameter.LoopThreshold }, |
||
239 | { 0, 0, 0," ", (unsigned char *) &dummy }, |
||
240 | { 0, 0, 247,"FGP", (unsigned char *) &EE_Parameter.AchsKopplung1}, |
||
241 | { 0, 0, 247,"FNR", (unsigned char *) &EE_Parameter.AchsKopplung2}, |
||
242 | { 0, 0, 247,"CYC", (unsigned char *) &EE_Parameter.CouplingYawCorrection}, |
||
243 | { 0, 0, 247,"MSH", (unsigned char *) &EE_Parameter.MotorSmooth}, |
||
244 | { 0, 0, 247,"NCT", (unsigned char *) &EE_Parameter.ServoNickControl }, |
||
245 | { 0, 0, 247,"NCP", (unsigned char *) &EE_Parameter.ServoNickComp }, |
||
246 | { 0, 0, 247,"RCT", (unsigned char *) &EE_Parameter.ServoRollControl }, |
||
247 | { 0, 0, 247,"RCP", (unsigned char *) &EE_Parameter.ServoRollComp } |
||
248 | }; |
||
249 | unsigned char settingdest = 0; |
||
250 | //------------------------------------------------------------------------------------------ |
||
251 | // HoTT-Plus |
||
252 | //------------------------------------------------------------------------------------------ |
||
253 | */ |
||
1943 | holgerb | 254 | void GetHottestBl(void) |
255 | { |
||
256 | static unsigned char search = 0,tmp_max,tmp_min,who; |
||
257 | if(Motor[search].Temperature > tmp_max) { tmp_max = Motor[search].Temperature; who = search;} |
||
258 | else |
||
259 | if(Motor[search].Temperature) if(Motor[search].Temperature < tmp_min) tmp_min = Motor[search].Temperature; |
||
2373 | holgerb | 260 | if(++search >= MAX_MOTORS) |
1943 | holgerb | 261 | { |
262 | search = 0; |
||
2373 | holgerb | 263 | if(tmp_min != 255) MinBlTemperture = tmp_min; else MinBlTemperture = 0; |
264 | MaxBlTemperture = tmp_max; |
||
1943 | holgerb | 265 | HottestBl = who; |
266 | tmp_min = 255; |
||
267 | tmp_max = 0; |
||
268 | who = 0; |
||
269 | } |
||
270 | } |
||
271 | |||
1919 | holgerb | 272 | //--------------------------------------------------------------- |
1917 | holgerb | 273 | void Hott_ClearLine(unsigned char line) |
274 | { |
||
275 | HoTT_printfxy(0,line," "); |
||
276 | } |
||
1919 | holgerb | 277 | //--------------------------------------------------------------- |
1917 | holgerb | 278 | |
2178 | holgerb | 279 | |
1919 | holgerb | 280 | unsigned char HoTT_Waring(void) |
281 | { |
||
2090 | holgerb | 282 | unsigned char status = 0; |
283 | static char old_status = 0; |
||
284 | static int repeat; |
||
2531 | holgerb | 285 | //if(Parameter_UserParam1) SpeakHoTT = Parameter_UserParam1; |
2190 | holgerb | 286 | ToNC_SpeakHoTT = SpeakHoTT; |
2390 | holgerb | 287 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
288 | { |
||
289 | if(LowVoltageLandingActive && (EE_Parameter.Receiver == RECEIVER_HOTT)) status = SPEAK_LANDING; |
||
290 | else status = VOICE_MINIMALE_EINGANSSPANNUNG; // Jeti hat kein wort: "LANDEN" |
||
2408 | holgerb | 291 | if(SpeakHoTT && old_status == VOICE_MINIMALE_EINGANSSPANNUNG) status = SpeakHoTT; // das soll auch noch durch kommen |
2390 | holgerb | 292 | } |
2090 | holgerb | 293 | else |
2408 | holgerb | 294 | if(NC_ErrorCode && NC_ErrorCode < MAX_ERR_NUMBER) // Fehlercodes |
2090 | holgerb | 295 | { |
296 | if(MotorenEin || !pgm_read_byte(&HOTT_ERROR[NC_ErrorCode][1])) status = pgm_read_byte(&HOTT_ERROR[NC_ErrorCode][0]); |
||
297 | } |
||
2263 | holgerb | 298 | if(!status) // Sprachansagen |
2091 | holgerb | 299 | { |
2263 | holgerb | 300 | // if(!(GetParamByte(PID_SPEAK_HOTT_CFG) & 0x01)) SpeakHoTT = 0; // is the voice wanted? |
301 | if(!(EE_Parameter.GlobalConfig3 & CFG3_SPEAK_ALL)) SpeakHoTT = 0; // is the voice wanted? |
||
2091 | holgerb | 302 | else status = SpeakHoTT; |
2190 | holgerb | 303 | } |
304 | else ToNC_SpeakHoTT = status; |
||
2090 | holgerb | 305 | |
2390 | holgerb | 306 | if(old_status == status) // Gleichen Fehler nur alle 4 sek bringen |
2090 | holgerb | 307 | { |
308 | if(!CheckDelay(repeat)) return(0); |
||
2390 | holgerb | 309 | repeat = SetDelay(4000); |
2090 | holgerb | 310 | } |
311 | else repeat = SetDelay(2000); |
||
312 | |||
313 | if(status) |
||
314 | { |
||
315 | if(status == SpeakHoTT) SpeakHoTT = 0; |
||
316 | } |
||
317 | old_status = status; |
||
2120 | holgerb | 318 | // DebugOut.Analog[16] = status; |
2090 | holgerb | 319 | return(status); |
1919 | holgerb | 320 | } |
321 | |||
322 | //--------------------------------------------------------------- |
||
1942 | holgerb | 323 | void NC_Fills_HoTT_Telemety(void) |
1940 | holgerb | 324 | { |
2034 | holgerb | 325 | unsigned char *ptr = NULL; |
1940 | holgerb | 326 | unsigned char max = 0,i,z; |
327 | switch(FromNaviCtrl.Param.Byte[11]) |
||
328 | { |
||
329 | case HOTT_VARIO_PACKET_ID: |
||
330 | ptr = (unsigned char *) &VarioPacket; |
||
331 | max = sizeof(VarioPacket); |
||
332 | break; |
||
333 | case HOTT_GPS_PACKET_ID: |
||
334 | ptr = (unsigned char *) &GPSPacket; |
||
335 | max = sizeof(GPSPacket); |
||
336 | break; |
||
337 | case HOTT_ELECTRIC_AIR_PACKET_ID: |
||
338 | ptr = (unsigned char *) &ElectricAirPacket; |
||
339 | max = sizeof(ElectricAirPacket); |
||
340 | break; |
||
1943 | holgerb | 341 | case HOTT_GENERAL_PACKET_ID: |
342 | ptr = (unsigned char *) &HoTTGeneral; |
||
343 | max = sizeof(HoTTGeneral); |
||
344 | break; |
||
2377 | holgerb | 345 | case JETI_GPS_PACKET_ID1: |
346 | ptr = (unsigned char *) &JetiExData[14].Value; |
||
347 | max = sizeof(JetiExData[14].Value); |
||
348 | break; |
||
349 | case JETI_GPS_PACKET_ID2: |
||
350 | ptr = (unsigned char *) &JetiExData[15].Value; |
||
351 | max = sizeof(JetiExData[15].Value); |
||
352 | break; |
||
2424 | holgerb | 353 | case HOTT_WPL_NAME: |
354 | ptr = (unsigned char *) WPL_Name; |
||
355 | max = sizeof(WPL_Name)-1; |
||
356 | break; |
||
357 | |||
1940 | holgerb | 358 | } |
359 | z = FromNaviCtrl.Param.Byte[0]; // Data allocation |
||
360 | |||
361 | for(i=0; i < FromNaviCtrl.Param.Byte[1]; i++) |
||
362 | { |
||
363 | if(z >= max) break; |
||
364 | ptr[z] = FromNaviCtrl.Param.Byte[2+i]; |
||
365 | z++; |
||
366 | } |
||
367 | } |
||
368 | |||
1942 | holgerb | 369 | unsigned int BuildHoTT_Vario(void) |
370 | { |
||
2322 | holgerb | 371 | unsigned int tmp = VARIO_ZERO; |
1944 | holgerb | 372 | if(VarioCharacter == '+' || VarioCharacter == '-') |
373 | { |
||
2322 | holgerb | 374 | tmp = VARIO_ZERO + (AltitudeSetpointTrimming * EE_Parameter.Hoehe_Verstaerkung) / 3; |
375 | if(tmp < VARIO_ZERO && tmp > VARIO_ZERO - 50) tmp = VARIO_ZERO - 50; // weil es sonst erst bei < 0,5m/sek piept |
||
1944 | holgerb | 376 | } |
1942 | holgerb | 377 | else |
1944 | holgerb | 378 | if((VarioCharacter == ' ') && (FC_StatusFlags & FC_STATUS_FLY)) |
379 | { |
||
2322 | holgerb | 380 | tmp = VARIO_ZERO + HoTTVarioMeter; |
381 | if(tmp > VARIO_ZERO) |
||
1944 | holgerb | 382 | { |
2322 | holgerb | 383 | if(tmp < VARIO_ZERO + 100) tmp = VARIO_ZERO; |
1944 | holgerb | 384 | else tmp -= 100; |
385 | } |
||
2322 | holgerb | 386 | if(tmp < VARIO_ZERO) |
1944 | holgerb | 387 | { |
2322 | holgerb | 388 | if(tmp > VARIO_ZERO - 100) tmp = VARIO_ZERO; |
1944 | holgerb | 389 | else tmp += 100; |
390 | } |
||
391 | } |
||
392 | else |
||
2322 | holgerb | 393 | if(VarioCharacter == '^') tmp = VARIO_ZERO + FromNC_AltitudeSpeed * 10; |
1944 | holgerb | 394 | else |
2322 | holgerb | 395 | if(VarioCharacter == 'v') tmp = VARIO_ZERO - FromNC_AltitudeSpeed * 10; |
1942 | holgerb | 396 | return(tmp); |
397 | } |
||
398 | |||
1940 | holgerb | 399 | //--------------------------------------------------------------- |
1919 | holgerb | 400 | unsigned char HoTT_Telemety(unsigned char packet_request) |
401 | { |
||
2475 | holgerb | 402 | unsigned char i = 0; |
2531 | holgerb | 403 | static unsigned char SpeechMessage = 0; |
2090 | holgerb | 404 | //Debug("rqst: %02X",packet_request); |
2420 | holgerb | 405 | |
1919 | holgerb | 406 | switch(packet_request) |
407 | { |
||
408 | case HOTT_VARIO_PACKET_ID: |
||
2531 | holgerb | 409 | if(GPSPacket.WarnBeep == SpeechMessage) SpeechMessage = HoTT_Waring(); // Achtung: das ist richtig hier, damit der Varioton schon vorher abgestellt wird |
410 | |||
1921 | holgerb | 411 | VarioPacket.Altitude = HoehenWert/100 + 500; |
2531 | holgerb | 412 | if(!SpeechMessage) VarioPacket.m_sec = BuildHoTT_Vario(); else VarioPacket.m_sec = VARIO_ZERO; |
1943 | holgerb | 413 | VarioPacket.m_3sec = VarioPacket.m_sec; |
414 | VarioPacket.m_10sec = VarioPacket.m_sec; |
||
1919 | holgerb | 415 | if (VarioPacket.Altitude < VarioPacket.MinAltitude) VarioPacket.MinAltitude = VarioPacket.Altitude; |
416 | if (VarioPacket.Altitude > VarioPacket.MaxAltitude) VarioPacket.MaxAltitude = VarioPacket.Altitude; |
||
2090 | holgerb | 417 | VarioPacket.WarnBeep = 0;//HoTT_Waring(); |
1919 | holgerb | 418 | HoTT_DataPointer = (unsigned char *) &VarioPacket; |
2090 | holgerb | 419 | VarioPacket.FreeCharacters[0] = VarioCharacter; |
420 | if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) VarioPacket.FreeCharacters[1] = 'C'; else VarioPacket.FreeCharacters[1] = ' '; |
||
421 | // VarioPacket.FreeCharacters[2] = ' '; |
||
422 | if(NC_ErrorCode) |
||
423 | { |
||
424 | VarioPacket.Text[0] = NC_ErrorCode/10 + '0'; |
||
425 | VarioPacket.Text[1] = NC_ErrorCode%10 + '0'; |
||
426 | VarioPacket.Text[2] = ':'; |
||
2183 | holgerb | 427 | for(i=0; i<16;i++) VarioPacket.Text[i+3] = pgm_read_byte(&NC_ERROR_TEXT[NC_ErrorCode][i]); |
2388 | holgerb | 428 | VarioPacket.Text[19] = ' '; |
429 | VarioPacket.Text[20] = ' '; |
||
2090 | holgerb | 430 | } |
2120 | holgerb | 431 | else |
2390 | holgerb | 432 | if(LowVoltageLandingActive) for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&LANDING[i]); // no Error |
433 | else |
||
2120 | holgerb | 434 | if(FC_StatusFlags & FC_STATUS_LOWBAT) for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&UNDERVOLTAGE[i]); // no Error |
2348 | holgerb | 435 | else |
436 | if(ShowSettingNameTime) // no Error |
||
437 | { |
||
438 | for(i=0; i<sizeof(SETTING);i++) VarioPacket.Text[i] = pgm_read_byte(&SETTING[i]); |
||
439 | VarioPacket.Text[4] = '0' + ActiveParamSet; |
||
440 | for(i=0; i<sizeof(EE_Parameter.Name);i++) VarioPacket.Text[i+7] = EE_Parameter.Name[i]; // no Error |
||
2475 | holgerb | 441 | if(FC_StatusFlags3 & FC_STATUS3_BOAT) |
442 | { |
||
443 | VarioPacket.Text[17] = 'B'; |
||
444 | VarioPacket.Text[18] = 'O'; |
||
445 | VarioPacket.Text[19] = 'A'; |
||
446 | VarioPacket.Text[20] = 'T'; |
||
447 | } |
||
448 | else |
||
449 | { |
||
450 | VarioPacket.Text[18] = ' '; |
||
451 | VarioPacket.Text[19] = ' '; |
||
452 | VarioPacket.Text[20] = ' '; |
||
453 | } |
||
2348 | holgerb | 454 | } |
2570 | holgerb | 455 | else |
2575 | holgerb | 456 | if(Show_Store_Time) |
2570 | holgerb | 457 | { |
458 | for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&STORE[i]); // no Error and not calibrated |
||
2575 | holgerb | 459 | if(Show_Store_Value < 10) VarioPacket.Text[18] = Show_Store_Value + '0'; |
460 | else |
||
461 | { |
||
462 | VarioPacket.Text[18] = Show_Store_Value/10 + '0'; |
||
463 | VarioPacket.Text[19] = Show_Store_Value%10 + '0'; |
||
464 | } |
||
2570 | holgerb | 465 | } |
2120 | holgerb | 466 | else |
2575 | holgerb | 467 | if(Show_Load_Time) |
2570 | holgerb | 468 | { |
469 | for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&LOAD[i]); // no Error and not calibrated |
||
2575 | holgerb | 470 | if(Show_Load_Value < 10) VarioPacket.Text[17] = Show_Load_Value + '0'; |
471 | else |
||
472 | { |
||
473 | VarioPacket.Text[17] = Show_Load_Value/10 + '0'; |
||
474 | VarioPacket.Text[18] = Show_Load_Value%10 + '0'; |
||
475 | } |
||
2570 | holgerb | 476 | } |
477 | else |
||
2178 | holgerb | 478 | if(NaviData_WaypointNumber) |
479 | { |
||
480 | unsigned int tmp_int; |
||
481 | unsigned char tmp; |
||
482 | VarioPacket.Text[0] = 'W'; VarioPacket.Text[1] = 'P'; |
||
483 | VarioPacket.Text[2] = ' '; |
||
484 | VarioPacket.Text[3] = '0'+(NaviData_WaypointIndex) / 10; |
||
485 | VarioPacket.Text[4] = '0'+(NaviData_WaypointIndex) % 10; |
||
486 | VarioPacket.Text[5] = '/'; |
||
487 | VarioPacket.Text[6] = '0'+(NaviData_WaypointNumber) / 10; |
||
488 | VarioPacket.Text[7] = '0'+(NaviData_WaypointNumber) % 10; |
||
489 | VarioPacket.Text[8] = ' '; |
||
490 | tmp_int = NaviData_TargetDistance; |
||
491 | if(tmp_int > 1000) { VarioPacket.Text[9] = '0'+(tmp_int) / 1000; tmp_int %= 1000;} |
||
492 | else VarioPacket.Text[9] = ' '; |
||
493 | if(tmp_int > 100) { VarioPacket.Text[10] = '0'+(tmp_int) / 100; tmp_int %= 100;} |
||
494 | else VarioPacket.Text[10] = ' '; |
||
495 | VarioPacket.Text[11] = '0'+(tmp_int) / 10; |
||
496 | VarioPacket.Text[12] = '0'+(tmp_int) % 10; |
||
497 | VarioPacket.Text[13] = 'm'; |
||
498 | VarioPacket.Text[14] = ' '; |
||
499 | tmp = NaviData_TargetHoldTime; |
||
500 | if(tmp > 100) { VarioPacket.Text[15] = '0'+(tmp) / 100; tmp %= 100;} else VarioPacket.Text[15] = ' '; |
||
501 | VarioPacket.Text[16] = '0'+(tmp) / 10; |
||
502 | VarioPacket.Text[17] = '0'+(tmp) % 10; |
||
503 | VarioPacket.Text[18] = 's'; |
||
504 | VarioPacket.Text[19] = ' '; |
||
2407 | holgerb | 505 | VarioPacket.Text[20] = ' '; |
2178 | holgerb | 506 | } |
507 | else |
||
2475 | holgerb | 508 | if(NC_To_FC_Flags & NC_TO_FC_SIMULATION_ACTIVE) |
509 | { |
||
510 | for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&SIMULATION[i]); |
||
511 | } |
||
512 | else |
||
2355 | holgerb | 513 | if(!CalibrationDone) |
2344 | holgerb | 514 | { |
2355 | holgerb | 515 | for(i=0; i<17;i++) VarioPacket.Text[i] = pgm_read_byte(&MIKROKOPTER[i+2]); // no Error and not calibrated |
516 | VarioPacket.Text[16] = '0'+VERSION_MAJOR; |
||
517 | VarioPacket.Text[17] = '.'; |
||
518 | VarioPacket.Text[18] = '0'+VERSION_MINOR/10; |
||
519 | VarioPacket.Text[19] = '0'+VERSION_MINOR%10; |
||
520 | VarioPacket.Text[20] = 'a'+VERSION_PATCH; |
||
2344 | holgerb | 521 | } |
2355 | holgerb | 522 | else |
523 | { |
||
2475 | holgerb | 524 | if(FC_StatusFlags3 & FC_STATUS3_BOAT) for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&BOAT_MODE[i]); // no Error |
525 | else for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&MIKROKOPTER[i]); // no Error |
||
2531 | holgerb | 526 | if(FC_StatusFlags3 & FC_STATUS3_REDUNDANCE_AKTIVE) VarioPacket.Text[0] = 'R'; |
2355 | holgerb | 527 | } |
1919 | holgerb | 528 | return(sizeof(VarioPacket)); |
529 | break; |
||
1921 | holgerb | 530 | |
1919 | holgerb | 531 | case HOTT_GPS_PACKET_ID: |
2186 | holgerb | 532 | GPSPacket.Altitude = HoehenWert/100 + 500; |
1943 | holgerb | 533 | // GPSPacket.Distance = GPSInfo.HomeDistance/10; // macht die NC |
534 | // GPSPacket.Heading = GPSInfo.HomeBearing/2; // macht die NC |
||
535 | // GPSPacket.Speed = (GPSInfo.Speed * 36) / 10; // macht die NC |
||
2531 | holgerb | 536 | GPSPacket.WarnBeep = SpeechMessage; |
2322 | holgerb | 537 | if(!GPSPacket.WarnBeep) GPSPacket.m_sec = BuildHoTT_Vario(); else GPSPacket.m_sec = VARIO_ZERO; |
1921 | holgerb | 538 | GPSPacket.m_3sec = 120; |
2090 | holgerb | 539 | GPSPacket.NumOfSats = GPSInfo.NumOfSats; |
540 | if(GPSInfo.Flags & FLAG_DIFFSOLN) GPSPacket.SatFix = 'D'; |
||
541 | else |
||
542 | if(GPSInfo.SatFix == SATFIX_3D) GPSPacket.SatFix = ' '; |
||
543 | else GPSPacket.SatFix = '!'; |
||
1919 | holgerb | 544 | HoTT_DataPointer = (unsigned char *) &GPSPacket; |
2090 | holgerb | 545 | GPSPacket.FreeCharacters[0] = NC_GPS_ModeCharacter; |
546 | GPSPacket.FreeCharacters[2] = GPSPacket.SatFix; |
||
547 | GPSPacket.HomeDirection = GPSInfo.HomeBearing / 2;//230; |
||
1919 | holgerb | 548 | return(sizeof(GPSPacket)); |
549 | break; |
||
550 | case HOTT_ELECTRIC_AIR_PACKET_ID: |
||
1943 | holgerb | 551 | GetHottestBl(); |
1940 | holgerb | 552 | ElectricAirPacket.Altitude = HoehenWert/100 + 500; |
1921 | holgerb | 553 | ElectricAirPacket.Battery1 = UBat; |
1940 | holgerb | 554 | ElectricAirPacket.Battery2 = UBat; |
2437 | holgerb | 555 | ElectricAirPacket.VoltageCell1 = CompassCorrected / 2; |
1943 | holgerb | 556 | ElectricAirPacket.VoltageCell8 = ElectricAirPacket.VoltageCell1; |
1944 | holgerb | 557 | ElectricAirPacket.VoltageCell6 = GPSInfo.HomeBearing / 2; |
1943 | holgerb | 558 | ElectricAirPacket.VoltageCell7 = GPSInfo.HomeDistance/20; |
1944 | holgerb | 559 | ElectricAirPacket.VoltageCell13 = ElectricAirPacket.VoltageCell6; |
1943 | holgerb | 560 | ElectricAirPacket.VoltageCell14 = ElectricAirPacket.VoltageCell7; |
2531 | holgerb | 561 | if(!SpeechMessage) ElectricAirPacket.m_sec = BuildHoTT_Vario(); else ElectricAirPacket.m_sec = VARIO_ZERO; |
1940 | holgerb | 562 | ElectricAirPacket.m_3sec = 120; |
563 | ElectricAirPacket.InputVoltage = UBat; |
||
2373 | holgerb | 564 | ElectricAirPacket.Temperature1 = MinBlTemperture + 20; |
565 | ElectricAirPacket.Temperature2 = MaxBlTemperture + 20; |
||
1940 | holgerb | 566 | ElectricAirPacket.Capacity = Capacity.UsedCapacity/10; |
2531 | holgerb | 567 | ElectricAirPacket.WarnBeep = 0;//HoTT_Waring(); |
568 | //ElectricAirPacket.WarnBeep = SpeechMessage; |
||
1940 | holgerb | 569 | ElectricAirPacket.Current = Capacity.ActualCurrent; |
1919 | holgerb | 570 | HoTT_DataPointer = (unsigned char *) &ElectricAirPacket; |
2090 | holgerb | 571 | ElectricAirPacket.FlightTimeMinutes = FlugSekunden / 60; |
572 | ElectricAirPacket.FlightTimeSeconds = FlugSekunden % 60; |
||
1919 | holgerb | 573 | return(sizeof(ElectricAirPacket)); |
574 | break; |
||
1943 | holgerb | 575 | case HOTT_GENERAL_PACKET_ID: |
576 | GetHottestBl(); |
||
577 | HoTTGeneral.Rpm = GPSInfo.HomeDistance/100; |
||
2437 | holgerb | 578 | HoTTGeneral.VoltageCell1 = CompassCorrected / 2; |
2373 | holgerb | 579 | HoTTGeneral.VoltageCell2 = KompassValue / 2; |
580 | //HoTTGeneral.VoltageCell3 = Magnetstaerke -> macht NC |
||
581 | //HoTTGeneral.VoltageCell4 = Inclinition -> macht NC |
||
582 | HoTTGeneral.VoltageCell5 = DebugOut.Analog[28]; // I2C ErrorCounter |
||
1944 | holgerb | 583 | HoTTGeneral.VoltageCell6 = GPSInfo.HomeBearing / 2; |
2373 | holgerb | 584 | if(UBat > BattLowVoltageWarning + 2) HoTTGeneral.FuelPercent = (UBat - (BattLowVoltageWarning + 2)) * 3; |
1943 | holgerb | 585 | else HoTTGeneral.FuelPercent = 0; |
2373 | holgerb | 586 | if(HoTTGeneral.FuelPercent > 100) HoTTGeneral.FuelPercent = 100; |
587 | HoTTGeneral.FuelCapacity = NC_ErrorCode;//HoehenWert/100; // Oelpegel |
||
588 | // if(HoTTGeneral.FuelCapacity < 0) HoTTGeneral.FuelCapacity = 0; |
||
1943 | holgerb | 589 | HoTTGeneral.Altitude = HoehenWert/100 + 500; |
590 | HoTTGeneral.Battery1 = UBat; |
||
591 | HoTTGeneral.Battery2 = UBat; |
||
2531 | holgerb | 592 | if(!SpeechMessage) HoTTGeneral.m_sec = BuildHoTT_Vario(); else HoTTGeneral.m_sec = VARIO_ZERO; |
593 | HoTTGeneral.m_3sec = 120 + SpeechMessage; |
||
1943 | holgerb | 594 | HoTTGeneral.InputVoltage = UBat; |
2373 | holgerb | 595 | HoTTGeneral.Temperature1 = MinBlTemperture + 20; |
596 | HoTTGeneral.Temperature2 = MaxBlTemperture + 20; |
||
1943 | holgerb | 597 | HoTTGeneral.Capacity = Capacity.UsedCapacity/10; |
2531 | holgerb | 598 | HoTTGeneral.WarnBeep = 0; |
1943 | holgerb | 599 | HoTTGeneral.Current = Capacity.ActualCurrent; |
2178 | holgerb | 600 | //HoTTGeneral.ErrorNumber = HoTTErrorCode(); |
1943 | holgerb | 601 | HoTT_DataPointer = (unsigned char *) &HoTTGeneral; |
602 | return(sizeof(HoTTGeneral)); |
||
603 | break; |
||
1919 | holgerb | 604 | default: return(0); |
605 | } |
||
606 | } |
||
607 | |||
608 | //--------------------------------------------------------------- |
||
1917 | holgerb | 609 | void HoTT_Menu(void) |
610 | { |
||
2554 | holgerb | 611 | static unsigned char line, page = 0,show_current = 0,show_mag = 0, show_poti = 0,hyterese = 1; |
1921 | holgerb | 612 | unsigned char tmp; |
1944 | holgerb | 613 | HoTTVarioMeter = (HoTTVarioMeter * 7 + VarioMeter) / 8; |
2561 | holgerb | 614 | static int delay; |
2420 | holgerb | 615 | |
616 | // if(HottKeyboard) {beeptime = 1000;}; |
||
1944 | holgerb | 617 | |
2420 | holgerb | 618 | switch(page) |
619 | { |
||
620 | case 0: |
||
1933 | holgerb | 621 | switch(line++) |
1917 | holgerb | 622 | { |
1919 | holgerb | 623 | case 0: |
1923 | holgerb | 624 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
1939 | holgerb | 625 | HoTT_printfxy_BLINK(0,0," %2i.%1iV ",UBat/10, UBat%10) |
626 | else |
||
627 | HoTT_printfxy(0,0," %2i.%1iV ",UBat/10, UBat%10) |
||
628 | |||
629 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
||
630 | { |
||
631 | if(HoehenReglerAktiv) HoTT_printfxy_INV(10,0,"ALT:%4im %c", (int16_t)(HoehenWert/100),VarioCharacter) |
||
632 | else HoTT_printfxy(10,0,"ALT:%4im ", (int16_t)(HoehenWert/100)) |
||
633 | } |
||
634 | else HoTT_printfxy(10,0,"ALT:---- "); |
||
635 | break; |
||
636 | case 1: |
||
637 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
638 | HoTT_printfxy_BLINK(0,1," %2i:%02i ",FlugSekunden/60,FlugSekunden%60) |
||
639 | else HoTT_printfxy(0,1," %2i:%02i ",FlugSekunden/60,FlugSekunden%60); |
||
2437 | holgerb | 640 | HoTT_printfxy(10,1,"DIR: %3d%c",CompassCorrected, HoTT_GRAD); |
1949 | holgerb | 641 | if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(20,1,"C") else HoTT_printfxy(20,1," "); |
1939 | holgerb | 642 | break; |
643 | case 2: |
||
644 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
645 | HoTT_printfxy_BLINK(0,2," %5i ",Capacity.UsedCapacity) |
||
646 | else HoTT_printfxy(0,2," %5i ",Capacity.UsedCapacity); |
||
1940 | holgerb | 647 | HoTT_printfxy(12,2,"I:%2i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
1939 | holgerb | 648 | break; |
649 | case 3: |
||
2072 | holgerb | 650 | HoTT_printfxy(9,0,":"); |
651 | HoTT_printfxy(9,1,":"); |
||
652 | HoTT_printfxy(9,2,":"); |
||
1939 | holgerb | 653 | HoTT_printfxy(0,3,"---------+-----------"); |
2072 | holgerb | 654 | |
655 | // HoTT_printfxy(0,3,"---------------------"); |
||
1939 | holgerb | 656 | HoTT_printfxy(0,6,"---------------------"); |
657 | break; |
||
658 | case 4: |
||
659 | if(NaviDataOkay) |
||
660 | { |
||
2072 | holgerb | 661 | HoTT_printfxy(9,4,":"); |
1939 | holgerb | 662 | HoTT_printfxy(0,4,"SAT:%2d ",GPSInfo.NumOfSats); |
663 | HoTT_printfxy(10,4,"DIST:%3dm",GPSInfo.HomeDistance/10); |
||
664 | switch (GPSInfo.SatFix) |
||
665 | { |
||
666 | case SATFIX_3D: |
||
667 | if(GPSInfo.Flags & FLAG_DIFFSOLN) HoTT_printfxy(7,4,"D ") |
||
668 | else HoTT_printfxy(7,4,"3D"); |
||
669 | break; |
||
670 | default: |
||
1943 | holgerb | 671 | HoTT_printfxy_BLINK(7,4,"!!"); |
1939 | holgerb | 672 | break; |
673 | } |
||
674 | } |
||
675 | else |
||
1944 | holgerb | 676 | { |
1940 | holgerb | 677 | Hott_ClearLine(4); |
1939 | holgerb | 678 | } |
679 | break; |
||
680 | case 5: |
||
681 | if(NaviDataOkay) |
||
682 | { |
||
1972 | holgerb | 683 | if(show_mag) |
684 | { |
||
685 | HoTT_printfxy(0,5,"MAG:%3u%% ",EarthMagneticField); |
||
1939 | holgerb | 686 | HoTT_printfxy(12,5,"HM:%3d%c %c", GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter); |
1972 | holgerb | 687 | HoTT_printfxy(9,5,"incl:%2d%c(%2i)",EarthMagneticInclination, HoTT_GRAD,EarthMagneticInclinationTheoretic); |
688 | } |
||
689 | else |
||
690 | { |
||
2072 | holgerb | 691 | HoTT_printfxy(0,5," %2um/s: HM:%3d%c %c",GPSInfo.Speed, GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter); |
1972 | holgerb | 692 | } |
1939 | holgerb | 693 | } |
1940 | holgerb | 694 | else Hott_ClearLine(5); |
1939 | holgerb | 695 | break; |
696 | case 6: |
||
697 | break; |
||
698 | case 7: if(NC_ErrorCode) |
||
699 | { |
||
700 | if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER) |
||
701 | { |
||
702 | Hott_ClearLine(7); |
||
703 | HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode); |
||
704 | } |
||
705 | else |
||
706 | { |
||
707 | HoTT_printfxy(0,7,"ERR: "); _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);}; |
||
708 | } |
||
2120 | holgerb | 709 | else |
710 | if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy(1,7,"!! LiPo voltage !!") |
||
1939 | holgerb | 711 | else HoTT_printfxy(0,7," www.MikroKopter.de "); |
712 | break; |
||
2090 | holgerb | 713 | case 8: //ASCIIPacket.WarnBeep = HoTT_Waring(); |
1939 | holgerb | 714 | // ASCIIPacket.WarnBeep = Parameter_UserParam1; |
715 | case 9: |
||
716 | case 10: |
||
717 | case 11: |
||
718 | case 12: |
||
719 | case 13: |
||
720 | case 14: |
||
721 | case 15: |
||
722 | case 16: |
||
2440 | holgerb | 723 | if(HottKeyboard == HOTT_KEY_DOWN) { LIBFC_HoTT_Clear(); page = 5; line = 0;} |
724 | else |
||
1972 | holgerb | 725 | if(HottKeyboard == HOTT_KEY_SET) { if(show_mag) show_mag = 0; else show_mag = 1;} |
726 | else |
||
1949 | holgerb | 727 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 1; line = 0;}; |
1939 | holgerb | 728 | HottKeyboard = 0; |
729 | break; |
||
730 | default: line = 0; |
||
731 | break; |
||
732 | } |
||
2420 | holgerb | 733 | break; |
734 | case 1: |
||
1939 | holgerb | 735 | switch(line++) |
736 | { |
||
737 | case 0: |
||
738 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
1923 | holgerb | 739 | HoTT_printfxy_BLINK(0,0," %2i:%02i %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity) |
740 | else HoTT_printfxy(0,0," %2i:%02i %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity); |
||
1917 | holgerb | 741 | break; |
742 | case 1: |
||
2437 | holgerb | 743 | HoTT_printfxy(0,1,"DIR:%3d%c",CompassCorrected, HoTT_GRAD); |
1917 | holgerb | 744 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
1920 | holgerb | 745 | { |
746 | if(HoehenReglerAktiv) HoTT_printfxy_INV(10,1,"ALT:%4im", (int16_t)(HoehenWert/100)) |
||
747 | else HoTT_printfxy(10,1,"ALT:%4im", (int16_t)(HoehenWert/100)) |
||
748 | } |
||
749 | else HoTT_printfxy(10,1,"ALT:---- "); |
||
750 | HoTT_printfxy(20,1,"%c",VarioCharacter); |
||
1917 | holgerb | 751 | break; |
752 | case 2: |
||
753 | if(NaviDataOkay) |
||
754 | { |
||
1923 | holgerb | 755 | HoTT_printfxy(1,2,"HM:%3d%c DIST:%3dm %c", GPSInfo.HomeBearing, HoTT_GRAD, GPSInfo.HomeDistance/10, NC_GPS_ModeCharacter); |
1917 | holgerb | 756 | } |
757 | else |
||
758 | { |
||
1923 | holgerb | 759 | Hott_ClearLine(2); |
1917 | holgerb | 760 | } |
761 | break; |
||
1923 | holgerb | 762 | case 3: |
763 | HoTT_printfxy(0,3,"PWR:%2i.%1iA (%iW) ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10,Capacity.ActualPower); |
||
1949 | holgerb | 764 | if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(19,3,"CF") else HoTT_printfxy(19,3," "); |
1923 | holgerb | 765 | break; |
1917 | holgerb | 766 | case 4: |
767 | if(NaviDataOkay) |
||
768 | { |
||
1919 | holgerb | 769 | HoTT_printfxy(0,4,"GPS:%2um/s SAT:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
1917 | holgerb | 770 | switch (GPSInfo.SatFix) |
771 | { |
||
772 | case SATFIX_3D: |
||
773 | HoTT_printfxy(16,4," 3D "); |
||
774 | break; |
||
1925 | holgerb | 775 | //case SATFIX_2D: |
776 | //case SATFIX_NONE: |
||
1917 | holgerb | 777 | default: |
1925 | holgerb | 778 | HoTT_printfxy_BLINK(16,4,"NOFIX"); |
1917 | holgerb | 779 | break; |
780 | } |
||
781 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
||
782 | { |
||
783 | HoTT_printfxy(16,4,"DGPS "); |
||
784 | } |
||
785 | } |
||
786 | else |
||
787 | { //012345678901234567890 |
||
1930 | holgerb | 788 | HoTT_printfxy(0,4," No NaviCtrl "); |
1917 | holgerb | 789 | } |
790 | break; |
||
791 | case 5: |
||
1949 | holgerb | 792 | if(show_current) |
793 | { |
||
2386 | holgerb | 794 | // HoTT_printfxy(0,5,"%2i.%i %2i.%i %2i.%i %2i.%iA", Motor[0].Current/10,Motor[0].Current%10,Motor[1].Current/10,Motor[1].Current%10,Motor[2].Current/10,Motor[2].Current%10,Motor[3].Current/10,Motor[3].Current%10); |
795 | HoTT_printfxy(0,5,"%2i.%i %2i.%i %2i.%i %2i.%iA", BL3_Current(0)/10,BL3_Current(0)%10,BL3_Current(1)/10,BL3_Current(1)%10,BL3_Current(2)/10,BL3_Current(2)%10,BL3_Current(3)/10,BL3_Current(3)%10); |
||
1949 | holgerb | 796 | } |
797 | else |
||
798 | { |
||
799 | HoTT_printfxy(0,5,"%3i %3i %3i %3i%cC", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature,HoTT_GRAD); |
||
800 | } |
||
1917 | holgerb | 801 | break; |
802 | case 6: |
||
1949 | holgerb | 803 | if(show_current) |
804 | { |
||
1917 | holgerb | 805 | if(RequiredMotors == 4) Hott_ClearLine(6); |
806 | else |
||
2386 | holgerb | 807 | // if(RequiredMotors == 6) HoTT_printfxy(0,6,"%2i.%i %2i.%iA", Motor[4].Current/10,Motor[4].Current%10,Motor[5].Current/10,Motor[5].Current%10) |
808 | if(RequiredMotors == 6) HoTT_printfxy(0,6,"%2i.%i %2i.%iA", BL3_Current(4)/10,BL3_Current(4)%10, BL3_Current(5)/10,BL3_Current(5)%10) |
||
1949 | holgerb | 809 | else |
2386 | holgerb | 810 | // if(RequiredMotors > 6) HoTT_printfxy(0,6,"%2i.%i %2i.%i %2i.%i %2i.%iA", Motor[4].Current/10,Motor[4].Current%10,Motor[5].Current/10,Motor[5].Current%10,Motor[6].Current/10,Motor[6].Current%10,Motor[7].Current/10,Motor[7].Current%10); |
811 | if(RequiredMotors > 6) HoTT_printfxy(0,6,"%2i.%i %2i.%i %2i.%i %2i.%iA", BL3_Current(4)/10,BL3_Current(4)%10,BL3_Current(5)/10,BL3_Current(5)%10,BL3_Current(6)/10,BL3_Current(6)%10,BL3_Current(7)/10,BL3_Current(7)%10,BL3_Current(8)/10,BL3_Current(8)%10); |
||
1949 | holgerb | 812 | } |
813 | else |
||
814 | { |
||
815 | if(RequiredMotors == 4) Hott_ClearLine(6); |
||
816 | else |
||
1923 | holgerb | 817 | if(RequiredMotors == 6) HoTT_printfxy(0,6,"%3i %3i%cC ", Motor[4].Temperature, Motor[5].Temperature,HoTT_GRAD) |
1917 | holgerb | 818 | else |
1923 | holgerb | 819 | if(RequiredMotors > 6) HoTT_printfxy(0,6,"%3i %3i %3i %3i%cC", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature,HoTT_GRAD); |
1949 | holgerb | 820 | } |
1917 | holgerb | 821 | break; |
1930 | holgerb | 822 | case 7: if(NC_ErrorCode) |
823 | { |
||
824 | if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER) |
||
825 | { |
||
826 | Hott_ClearLine(7); |
||
827 | HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode); |
||
828 | } |
||
829 | else |
||
830 | { |
||
831 | HoTT_printfxy(0,7,"ERR: "); _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);}; |
||
832 | } |
||
2120 | holgerb | 833 | else |
834 | if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy(1,7,"!! LiPo voltage !!") |
||
1937 | holgerb | 835 | else HoTT_printfxy(0,7," www.MikroKopter.de "); |
1917 | holgerb | 836 | break; |
2090 | holgerb | 837 | case 8: // ASCIIPacket.WarnBeep = HoTT_Waring(); |
1919 | holgerb | 838 | // ASCIIPacket.WarnBeep = Parameter_UserParam1; |
1921 | holgerb | 839 | case 9: |
1917 | holgerb | 840 | case 10: |
841 | case 11: |
||
842 | case 12: |
||
843 | case 13: |
||
1919 | holgerb | 844 | case 14: |
845 | case 15: |
||
846 | case 16: |
||
1949 | holgerb | 847 | if(HottKeyboard == HOTT_KEY_SET) { if(show_current) show_current = 0; else show_current = 1; Hott_ClearLine(5); Hott_ClearLine(6);} |
848 | else |
||
2527 | holgerb | 849 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;} |
1949 | holgerb | 850 | else |
2527 | holgerb | 851 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;} |
1949 | holgerb | 852 | //if(HottKeyboard) HoTT_printfxy(15,6,"%KEY:%02x ",HottKeyboard); |
1921 | holgerb | 853 | HottKeyboard = 0; |
854 | break; |
||
1933 | holgerb | 855 | default: line = 0; |
1921 | holgerb | 856 | break; |
857 | } |
||
2420 | holgerb | 858 | break; |
859 | case 2: |
||
1933 | holgerb | 860 | switch(line++) |
1921 | holgerb | 861 | { |
862 | case 0: |
||
2344 | holgerb | 863 | HoTT_printfxy_INV(0,0,"Setting:%u %s ",ActiveParamSet,EE_Parameter.Name); |
1921 | holgerb | 864 | break; |
865 | case 1: HoTT_printfxy(0,1,"Min:%2i.%1iV %s ",BattLowVoltageWarning/10, BattLowVoltageWarning%10, Mixer.Name); |
||
866 | break; |
||
1923 | holgerb | 867 | case 2: HoTT_printfxy(0,2,"ALT:"); |
1921 | holgerb | 868 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
869 | { |
||
870 | if(!(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER)) HoTT_printf("POTI:%3u ", Parameter_HoehenSchalter) |
||
871 | else |
||
872 | { |
||
873 | if(Parameter_HoehenSchalter > 50) HoTT_printf("(ON) ") else HoTT_printf("(OFF) "); |
||
874 | if((Parameter_ExtraConfig & CFG2_HEIGHT_LIMIT)) HoTT_printf("LIMIT", Parameter_HoehenSchalter) |
||
875 | else HoTT_printf("VARIO", Parameter_HoehenSchalter); |
||
876 | } |
||
877 | } |
||
878 | else |
||
879 | HoTT_printf("DISABLED"); |
||
880 | break; |
||
1923 | holgerb | 881 | case 3: HoTT_printfxy(0,3,"CF:"); |
2342 | holgerb | 882 | if(!EE_Parameter.CareFreeChannel) HoTT_printf("DISABLED") |
1921 | holgerb | 883 | else |
884 | { |
||
885 | if(CareFree) HoTT_printf(" (ON) ") else HoTT_printf(" (OFF)"); |
||
886 | if(EE_Parameter.ExtraConfig & CFG_LEARNABLE_CAREFREE) HoTT_printf(" TEACH"); |
||
887 | } |
||
888 | break; |
||
1923 | holgerb | 889 | case 4: HoTT_printfxy(0,4,"GPS:"); |
890 | if(!(Parameter_GlobalConfig & CFG_GPS_AKTIV)) HoTT_printf("DISABLED") |
||
891 | else |
||
892 | { |
||
2342 | holgerb | 893 | tmp = GetChannelValue(EE_Parameter.NaviGpsModeChannel); |
1923 | holgerb | 894 | if(tmp < 50) HoTT_printf("(FREE)") |
895 | else |
||
896 | if(tmp >= 180) HoTT_printf("(HOME)") |
||
897 | else |
||
898 | if(EE_Parameter.ExtraConfig & CFG_GPS_AID) HoTT_printf("(AID) ") |
||
899 | else HoTT_printf("(HOLD)") |
||
900 | } |
||
901 | if(EE_Parameter.FailSafeTime) HoTT_printfxy(10,4," FS:%usek ",EE_Parameter.FailSafeTime) |
||
902 | |||
903 | break; |
||
904 | case 5: HoTT_printfxy(0,5,"HOME ALT:"); |
||
905 | if(EE_Parameter.ComingHomeAltitude) HoTT_printf("%um",EE_Parameter.ComingHomeAltitude) else HoTT_printf("HOLD "); |
||
906 | break; |
||
1921 | holgerb | 907 | case 6: |
1982 | holgerb | 908 | if(!show_poti) |
909 | { |
||
2496 | holgerb | 910 | HoTT_printfxy(0,6,"Ni:%4i Ro:%4i C:%3i",ChannelNick,ChannelRoll, Parameter_ServoNickControl); |
911 | HoTT_printfxy(0,7,"Gs:%4i Ya:%4i ",ChannelGas+127,ChannelYaw); |
||
1982 | holgerb | 912 | } |
913 | else |
||
914 | { |
||
915 | HoTT_printfxy(0,6,"P1:%4i P2:%4i 3:%3i",Poti1,Poti2, Poti3); |
||
916 | HoTT_printfxy(0,7,"P4:%4i P5:%4i 6:%3i",Poti4,Poti5, Poti6); |
||
917 | } |
||
918 | |||
1921 | holgerb | 919 | break; |
920 | case 7: //HoTT_printfxy(0,6,"WARNINGS:"); |
||
921 | if(HoTTBlink) |
||
922 | { |
||
923 | LIBFC_HoTT_SetPos(6 * 21); |
||
2575 | holgerb | 924 | // if(!(Parameter_GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV)) HoTT_printf_BLINK("COUPLING OFF! "); |
1921 | holgerb | 925 | if(EE_Parameter.BitConfig & (CFG_LOOP_LINKS | CFG_LOOP_RECHTS | CFG_LOOP_UNTEN | CFG_LOOP_OBEN)) HoTT_printf_BLINK("LOOPING! "); |
926 | if(Parameter_GlobalConfig & CFG_HEADING_HOLD) HoTT_printf_BLINK("HH! "); |
||
927 | if(!(Parameter_GlobalConfig & CFG_KOMPASS_AKTIV)) HoTT_printf_BLINK("COMPASS OFF! "); |
||
928 | } |
||
929 | break; |
||
2090 | holgerb | 930 | case 8: //ASCIIPacket.WarnBeep = HoTT_Waring(); |
1921 | holgerb | 931 | break; |
932 | case 9: |
||
933 | case 10: |
||
934 | case 11: |
||
935 | case 12: |
||
936 | case 13: |
||
937 | case 14: |
||
938 | case 15: |
||
939 | case 16: |
||
1982 | holgerb | 940 | if(HottKeyboard == HOTT_KEY_SET) { if(show_poti) show_poti = 0; else show_poti = 1; Hott_ClearLine(6); Hott_ClearLine(7);} |
941 | else |
||
2527 | holgerb | 942 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;} |
2418 | holgerb | 943 | else |
2527 | holgerb | 944 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;}; |
1921 | holgerb | 945 | HottKeyboard = 0; |
946 | break; |
||
1933 | holgerb | 947 | default: line = 0; |
1917 | holgerb | 948 | break; |
949 | } |
||
2420 | holgerb | 950 | break; |
951 | case 3: |
||
2418 | holgerb | 952 | switch(line++) |
953 | { |
||
2438 | holgerb | 954 | static unsigned char load_waypoint_tmp2 = 1, changed2; |
2418 | holgerb | 955 | case 0: |
956 | HoTT_printfxy(0,0,"Load Waypoints"); |
||
2420 | holgerb | 957 | HoTT_printfxy(0,1,"(Relative Positions)"); |
958 | // HoTT_printfxy(0,1,"(Absolute)"); |
||
2418 | holgerb | 959 | break; |
2420 | holgerb | 960 | case 1: |
961 | if(NaviData_WaypointNumber) HoTT_printfxy(0,6,"Active WP:%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
||
962 | else HoTT_printfxy(0,6,"No WPs active ") |
||
2418 | holgerb | 963 | break; |
964 | case 2: |
||
2420 | holgerb | 965 | HoTT_printfxy(0,7,"%2i.%1iV ",UBat/10, UBat%10) |
2424 | holgerb | 966 | HoTT_printfxy(11,7,"%s",WPL_Name) |
2420 | holgerb | 967 | case 3: |
968 | case 4: |
||
969 | case 5: |
||
970 | if(load_waypoint_tmp2) |
||
2418 | holgerb | 971 | { |
2420 | holgerb | 972 | if(changed2 && HoTTBlink) HoTT_printfxy(10,3," ") |
973 | else HoTT_printfxy(10,3,"%2i ",load_waypoint_tmp2); |
||
974 | HoTT_printfxy(0,3,"Load list:") |
||
2418 | holgerb | 975 | } |
976 | else |
||
977 | { |
||
978 | HoTT_printfxy(0,3,"Load list: -- "); |
||
979 | } |
||
2420 | holgerb | 980 | if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,4,"No SD-Card ") |
981 | else |
||
982 | { |
||
2425 | holgerb | 983 | if(GPSInfo.SatFix == SATFIX_3D) |
984 | { |
||
985 | if(changed2 && load_waypoint_tmp2) HoTT_printfxy(0,4,"(Set -> Load)") |
||
986 | else HoTT_printfxy(0,4," "); |
||
987 | if(HottKeyboard == HOTT_KEY_SET) { if(load_waypoint_tmp2) ToNC_Load_WP_List = load_waypoint_tmp2 | 128; changed2 = 0;} |
||
988 | } else HoTT_printfxy(0,4,"!No GPS-Fix! "); |
||
2420 | holgerb | 989 | } |
990 | if(HottKeyboard == HOTT_KEY_UP && load_waypoint_tmp2 < NaviData_MaxWpListIndex) { changed2 = 1; load_waypoint_tmp2++;HoTTBlink = 0;} |
||
991 | if(HottKeyboard == HOTT_KEY_DOWN && load_waypoint_tmp2 > 1) { changed2 = 1; load_waypoint_tmp2--;HoTTBlink = 0;}; |
||
2527 | holgerb | 992 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;} |
993 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;}; |
||
2418 | holgerb | 994 | HottKeyboard = 0; |
995 | break; |
||
996 | default: line = 0; |
||
997 | break; |
||
998 | } |
||
2420 | holgerb | 999 | break; |
1000 | case 4: |
||
2418 | holgerb | 1001 | switch(line++) |
1002 | { |
||
2438 | holgerb | 1003 | static unsigned char load_waypoint_tmp = 1, changed; |
2418 | holgerb | 1004 | case 0: |
1005 | HoTT_printfxy(0,0,"Load Waypoints"); |
||
2420 | holgerb | 1006 | HoTT_printfxy(0,1,"(Fixed Positions)"); |
2418 | holgerb | 1007 | break; |
2420 | holgerb | 1008 | case 1: |
1009 | if(NaviData_WaypointNumber) HoTT_printfxy(0,6,"Active WP:%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
||
1010 | else HoTT_printfxy(0,6,"No WPs active ") |
||
2418 | holgerb | 1011 | break; |
1012 | case 2: |
||
2420 | holgerb | 1013 | HoTT_printfxy(0,7,"%2i.%1iV ",UBat/10, UBat%10) |
2424 | holgerb | 1014 | HoTT_printfxy(11,7,"%s",WPL_Name) |
2420 | holgerb | 1015 | case 3: |
1016 | case 4: |
||
1017 | case 5: |
||
2438 | holgerb | 1018 | HoTT_printfxy(0,3,"Load list:") |
2420 | holgerb | 1019 | if(load_waypoint_tmp) |
2418 | holgerb | 1020 | { |
2420 | holgerb | 1021 | if(changed && HoTTBlink) HoTT_printfxy(10,3," ") |
1022 | else HoTT_printfxy(10,3,"%2d (FIX)",load_waypoint_tmp); |
||
2418 | holgerb | 1023 | } |
1024 | else |
||
1025 | { |
||
2438 | holgerb | 1026 | HoTT_printfxy(10,3," --") |
2418 | holgerb | 1027 | } |
2420 | holgerb | 1028 | |
1029 | if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,4,"No SD-Card ") |
||
1030 | else |
||
1031 | { |
||
2425 | holgerb | 1032 | if(changed && load_waypoint_tmp) HoTT_printfxy(0,4,"(Set -> Load)") |
1033 | else HoTT_printfxy(0,4," "); |
||
1034 | } |
||
2420 | holgerb | 1035 | if(HottKeyboard == HOTT_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { changed = 1; load_waypoint_tmp++; HoTTBlink = 0;} |
1036 | if(HottKeyboard == HOTT_KEY_DOWN && load_waypoint_tmp > 1) { changed = 1; load_waypoint_tmp--; HoTTBlink = 0;}; |
||
1037 | if(HottKeyboard == HOTT_KEY_SET) { if(load_waypoint_tmp) ToNC_Load_WP_List = load_waypoint_tmp; changed = 0;} |
||
2438 | holgerb | 1038 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;} |
1039 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;}; |
||
2418 | holgerb | 1040 | HottKeyboard = 0; |
1041 | break; |
||
1042 | default: line = 0; |
||
1043 | break; |
||
1044 | } |
||
2420 | holgerb | 1045 | break; |
2438 | holgerb | 1046 | case 5: |
1047 | switch(line++) |
||
1048 | { |
||
1049 | static unsigned char wp_tmp, changed; |
||
1050 | case 0: |
||
1051 | HoTT_printfxy(0,0,"Store single Position"); |
||
1052 | // HoTT_printfxy(0,1,"(Fixed Positions)"); |
||
1053 | break; |
||
1054 | case 1: |
||
1055 | HoTT_printfxy(0,2," %2i.%1iV ",UBat/10, UBat%10) |
||
1056 | HoTT_printfxy(0,3," %2i:%02i ",FlugSekunden/60,FlugSekunden%60); |
||
1057 | // HoTT_printfxy(0,4,"Dist:%3dm",NaviData_TargetDistance) |
||
1058 | break; |
||
1059 | case 2: |
||
1060 | HoTT_printfxy(11,2,"ALT:%4im", (int16_t)(HoehenWert/100)) |
||
1061 | HoTT_printfxy(11,3,"DIR: %3d%c",CompassCorrected, HoTT_GRAD); |
||
1062 | HoTT_printfxy(11,4,"Cam: %3i",Parameter_ServoNickControl); |
||
1063 | break; |
||
1064 | case 3: |
||
1065 | case 4: |
||
1066 | case 5: |
||
1067 | HoTT_printfxy(0,6,"Store point:") |
||
1068 | if(wp_tmp) |
||
1069 | { |
||
1070 | if(changed && HoTTBlink) HoTT_printfxy(13,6," ") |
||
1071 | else HoTT_printfxy(13,6,"%2d ",wp_tmp); |
||
1072 | } |
||
1073 | else |
||
1074 | { |
||
2439 | holgerb | 1075 | HoTT_printfxy(13,6,"--") |
2438 | holgerb | 1076 | } |
2439 | holgerb | 1077 | |
1078 | if(GPSInfo.SatFix == SATFIX_3D) |
||
1079 | { |
||
2438 | holgerb | 1080 | if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,7,"No SD-Card ") |
1081 | else |
||
1082 | { |
||
1083 | if(changed && wp_tmp) HoTT_printfxy(0,7,"(Set -> Store)") |
||
1084 | else Hott_ClearLine(7); |
||
1085 | } |
||
2439 | holgerb | 1086 | if(HottKeyboard == HOTT_KEY_SET) { if(wp_tmp) ToNC_Store_SingePoint = wp_tmp; changed = 0;} |
1087 | } |
||
1088 | else HoTT_printfxy(0,7,"!No GPS-Fix! "); |
||
1089 | |||
2438 | holgerb | 1090 | if(HottKeyboard == HOTT_KEY_UP && wp_tmp < NaviData_MaxWpListIndex) { changed = 1; wp_tmp++; HoTTBlink = 0;} |
1091 | if(HottKeyboard == HOTT_KEY_DOWN && wp_tmp > 1) { changed = 1; wp_tmp--; HoTTBlink = 0;}; |
||
1092 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;} |
||
1093 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;}; |
||
1094 | HottKeyboard = 0; |
||
2554 | holgerb | 1095 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1096 | // Bedienung per Taster am Sender |
||
2575 | holgerb | 1097 | if(PPM_in[EE_Parameter.MenuKeyChannel] > 50) // |
2554 | holgerb | 1098 | { |
2561 | holgerb | 1099 | hyterese = 2; |
1100 | if(CheckDelay(delay)) { wp_tmp = 0; hyterese = 1;} |
||
1101 | } |
||
1102 | else |
||
2575 | holgerb | 1103 | if(PPM_in[EE_Parameter.MenuKeyChannel] < -50) |
2561 | holgerb | 1104 | { |
1105 | delay = SetDelay(2500); |
||
1106 | if(hyterese == 2 && (wp_tmp < NaviData_MaxWpListIndex)) |
||
2554 | holgerb | 1107 | { |
1108 | wp_tmp++; |
||
1109 | ToNC_Store_SingePoint = wp_tmp; |
||
1110 | changed = 0; |
||
1111 | } |
||
1112 | hyterese = 0; |
||
1113 | } |
||
1114 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
2438 | holgerb | 1115 | break; |
1116 | default: line = 0; |
||
1117 | break; |
||
1118 | } |
||
1119 | break; |
||
1120 | case 6: |
||
1121 | switch(line++) |
||
1122 | { |
||
1123 | static unsigned char wp_tmp, changed; |
||
1124 | case 0: |
||
1125 | HoTT_printfxy(0,0,"Load single Position"); |
||
1126 | // HoTT_printfxy(0,1,"(Fixed Positions)"); |
||
1127 | break; |
||
1128 | case 1: |
||
1129 | HoTT_printfxy(0,2," %2i.%1iV ",UBat/10, UBat%10) |
||
1130 | HoTT_printfxy(0,3," %2i:%02i ",FlugSekunden/60,FlugSekunden%60); |
||
1131 | // HoTT_printfxy(0,4,"Dist:%3dm",NaviData_TargetDistance) |
||
2439 | holgerb | 1132 | if(NaviData_WaypointNumber) HoTT_printfxy(0,5,"WP:%2d/%d Dist:%3dm ",NaviData_WaypointIndex,NaviData_WaypointNumber,NaviData_TargetDistance) |
2438 | holgerb | 1133 | else Hott_ClearLine(5); |
1134 | break; |
||
1135 | case 2: |
||
2439 | holgerb | 1136 | if(FromNC_AltitudeSpeed) |
1137 | HoTT_printfxy(8,2,"ALT:%4i/%im ", (int16_t)(HoehenWert/100),(int16_t)(FromNC_AltitudeSetpoint/100)) |
||
1138 | else |
||
1139 | HoTT_printfxy(8,2,"ALT:%4im ",(int16_t)(HoehenWert/100)) |
||
1140 | |||
1141 | HoTT_printfxy(8,3,"DIR: %3d%c",CompassCorrected, HoTT_GRAD); |
||
1142 | HoTT_printfxy(8,4,"Cam: %3i",Parameter_ServoNickControl); |
||
2438 | holgerb | 1143 | break; |
1144 | // HoTT_printfxy(11,7,"%s",WPL_Name) |
||
1145 | case 3: |
||
2440 | holgerb | 1146 | case 4: |
2438 | holgerb | 1147 | case 5: |
1148 | if(HottKeyboard) DebugOut.Analog[17]++; |
||
1149 | HoTT_printfxy(0,6,"load point:") |
||
1150 | if(wp_tmp) |
||
1151 | { |
||
1152 | if(changed && HoTTBlink) HoTT_printfxy(11,6," ") |
||
1153 | else HoTT_printfxy(11,6,"%2d",wp_tmp); |
||
1154 | } |
||
1155 | else |
||
1156 | { |
||
2440 | holgerb | 1157 | HoTT_printfxy(11,6,"--") |
2438 | holgerb | 1158 | } |
1159 | |||
1160 | if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,7,"No SD-Card ") |
||
1161 | else |
||
1162 | { |
||
1163 | if(changed && wp_tmp) HoTT_printfxy(0,7,"(Set -> Load)") |
||
2439 | holgerb | 1164 | else |
1165 | { |
||
1166 | Hott_ClearLine(7); |
||
1167 | if(NaviData_WaypointNumber) HoTT_printfxy(0,7,"%s",WPL_Name); |
||
1168 | } |
||
2438 | holgerb | 1169 | } |
1170 | if(HottKeyboard == HOTT_KEY_UP && wp_tmp < NaviData_MaxWpListIndex) { changed = 1; wp_tmp++; HoTTBlink = 0;} |
||
1171 | if(HottKeyboard == HOTT_KEY_DOWN && wp_tmp > 1) { changed = 1; wp_tmp--; HoTTBlink = 0;}; |
||
1172 | if(HottKeyboard == HOTT_KEY_SET) { if(wp_tmp) ToNC_Load_SingePoint = wp_tmp; changed = 0;} |
||
2527 | holgerb | 1173 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;} |
2438 | holgerb | 1174 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;}; |
1175 | HottKeyboard = 0; |
||
2554 | holgerb | 1176 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1177 | // Bedienung per Taster am Sender |
||
2575 | holgerb | 1178 | if(PPM_in[EE_Parameter.MenuKeyChannel] > 50) // |
2554 | holgerb | 1179 | { |
2561 | holgerb | 1180 | hyterese = 2; |
1181 | if(CheckDelay(delay)) { wp_tmp = 0; hyterese = 1;} |
||
1182 | } |
||
1183 | else |
||
2575 | holgerb | 1184 | if(PPM_in[EE_Parameter.MenuKeyChannel] < -50) |
2561 | holgerb | 1185 | { |
1186 | delay = SetDelay(2500); |
||
1187 | if(hyterese == 2 && (wp_tmp < NaviData_MaxWpListIndex)) |
||
2554 | holgerb | 1188 | { |
1189 | wp_tmp++; |
||
1190 | ToNC_Load_SingePoint = wp_tmp; |
||
1191 | changed = 0; |
||
1192 | } |
||
1193 | hyterese = 0; |
||
1194 | } |
||
1195 | // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
2438 | holgerb | 1196 | break; |
1197 | default: line = 0; |
||
1198 | break; |
||
1199 | } |
||
1200 | break; |
||
2527 | holgerb | 1201 | case 7: |
1202 | switch(line++) |
||
1203 | { |
||
1204 | static unsigned char i=0,test=0,set=0; |
||
1205 | |||
1206 | case 0: HoTT_printfxy(0,0,"Motortest / Setpoints");break; |
||
1207 | case 1: //HoTT_printfxy(0,1,"Motor Setpoint Strom "); |
||
1208 | case 2: |
||
1209 | case 3: |
||
1210 | case 4: i=((line-2)*2)+1; |
||
1211 | if(MotorenEin) |
||
1212 | { |
||
1213 | HoTT_printfxy(0,line,"M%i=%2i%2i.%iA M%i=%2i%2i.%iA",i,Motor[i-1].SetPoint,Motor[i-1].Current/10,Motor[i-1].Current%10,i+1,Motor[i].SetPoint,Motor[i].Current/10,Motor[i].Current%10); |
||
1214 | } |
||
1215 | else |
||
1216 | { |
||
1217 | HoTT_printfxy(0,line,"M%i=%2i%2i.%iA M%i=%2i%2i.%iA",i,MotorTest[i-1],Motor[i-1].Current/10,Motor[i-1].Current%10,i+1,MotorTest[i],Motor[i].Current/10,Motor[i].Current%10); |
||
1218 | } |
||
1219 | break; |
||
1220 | case 5: if(test) |
||
1221 | { |
||
1222 | HoTT_printfxy(0,6,"!!!Motortest Aktiv!!!"); |
||
1223 | } |
||
1224 | case 6: if(test) |
||
1225 | { |
||
1226 | PC_MotortestActive = 254; |
||
1227 | HoTT_printfxy(0,7,"Motor %i",test); |
||
1228 | MotorTest[test-1]=set; |
||
1229 | } |
||
1230 | case 7: |
||
1231 | case 8: |
||
1232 | case 9: |
||
1233 | case 10: |
||
1234 | case 11: |
||
1235 | case 12: |
||
1236 | case 13: |
||
1237 | case 14: |
||
1238 | case 15: |
||
1239 | case 16: |
||
1240 | if(HottKeyboard == HOTT_KEY_RIGHT) |
||
1241 | { |
||
1242 | if(test) |
||
1243 | { |
||
1244 | set=0; |
||
1245 | MotorTest[test-1]=set; |
||
1246 | if(test<8) test++; |
||
1247 | } |
||
1248 | else |
||
1249 | { |
||
1250 | LIBFC_HoTT_Clear(); |
||
1251 | page--; |
||
1252 | line=0; |
||
1253 | } |
||
1254 | } |
||
1255 | else |
||
1256 | if(HottKeyboard == HOTT_KEY_LEFT) |
||
1257 | { |
||
1258 | if(test) |
||
1259 | { |
||
1260 | set=0; |
||
1261 | MotorTest[test-1]=set; |
||
1262 | if(test>1) test--; |
||
1263 | } |
||
1264 | else |
||
1265 | { |
||
1266 | LIBFC_HoTT_Clear(); |
||
1267 | page++; |
||
1268 | line = 0; |
||
1269 | } |
||
1270 | } |
||
1271 | else |
||
1272 | if((HottKeyboard == HOTT_KEY_UP) && (set <98 ) && test) set+=2;//GESCHW |
||
1273 | else |
||
1274 | if((HottKeyboard == HOTT_KEY_DOWN) && (set >0 ) && test) set-=2; |
||
1275 | else |
||
1276 | if((HottKeyboard == HOTT_KEY_SET) && !MotorenEin) |
||
1277 | { |
||
1278 | if(test) test = 0; else test = 1; |
||
1279 | set=0; |
||
1280 | Hott_ClearLine(6); Hott_ClearLine(7); |
||
1281 | } |
||
1282 | HottKeyboard = 0; |
||
1283 | break; |
||
1284 | default: line = 0; |
||
1285 | break; |
||
1286 | //HoTT_printfxy(10 ,line,"I"); |
||
1287 | //line++; |
||
1288 | } |
||
1289 | break; |
||
1290 | case 8: |
||
1291 | switch(line++) |
||
1292 | { |
||
1293 | #define MD_OFF 1 |
||
1294 | #define MD_CAL 2 |
||
1295 | #define MD_SAV 3 |
||
1296 | static unsigned char mode=MD_OFF,cursor=MD_OFF; |
||
1297 | |||
1298 | case 0: HoTT_printfxy(0,0,"ACC calibration");break; |
||
2537 | holgerb | 1299 | case 1: HoTT_printfxy(0,2,"ACC: N:%3i R:%3i ",NeutralAccX,NeutralAccY); |
1300 | case 2: HoTT_printfxy(0,3,"Stick: (%i/%i) ",ChannelNick,ChannelRoll); |
||
1301 | case 3: if(ChannelNick || ChannelRoll) HoTT_printfxy(7,3,"!!"); |
||
1302 | break; |
||
2527 | holgerb | 1303 | case 4: HoTT_printfxy(2,4,"Off");break; |
1304 | case 5: HoTT_printfxy(2,5,"Calibrate");break; |
||
2537 | holgerb | 1305 | case 6: HoTT_printfxy(2,6,"Save "); |
1306 | if(mode == MD_SAV && cursor == MD_SAV) |
||
1307 | { |
||
1308 | HoTT_printfxy(7,6,"(SET)"); |
||
1309 | } |
||
1310 | else if((mode == MD_CAL) && !((NC_GPS_ModeCharacter == ' ') || (NC_GPS_ModeCharacter == '/') || (NC_GPS_ModeCharacter == '-'))) |
||
1311 | { |
||
1312 | HoTT_printfxy(2,6,"Swich GPS off!"); |
||
1313 | } |
||
2527 | holgerb | 1314 | break; |
1315 | case 7: |
||
1316 | case 8: HoTT_printfxy(0,cursor+3,">");break; |
||
1317 | case 9: HoTT_printfxy(1,mode+3,"*");break; |
||
1318 | case 10: |
||
1319 | case 11: |
||
1320 | case 12: |
||
1321 | case 13: |
||
1322 | case 14: |
||
1323 | case 15: |
||
1324 | case 16: |
||
1325 | if(HottKeyboard == HOTT_KEY_RIGHT) |
||
1326 | { |
||
1327 | switch(mode) |
||
1328 | { |
||
1329 | case MD_OFF: LIBFC_HoTT_Clear(); |
||
1330 | page--; // leave menu |
||
1331 | line = 0; |
||
1332 | break; |
||
1333 | case MD_CAL: NeutralAccY++; |
||
1334 | break; |
||
1335 | case MD_SAV: break; |
||
1336 | default: mode=MD_OFF;break; |
||
1337 | } |
||
1338 | } |
||
1339 | else |
||
1340 | if(HottKeyboard == HOTT_KEY_LEFT) |
||
1341 | { |
||
1342 | switch(mode) |
||
1343 | { |
||
1344 | case MD_OFF: LIBFC_HoTT_Clear(); |
||
1345 | page++; // leave menu |
||
1346 | line = 0; |
||
1347 | break; |
||
1348 | case MD_CAL: NeutralAccY--; |
||
1349 | break; |
||
1350 | case MD_SAV: break; |
||
1351 | default: mode=MD_OFF; |
||
1352 | break; |
||
1353 | } |
||
1354 | } |
||
1355 | else |
||
1356 | if(HottKeyboard == HOTT_KEY_UP) |
||
1357 | { |
||
1358 | switch(mode) |
||
1359 | { |
||
1360 | case MD_CAL: NeutralAccX++; |
||
1361 | break; |
||
1362 | case MD_OFF: |
||
1363 | case MD_SAV: if(cursor>1) {HoTT_printfxy(0,cursor+3," ");cursor--;} |
||
1364 | HoTT_printfxy(2,6," "); |
||
1365 | break; |
||
1366 | default: mode=MD_OFF; |
||
1367 | break; |
||
1368 | } |
||
1369 | } |
||
1370 | else |
||
1371 | if(HottKeyboard == HOTT_KEY_DOWN) |
||
1372 | { |
||
1373 | switch(mode) |
||
1374 | { |
||
1375 | case MD_CAL: NeutralAccX--; |
||
1376 | break; |
||
1377 | case MD_SAV: |
||
1378 | case MD_OFF: if(cursor<MD_SAV) {HoTT_printfxy(0,cursor+3," ");cursor++;} |
||
1379 | break; |
||
1380 | default: mode=MD_OFF; |
||
1381 | break; |
||
1382 | } |
||
1383 | } |
||
1384 | else |
||
1385 | if(HottKeyboard == HOTT_KEY_SET) |
||
1386 | { |
||
1387 | switch(mode) |
||
1388 | { |
||
1389 | case MD_OFF: HoTT_printfxy(1,mode+3," "); |
||
1390 | mode = cursor; |
||
1391 | if(mode == MD_CAL && !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 |
||
1392 | break; |
||
1393 | case MD_CAL: HoTT_printfxy(1,mode+3," "); |
||
1394 | mode = MD_OFF; |
||
1395 | break; |
||
1396 | case MD_SAV: |
||
1397 | Hott_ClearLine(7); |
||
1398 | if(cursor == MD_SAV) |
||
1399 | { |
||
1400 | if(!MotorenEin) |
||
1401 | { |
||
2537 | holgerb | 1402 | /* BoatNeutralNick = AdNeutralNick; |
1403 | BoatNeutralRoll = AdNeutralRoll; |
||
1404 | BoatNeutralGier = AdNeutralGier; |
||
2527 | holgerb | 1405 | SetParamWord(PID_ACC_NICK, (uint16_t)NeutralAccX); |
1406 | SetParamWord(PID_ACC_ROLL, (uint16_t)NeutralAccY); |
||
1407 | SetParamWord(PID_GYRO_NICK,(uint16_t)BoatNeutralNick); |
||
1408 | SetParamWord(PID_GYRO_ROLL,(uint16_t)BoatNeutralRoll); |
||
1409 | SetParamWord(PID_GYRO_YAW,(uint16_t)BoatNeutralGier); |
||
2537 | holgerb | 1410 | */ |
1411 | StoreNeutralToEeprom(); |
||
2527 | holgerb | 1412 | HoTT_printfxy(7,6," okay "); |
1413 | HoTT_printfxy(1,mode+3," "); |
||
1414 | mode = MD_OFF; |
||
1415 | } |
||
1416 | else |
||
1417 | { |
||
1418 | HoTT_printfxy(0,7,"Motors running!!!"); |
||
1419 | mode = MD_OFF; |
||
1420 | } |
||
1421 | } |
||
1422 | else |
||
1423 | { |
||
1424 | HoTT_printfxy(1,mode+3," "); |
||
1425 | mode=cursor; |
||
1426 | } |
||
1427 | break; |
||
1428 | default: mode=MD_OFF; |
||
1429 | break; |
||
1430 | } |
||
1431 | } |
||
1432 | HottKeyboard = 0; |
||
1433 | break; |
||
1434 | default: line = 0; |
||
1435 | break; |
||
1436 | //HoTT_printfxy(10 ,line,"I"); |
||
1437 | //line++; |
||
1438 | } |
||
1439 | break; |
||
1440 | /* |
||
1441 | //------------------------------------------------------------------------------------------ |
||
1442 | // HoTT-Plus |
||
1443 | //------------------------------------------------------------------------------------------ |
||
1444 | case 9: |
||
1445 | switch(line++) |
||
1446 | { |
||
1447 | case 0: HoTT_printfxy(0,0,"I2C Schwerpunkt GAS"); |
||
1448 | break; |
||
1449 | case 1: HoTT_printfxy(0,1,"I2C%3i%3i%3i%3i",Motor[0].State & MOTOR_STATE_ERROR_MASK,Motor[1].State & MOTOR_STATE_ERROR_MASK, Motor[2].State & MOTOR_STATE_ERROR_MASK, Motor[3].State & MOTOR_STATE_ERROR_MASK); |
||
1450 | break; |
||
1451 | case 2: HoTT_printfxy(0,2," %3i%3i%3i%3i",Motor[4].State & MOTOR_STATE_ERROR_MASK,Motor[5].State & MOTOR_STATE_ERROR_MASK, Motor[6].State & MOTOR_STATE_ERROR_MASK, Motor[7].State & MOTOR_STATE_ERROR_MASK); |
||
1452 | break; |
||
1453 | |||
1454 | case 3: { //0123456789ABCDEF |
||
1455 | int r=0; |
||
1456 | int n=0; |
||
1457 | int g=0; |
||
1458 | n=SummeNick >> 9; |
||
1459 | r=SummeRoll >> 9; |
||
1460 | g=Mess_Integral_Gier >> 9; |
||
1461 | |||
1462 | HoTT_printfxy(0,5,"%3iN %3iR %3iG",n ,r ,g); |
||
1463 | } |
||
1464 | |||
1465 | break; |
||
1466 | case 4: { //0123456789ABCDEF |
||
1467 | HoTT_printfxy(0,4,"+ ^ + <"); |
||
1468 | } |
||
1469 | break; |
||
1470 | case 5: { //0123456789ABCDEF |
||
1471 | HoTT_printfxy(0,6,"- v - >"); |
||
1472 | } |
||
1473 | break; |
||
1474 | case 6: HoTT_printfxy(0,7,"%3i=HG/4 %3i=Gas",HoverGas/4,StickGas); |
||
1475 | |||
1476 | break; |
||
1477 | case 7: |
||
1478 | case 8: |
||
1479 | case 9: |
||
1480 | case 10: |
||
1481 | case 11: |
||
1482 | case 12: |
||
1483 | case 13: |
||
1484 | case 14: |
||
1485 | case 15: |
||
1486 | case 16: |
||
1487 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;} |
||
1488 | else |
||
1489 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;} |
||
1490 | HottKeyboard = 0; |
||
1491 | break; |
||
1492 | default: line = 0; |
||
1493 | break; |
||
1494 | } |
||
1495 | break; |
||
1496 | //--------------------------------------------------------------------------------------------------- |
||
1497 | case 10: |
||
1498 | { |
||
1499 | static signed char i=0,j=0,Changepos=0; |
||
1500 | |||
1501 | if(line==9) |
||
1502 | { |
||
1503 | line=0; |
||
1504 | if(HottKeyboard == HOTT_KEY_SET ) { if(Changepos) Changepos = 0; else Changepos = 1;} |
||
1505 | else |
||
1506 | if(Changepos) |
||
1507 | { |
||
1508 | unsigned char temp=0; |
||
1509 | temp=(Changepos+j)-1; |
||
1510 | if((HottKeyboard == HOTT_KEY_RIGHT) && !((unsigned char)(*Parameter_List[temp].Variable + Parameter_List[temp].offset) >= Parameter_List[temp].max )) {*Parameter_List[temp].Variable += 1;} |
||
1511 | else |
||
1512 | if((HottKeyboard == HOTT_KEY_LEFT) && !((unsigned char)(*Parameter_List[temp].Variable + Parameter_List[temp].offset) <= Parameter_List[temp].min )) {*Parameter_List[temp].Variable -= 1;} |
||
1513 | else |
||
1514 | if(HottKeyboard == HOTT_KEY_UP ) |
||
1515 | { |
||
1516 | Changepos--; |
||
1517 | line = Changepos/2; |
||
1518 | if(Changepos< 1 ) {Changepos=16;} |
||
1519 | } |
||
1520 | else |
||
1521 | if(HottKeyboard == HOTT_KEY_DOWN) |
||
1522 | { |
||
1523 | Changepos++; |
||
1524 | line = Changepos/2; |
||
1525 | if(Changepos >= 17 ) {Changepos=1;} |
||
1526 | } |
||
1527 | } |
||
1528 | else |
||
1529 | { |
||
1530 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;} |
||
1531 | else |
||
1532 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;} |
||
1533 | else |
||
1534 | if(HottKeyboard == HOTT_KEY_UP ) |
||
1535 | { |
||
1536 | j-=16; |
||
1537 | line = 0; |
||
1538 | if(j< 0 ) {j=0;} |
||
1539 | } |
||
1540 | else |
||
1541 | if(HottKeyboard == HOTT_KEY_DOWN) |
||
1542 | { |
||
1543 | LIBFC_HoTT_Clear(); |
||
1544 | j+=16; |
||
1545 | line = 0; |
||
1546 | if(j+14> MAXPARAM ) {j=MAXPARAM-15;} |
||
1547 | } |
||
1548 | } |
||
1549 | |||
1550 | Debug("line=%i Changepos=%i j=%i Key=%i",line,Changepos,j,HottKeyboard); |
||
1551 | HottKeyboard = 0; |
||
1552 | } |
||
1553 | |||
1554 | HoTT_printfxy(10 ,line,"I"); |
||
1555 | i=(line*2)+(j); |
||
1556 | if(Changepos==(line*2)+1) |
||
1557 | { |
||
1558 | HoTT_printfxy(0 ,line,">%3i=%-5.5s%",(unsigned char)(*Parameter_List[i ].Variable + Parameter_List[i ].offset),&Parameter_List[i ].name); |
||
1559 | } |
||
1560 | else |
||
1561 | { |
||
1562 | HoTT_printfxy(0 ,line," %3i=%-5.5s%",(unsigned char)(*Parameter_List[i ].Variable + Parameter_List[i ].offset),&Parameter_List[i ].name); |
||
1563 | } |
||
1564 | if(Changepos==(line*2)+2) |
||
1565 | { |
||
1566 | HoTT_printfxy(11,line,">%3i=%-5.5s%",(unsigned char)(*Parameter_List[i+1].Variable + Parameter_List[i+1].offset),&Parameter_List[i+1].name); |
||
1567 | } |
||
1568 | else |
||
1569 | { |
||
1570 | HoTT_printfxy(11,line," %3i=%-5.5s%",(unsigned char)(*Parameter_List[i+1].Variable + Parameter_List[i+1].offset),&Parameter_List[i+1].name); |
||
1571 | } |
||
1572 | |||
1573 | line++; |
||
1574 | |||
1575 | } |
||
1576 | break; |
||
1577 | case 11: |
||
1578 | switch(line++) |
||
1579 | { |
||
1580 | case 0: HoTT_printfxy(0,0,"Setting speichern"); |
||
1581 | break; |
||
1582 | case 1: HoTT_printfxy(0,1,"Setting%1i= %-11.11s",GetActiveParamSet(),EE_Parameter.Name); |
||
1583 | break; //123456789012345678901 |
||
1584 | case 2: HoTT_printfxy(0,2,"Speichern nach Set %i",settingdest); |
||
1585 | break; |
||
1586 | case 3: HoTT_printfxy(0,4,"\"SET\" zum speichern"); |
||
1587 | break; |
||
1588 | case 4: HoTT_printfxy(0,5,"^ v zum auswaehlen"); |
||
1589 | break; |
||
2545 | holgerb | 1590 | case 5: |
1591 | case 6: |
||
2527 | holgerb | 1592 | case 7: |
1593 | case 8: |
||
1594 | case 9: |
||
1595 | case 10: |
||
1596 | case 11: |
||
1597 | case 12: |
||
1598 | case 13: |
||
1599 | case 14: |
||
1600 | case 15: |
||
1601 | case 16: |
||
1602 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;} |
||
1603 | else |
||
1604 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;} |
||
1605 | else |
||
1606 | if((HottKeyboard == HOTT_KEY_UP) & (settingdest <5 )) settingdest++; |
||
1607 | else |
||
1608 | if((HottKeyboard == HOTT_KEY_DOWN) & (settingdest >1 )) settingdest--; |
||
1609 | else |
||
1610 | if((HottKeyboard == HOTT_KEY_SET) && !MotorenEin) |
||
1611 | { |
||
1612 | ParamSet_WriteToEEProm(settingdest); |
||
1613 | //JetiBeep = jetibeepcode[GetActiveParamSet()-1]; |
||
1614 | Piep(GetActiveParamSet(),120); |
||
1615 | HoTT_printfxy(0,7,"Gespeichert!"); |
||
1616 | } |
||
1617 | HottKeyboard = 0; |
||
1618 | break; |
||
1619 | default: line = 0; |
||
1620 | break; |
||
1621 | } |
||
1622 | break; |
||
1623 | //------------------------------------------------------------------------------------------ |
||
1624 | // HoTT-Plus |
||
1625 | //------------------------------------------------------------------------------------------ |
||
1626 | */ |
||
2420 | holgerb | 1627 | default: page = 0; |
1628 | break; |
||
1629 | } |
||
1917 | holgerb | 1630 | } |
1631 | |||
1925 | holgerb | 1632 | #endif |
1917 | holgerb | 1633 | |
1634 | |||
1635 |