Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2506 | - | 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 | // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
||
53 | #include "libfc.h" |
||
54 | #include "printf_P.h" |
||
55 | #include "main.h" |
||
56 | #include "spi.h" |
||
57 | #include "capacity.h" |
||
58 | |||
59 | unsigned char NaviData_WaypointIndex = 0; |
||
60 | unsigned char NaviData_WaypointNumber = 0, NaviData_TargetHoldTime = 0, ToNC_Load_WP_List = 0, NaviData_MaxWpListIndex = 0; |
||
61 | unsigned char ToNC_Load_SingePoint = 0, ToNC_Store_SingePoint = 0; |
||
62 | char WPL_Name[10];// = {" \0"}; |
||
63 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
||
64 | |||
65 | #define HoTT_printf(format, args...) { _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);} |
||
66 | #define HoTT_printfxy(x,y,format, args...) { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);} |
||
67 | #define HoTT_printfxy_INV(x,y,format, args...) { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);} |
||
68 | #define HoTT_printfxy_BLINK(x,y,format, args...) { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar_BLINK, PSTR(format) , ## args);} |
||
69 | #define HoTT_printf_BLINK(format, args...) { _printf_P(&LIBFC_HoTT_Putchar_BLINK, PSTR(format) , ## args);} |
||
70 | #define HoTT_printf_INV(format, args...) { _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);} |
||
71 | |||
72 | #define VOICE_MINIMALE_EINGANSSPANNUNG 16 |
||
73 | #define VOICE_BEEP 5 |
||
74 | #define HoTT_GRAD 96 |
||
75 | #define HoTT_LINKS 123 |
||
76 | #define HoTT_RECHTS 124 |
||
77 | #define HoTT_OBEN 125 |
||
78 | #define HoTT_UNTEN 126 |
||
79 | |||
80 | #define HOTT_KEY_RIGHT 1 |
||
81 | #define HOTT_KEY_DOWN 2 |
||
82 | #define HOTT_KEY_UP 4 |
||
83 | #define HOTT_KEY_SET 6 |
||
84 | #define HOTT_KEY_LEFT 8 |
||
85 | |||
86 | #define VARIO_ZERO 30000 |
||
87 | unsigned int NaviData_TargetDistance = 0; |
||
88 | |||
89 | unsigned char MaxBlTemperture = 0; |
||
90 | unsigned char MinBlTemperture = 0; |
||
91 | unsigned char HottestBl = 0; |
||
92 | |||
93 | GPSPacket_t GPSPacket; |
||
94 | VarioPacket_t VarioPacket; |
||
95 | ASCIIPacket_t ASCIIPacket; |
||
96 | ElectricAirPacket_t ElectricAirPacket; |
||
97 | HoTTGeneral_t HoTTGeneral; |
||
98 | unsigned char SpeakHoTT = SPEAK_MIKROKOPTER; |
||
99 | unsigned char ToNC_SpeakHoTT = 0, ShowSettingNameTime = 0; |
||
100 | int HoTTVarioMeter = 0; |
||
101 | const char PROGMEM MIKROKOPTER[] = {" MikroKopter "}; |
||
102 | const char PROGMEM UNDERVOLTAGE[] = {" !! LiPo voltage !! "}; |
||
103 | const char PROGMEM LANDING[] = {" !! LANDING !! "}; |
||
104 | const char PROGMEM SIMULATION[] = {" SIMULATION active "}; |
||
105 | const char PROGMEM BOAT_MODE[] = {" MikroKopter (Boat) "}; |
||
106 | const char PROGMEM SETTING[] = {"Set :"}; |
||
107 | const char PROGMEM NC_ERROR_TEXT[MAX_ERR_NUMBER][17] = |
||
108 | { |
||
109 | //0123456789123456 |
||
110 | "No Error \0", // 0 |
||
111 | "Not compatible \0", // 1 |
||
112 | "MK3Mag not compa\0", // 2 |
||
113 | "No FC communicat\0", // 3 |
||
114 | "Compass communic\0", // 4 |
||
115 | "GPS communicatio\0", // 5 |
||
116 | "compass value \0", // 6 |
||
117 | "RC Signal lost \0", // 7 |
||
118 | "FC spi rx error \0", // 8 |
||
119 | "No NC communicat\0", // 9 |
||
120 | "FC Nick Gyro \0", // 10 |
||
121 | "FC Roll Gyro \0", // 11 |
||
122 | "FC Yaw Gyro \0", // 12 |
||
123 | "FC Nick ACC \0", // 13 |
||
124 | "FC Roll ACC \0", // 14 |
||
125 | "FC Z-ACC \0", // 15 |
||
126 | "Pressure sensor \0", // 16 |
||
127 | "I2C FC->BL-Ctrl \0", // 17 |
||
128 | "Bl Missing \0", // 18 |
||
129 | "Mixer Error \0", // 19 |
||
130 | "Carefree Error \0", // 20 |
||
131 | "GPS Fix lost \0", // 21 |
||
132 | "Magnet Error \0", // 22 |
||
133 | "Motor restart \0", // 23 |
||
134 | "BL Limitation \0", // 24 |
||
135 | "GPS Range \0", // 25 |
||
136 | "No SD-Card \0", // 26 |
||
137 | "SD-Logging error\0", // 27 |
||
138 | "Flying range! \0", // 28 |
||
139 | "Max Altitude! \0", // 29 |
||
140 | "No GPS fix \0", // 30 |
||
141 | "compass not cal.\0", // 31 |
||
142 | "BL-Selftest \0", // 32 |
||
143 | "no ext. compass \0", // 33 |
||
144 | "compass sensor \0" // 34 |
||
145 | }; |
||
146 | |||
147 | |||
148 | const char PROGMEM HOTT_ERROR[MAX_ERR_NUMBER][2] = |
||
149 | { // 1 -> only in flight 0 -> also on ground |
||
150 | //0123456789123456 |
||
151 | {0,0},// "No Error \0", // 0 |
||
152 | {SPEAK_ERROR,0}, // "Not compatible \0", // 1 |
||
153 | {SPEAK_ERROR,0}, // "MK3Mag not compa\0", // 2 |
||
154 | {SPEAK_ERR_NAVI,1}, // "No FC communicat\0", // 3 |
||
155 | {SPEAK_ERR_COMPASS,1}, // "MK3Mag communica\0", // 4 |
||
156 | {SPEAK_ERR_GPS,0}, // "GPS communicatio\0", // 5 |
||
157 | {SPEAK_ERR_COMPASS,1}, // "compass value \0", // 6 |
||
158 | {SPEAK_ERR_RECEICER,0},// "RC Signal lost \0", // 7 |
||
159 | {SPEAK_ERR_NAVI,0}, // "FC spi rx error \0", // 8 |
||
160 | {SPEAK_ERR_NAVI,0}, // "No NC communicat\0", // 9 |
||
161 | {SPEAK_ERR_SENSOR,0}, // "FC Nick Gyro \0", // 10 |
||
162 | {SPEAK_ERR_SENSOR,0}, // "FC Roll Gyro \0", // 11 |
||
163 | {SPEAK_ERR_SENSOR,0}, // "FC Yaw Gyro \0", // 12 |
||
164 | {SPEAK_ERR_SENSOR,0}, // "FC Nick ACC \0", // 13 |
||
165 | {SPEAK_ERR_SENSOR,0}, // "FC Roll ACC \0", // 14 |
||
166 | {SPEAK_ERR_SENSOR,0}, // "FC Z-ACC \0", // 15 |
||
167 | {SPEAK_ERR_SENSOR,0}, // "Pressure sensor \0", // 16 |
||
168 | {SPEAK_ERR_DATABUS,1}, // "I2C FC->BL-Ctrl \0", // 17 |
||
169 | {SPEAK_ERR_DATABUS,1}, // "Bl Missing \0", // 18 |
||
170 | {SPEAK_ERROR,0}, // "Mixer Error \0", // 19 |
||
171 | {SPEAK_CF_OFF,1}, // "Carefree Error \0", // 20 |
||
172 | {SPEAK_GPS_FIX,1}, // "GPS Fix lost \0", // 21 |
||
173 | {SPEAK_ERR_COMPASS,0}, // "Magnet Error \0", // 22 |
||
174 | {SPEAK_ERR_MOTOR,1}, // "Motor restart \0", // 23 |
||
175 | {SPEAK_MAX_TEMPERAT,1},// "BL Limitation \0", // 24 |
||
176 | {SPEAK_MAX_RANGE,1}, // "GPS Range \0", // 25 |
||
177 | {SPEAK_ERROR,1}, // "No SD-Card \0", // 26 |
||
178 | {SPEAK_ERROR,1}, // "SD-Logging error\0", // 27 |
||
179 | {SPEAK_MAX_RANGE,1}, // "Flying range! \0", // 28 |
||
180 | {SPEAK_MAX_ALTITUD,1}, // "Max Altitude! \0" // 29 |
||
181 | {SPEAK_GPS_FIX,1}, // "No GPS fix \0" // 30 |
||
182 | {SPEAK_ERR_CALIBARTION,0},// "compass not cal." // 31 |
||
183 | {SPEAK_ERR_MOTOR,0}, // "BL-Selftest \0" // 32 |
||
184 | {SPEAK_ERR_COMPASS,0}, // "no ext. compass" // 33 |
||
185 | {SPEAK_ERR_COMPASS,0} // "compass sensor" // 34 |
||
186 | }; |
||
187 | |||
188 | |||
189 | void GetHottestBl(void) |
||
190 | { |
||
191 | static unsigned char search = 0,tmp_max,tmp_min,who; |
||
192 | if(Motor[search].Temperature > tmp_max) { tmp_max = Motor[search].Temperature; who = search;} |
||
193 | else |
||
194 | if(Motor[search].Temperature) if(Motor[search].Temperature < tmp_min) tmp_min = Motor[search].Temperature; |
||
195 | if(++search >= MAX_MOTORS) |
||
196 | { |
||
197 | search = 0; |
||
198 | if(tmp_min != 255) MinBlTemperture = tmp_min; else MinBlTemperture = 0; |
||
199 | MaxBlTemperture = tmp_max; |
||
200 | HottestBl = who; |
||
201 | tmp_min = 255; |
||
202 | tmp_max = 0; |
||
203 | who = 0; |
||
204 | } |
||
205 | } |
||
206 | |||
207 | //--------------------------------------------------------------- |
||
208 | void Hott_ClearLine(unsigned char line) |
||
209 | { |
||
210 | HoTT_printfxy(0,line," "); |
||
211 | } |
||
212 | //--------------------------------------------------------------- |
||
213 | |||
214 | |||
215 | unsigned char HoTT_Waring(void) |
||
216 | { |
||
217 | unsigned char status = 0; |
||
218 | static char old_status = 0; |
||
219 | static int repeat; |
||
220 | //if(Parameter_UserParam1) return(Parameter_UserParam1); |
||
221 | ToNC_SpeakHoTT = SpeakHoTT; |
||
222 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
223 | { |
||
224 | if(LowVoltageLandingActive && (EE_Parameter.Receiver == RECEIVER_HOTT)) status = SPEAK_LANDING; |
||
225 | else status = VOICE_MINIMALE_EINGANSSPANNUNG; // Jeti hat kein wort: "LANDEN" |
||
226 | if(SpeakHoTT && old_status == VOICE_MINIMALE_EINGANSSPANNUNG) status = SpeakHoTT; // das soll auch noch durch kommen |
||
227 | } |
||
228 | else |
||
229 | if(NC_ErrorCode && NC_ErrorCode < MAX_ERR_NUMBER) // Fehlercodes |
||
230 | { |
||
231 | if(MotorenEin || !pgm_read_byte(&HOTT_ERROR[NC_ErrorCode][1])) status = pgm_read_byte(&HOTT_ERROR[NC_ErrorCode][0]); |
||
232 | } |
||
233 | if(!status) // Sprachansagen |
||
234 | { |
||
235 | // if(!(GetParamByte(PID_SPEAK_HOTT_CFG) & 0x01)) SpeakHoTT = 0; // is the voice wanted? |
||
236 | if(!(EE_Parameter.GlobalConfig3 & CFG3_SPEAK_ALL)) SpeakHoTT = 0; // is the voice wanted? |
||
237 | else status = SpeakHoTT; |
||
238 | } |
||
239 | else ToNC_SpeakHoTT = status; |
||
240 | |||
241 | if(old_status == status) // Gleichen Fehler nur alle 4 sek bringen |
||
242 | { |
||
243 | if(!CheckDelay(repeat)) return(0); |
||
244 | repeat = SetDelay(4000); |
||
245 | } |
||
246 | else repeat = SetDelay(2000); |
||
247 | |||
248 | if(status) |
||
249 | { |
||
250 | if(status == SpeakHoTT) SpeakHoTT = 0; |
||
251 | } |
||
252 | old_status = status; |
||
253 | // DebugOut.Analog[16] = status; |
||
254 | return(status); |
||
255 | } |
||
256 | |||
257 | /* |
||
258 | unsigned char HoTTErrorCode(void) |
||
259 | { |
||
260 | return(NC_ErrorCode); |
||
261 | } |
||
262 | */ |
||
263 | //--------------------------------------------------------------- |
||
264 | void NC_Fills_HoTT_Telemety(void) |
||
265 | { |
||
266 | unsigned char *ptr = NULL; |
||
267 | unsigned char max = 0,i,z; |
||
268 | switch(FromNaviCtrl.Param.Byte[11]) |
||
269 | { |
||
270 | case HOTT_VARIO_PACKET_ID: |
||
271 | ptr = (unsigned char *) &VarioPacket; |
||
272 | max = sizeof(VarioPacket); |
||
273 | break; |
||
274 | case HOTT_GPS_PACKET_ID: |
||
275 | ptr = (unsigned char *) &GPSPacket; |
||
276 | max = sizeof(GPSPacket); |
||
277 | break; |
||
278 | case HOTT_ELECTRIC_AIR_PACKET_ID: |
||
279 | ptr = (unsigned char *) &ElectricAirPacket; |
||
280 | max = sizeof(ElectricAirPacket); |
||
281 | break; |
||
282 | case HOTT_GENERAL_PACKET_ID: |
||
283 | ptr = (unsigned char *) &HoTTGeneral; |
||
284 | max = sizeof(HoTTGeneral); |
||
285 | break; |
||
286 | case JETI_GPS_PACKET_ID1: |
||
287 | ptr = (unsigned char *) &JetiExData[14].Value; |
||
288 | max = sizeof(JetiExData[14].Value); |
||
289 | break; |
||
290 | case JETI_GPS_PACKET_ID2: |
||
291 | ptr = (unsigned char *) &JetiExData[15].Value; |
||
292 | max = sizeof(JetiExData[15].Value); |
||
293 | break; |
||
294 | case HOTT_WPL_NAME: |
||
295 | ptr = (unsigned char *) WPL_Name; |
||
296 | max = sizeof(WPL_Name)-1; |
||
297 | break; |
||
298 | |||
299 | } |
||
300 | z = FromNaviCtrl.Param.Byte[0]; // Data allocation |
||
301 | |||
302 | for(i=0; i < FromNaviCtrl.Param.Byte[1]; i++) |
||
303 | { |
||
304 | if(z >= max) break; |
||
305 | ptr[z] = FromNaviCtrl.Param.Byte[2+i]; |
||
306 | z++; |
||
307 | } |
||
308 | } |
||
309 | |||
310 | unsigned int BuildHoTT_Vario(void) |
||
311 | { |
||
312 | unsigned int tmp = VARIO_ZERO; |
||
313 | if(VarioCharacter == '+' || VarioCharacter == '-') |
||
314 | { |
||
315 | tmp = VARIO_ZERO + (AltitudeSetpointTrimming * EE_Parameter.Hoehe_Verstaerkung) / 3; |
||
316 | if(tmp < VARIO_ZERO && tmp > VARIO_ZERO - 50) tmp = VARIO_ZERO - 50; // weil es sonst erst bei < 0,5m/sek piept |
||
317 | } |
||
318 | else |
||
319 | if((VarioCharacter == ' ') && (FC_StatusFlags & FC_STATUS_FLY)) |
||
320 | { |
||
321 | tmp = VARIO_ZERO + HoTTVarioMeter; |
||
322 | if(tmp > VARIO_ZERO) |
||
323 | { |
||
324 | if(tmp < VARIO_ZERO + 100) tmp = VARIO_ZERO; |
||
325 | else tmp -= 100; |
||
326 | } |
||
327 | if(tmp < VARIO_ZERO) |
||
328 | { |
||
329 | if(tmp > VARIO_ZERO - 100) tmp = VARIO_ZERO; |
||
330 | else tmp += 100; |
||
331 | } |
||
332 | } |
||
333 | else |
||
334 | if(VarioCharacter == '^') tmp = VARIO_ZERO + FromNC_AltitudeSpeed * 10; |
||
335 | else |
||
336 | if(VarioCharacter == 'v') tmp = VARIO_ZERO - FromNC_AltitudeSpeed * 10; |
||
337 | return(tmp); |
||
338 | } |
||
339 | |||
340 | //--------------------------------------------------------------- |
||
341 | unsigned char HoTT_Telemety(unsigned char packet_request) |
||
342 | { |
||
343 | unsigned char i = 0; |
||
344 | //Debug("rqst: %02X",packet_request); |
||
345 | |||
346 | switch(packet_request) |
||
347 | { |
||
348 | case HOTT_VARIO_PACKET_ID: |
||
349 | GPSPacket.WarnBeep = HoTT_Waring(); // Achtung: das ist richtig hier, damit der Varioton schon vorher abgestellt wird |
||
350 | VarioPacket.Altitude = HoehenWert/100 + 500; |
||
351 | if(!GPSPacket.WarnBeep) VarioPacket.m_sec = BuildHoTT_Vario(); else VarioPacket.m_sec = VARIO_ZERO; |
||
352 | VarioPacket.m_3sec = VarioPacket.m_sec; |
||
353 | VarioPacket.m_10sec = VarioPacket.m_sec; |
||
354 | if (VarioPacket.Altitude < VarioPacket.MinAltitude) VarioPacket.MinAltitude = VarioPacket.Altitude; |
||
355 | if (VarioPacket.Altitude > VarioPacket.MaxAltitude) VarioPacket.MaxAltitude = VarioPacket.Altitude; |
||
356 | VarioPacket.WarnBeep = 0;//HoTT_Waring(); |
||
357 | HoTT_DataPointer = (unsigned char *) &VarioPacket; |
||
358 | VarioPacket.FreeCharacters[0] = VarioCharacter; |
||
359 | if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) VarioPacket.FreeCharacters[1] = 'C'; else VarioPacket.FreeCharacters[1] = ' '; |
||
360 | // VarioPacket.FreeCharacters[2] = ' '; |
||
361 | if(NC_ErrorCode) |
||
362 | { |
||
363 | VarioPacket.Text[0] = NC_ErrorCode/10 + '0'; |
||
364 | VarioPacket.Text[1] = NC_ErrorCode%10 + '0'; |
||
365 | VarioPacket.Text[2] = ':'; |
||
366 | for(i=0; i<16;i++) VarioPacket.Text[i+3] = pgm_read_byte(&NC_ERROR_TEXT[NC_ErrorCode][i]); |
||
367 | VarioPacket.Text[19] = ' '; |
||
368 | VarioPacket.Text[20] = ' '; |
||
369 | } |
||
370 | else |
||
371 | if(LowVoltageLandingActive) for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&LANDING[i]); // no Error |
||
372 | else |
||
373 | if(FC_StatusFlags & FC_STATUS_LOWBAT) for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&UNDERVOLTAGE[i]); // no Error |
||
374 | else |
||
375 | if(ShowSettingNameTime) // no Error |
||
376 | { |
||
377 | for(i=0; i<sizeof(SETTING);i++) VarioPacket.Text[i] = pgm_read_byte(&SETTING[i]); |
||
378 | VarioPacket.Text[4] = '0' + ActiveParamSet; |
||
379 | for(i=0; i<sizeof(EE_Parameter.Name);i++) VarioPacket.Text[i+7] = EE_Parameter.Name[i]; // no Error |
||
380 | if(FC_StatusFlags3 & FC_STATUS3_BOAT) |
||
381 | { |
||
382 | VarioPacket.Text[17] = 'B'; |
||
383 | VarioPacket.Text[18] = 'O'; |
||
384 | VarioPacket.Text[19] = 'A'; |
||
385 | VarioPacket.Text[20] = 'T'; |
||
386 | } |
||
387 | else |
||
388 | { |
||
389 | VarioPacket.Text[18] = ' '; |
||
390 | VarioPacket.Text[19] = ' '; |
||
391 | VarioPacket.Text[20] = ' '; |
||
392 | } |
||
393 | } |
||
394 | else |
||
395 | if(NaviData_WaypointNumber) |
||
396 | { |
||
397 | unsigned int tmp_int; |
||
398 | unsigned char tmp; |
||
399 | VarioPacket.Text[0] = 'W'; VarioPacket.Text[1] = 'P'; |
||
400 | VarioPacket.Text[2] = ' '; |
||
401 | VarioPacket.Text[3] = '0'+(NaviData_WaypointIndex) / 10; |
||
402 | VarioPacket.Text[4] = '0'+(NaviData_WaypointIndex) % 10; |
||
403 | VarioPacket.Text[5] = '/'; |
||
404 | VarioPacket.Text[6] = '0'+(NaviData_WaypointNumber) / 10; |
||
405 | VarioPacket.Text[7] = '0'+(NaviData_WaypointNumber) % 10; |
||
406 | VarioPacket.Text[8] = ' '; |
||
407 | tmp_int = NaviData_TargetDistance; |
||
408 | if(tmp_int > 1000) { VarioPacket.Text[9] = '0'+(tmp_int) / 1000; tmp_int %= 1000;} |
||
409 | else VarioPacket.Text[9] = ' '; |
||
410 | if(tmp_int > 100) { VarioPacket.Text[10] = '0'+(tmp_int) / 100; tmp_int %= 100;} |
||
411 | else VarioPacket.Text[10] = ' '; |
||
412 | VarioPacket.Text[11] = '0'+(tmp_int) / 10; |
||
413 | VarioPacket.Text[12] = '0'+(tmp_int) % 10; |
||
414 | VarioPacket.Text[13] = 'm'; |
||
415 | VarioPacket.Text[14] = ' '; |
||
416 | tmp = NaviData_TargetHoldTime; |
||
417 | if(tmp > 100) { VarioPacket.Text[15] = '0'+(tmp) / 100; tmp %= 100;} else VarioPacket.Text[15] = ' '; |
||
418 | VarioPacket.Text[16] = '0'+(tmp) / 10; |
||
419 | VarioPacket.Text[17] = '0'+(tmp) % 10; |
||
420 | VarioPacket.Text[18] = 's'; |
||
421 | VarioPacket.Text[19] = ' '; |
||
422 | VarioPacket.Text[20] = ' '; |
||
423 | } |
||
424 | else |
||
425 | if(NC_To_FC_Flags & NC_TO_FC_SIMULATION_ACTIVE) |
||
426 | { |
||
427 | for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&SIMULATION[i]); |
||
428 | } |
||
429 | else |
||
430 | if(!CalibrationDone) |
||
431 | { |
||
432 | for(i=0; i<17;i++) VarioPacket.Text[i] = pgm_read_byte(&MIKROKOPTER[i+2]); // no Error and not calibrated |
||
433 | VarioPacket.Text[16] = '0'+VERSION_MAJOR; |
||
434 | VarioPacket.Text[17] = '.'; |
||
435 | VarioPacket.Text[18] = '0'+VERSION_MINOR/10; |
||
436 | VarioPacket.Text[19] = '0'+VERSION_MINOR%10; |
||
437 | VarioPacket.Text[20] = 'a'+VERSION_PATCH; |
||
438 | } |
||
439 | else |
||
440 | { |
||
441 | if(FC_StatusFlags3 & FC_STATUS3_BOAT) for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&BOAT_MODE[i]); // no Error |
||
442 | else for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&MIKROKOPTER[i]); // no Error |
||
443 | if(FC_StatusFlags3 & FC_STATUS3_REDUNDANCE) VarioPacket.Text[0] = 'R'; |
||
444 | } |
||
445 | return(sizeof(VarioPacket)); |
||
446 | break; |
||
447 | |||
448 | case HOTT_GPS_PACKET_ID: |
||
449 | GPSPacket.Altitude = HoehenWert/100 + 500; |
||
450 | // GPSPacket.Distance = GPSInfo.HomeDistance/10; // macht die NC |
||
451 | // GPSPacket.Heading = GPSInfo.HomeBearing/2; // macht die NC |
||
452 | // GPSPacket.Speed = (GPSInfo.Speed * 36) / 10; // macht die NC |
||
453 | // GPSPacket.WarnBeep = HoTT_Waring(); //(wird jetzt weiter oben gemacht) |
||
454 | if(!GPSPacket.WarnBeep) GPSPacket.m_sec = BuildHoTT_Vario(); else GPSPacket.m_sec = VARIO_ZERO; |
||
455 | GPSPacket.m_3sec = 120; |
||
456 | GPSPacket.NumOfSats = GPSInfo.NumOfSats; |
||
457 | if(GPSInfo.Flags & FLAG_DIFFSOLN) GPSPacket.SatFix = 'D'; |
||
458 | else |
||
459 | if(GPSInfo.SatFix == SATFIX_3D) GPSPacket.SatFix = ' '; |
||
460 | else GPSPacket.SatFix = '!'; |
||
461 | HoTT_DataPointer = (unsigned char *) &GPSPacket; |
||
462 | GPSPacket.FreeCharacters[0] = NC_GPS_ModeCharacter; |
||
463 | GPSPacket.FreeCharacters[2] = GPSPacket.SatFix; |
||
464 | GPSPacket.HomeDirection = GPSInfo.HomeBearing / 2;//230; |
||
465 | return(sizeof(GPSPacket)); |
||
466 | break; |
||
467 | case HOTT_ELECTRIC_AIR_PACKET_ID: |
||
468 | GetHottestBl(); |
||
469 | ElectricAirPacket.Altitude = HoehenWert/100 + 500; |
||
470 | ElectricAirPacket.Battery1 = UBat; |
||
471 | ElectricAirPacket.Battery2 = UBat; |
||
472 | ElectricAirPacket.VoltageCell1 = CompassCorrected / 2; |
||
473 | ElectricAirPacket.VoltageCell8 = ElectricAirPacket.VoltageCell1; |
||
474 | ElectricAirPacket.VoltageCell6 = GPSInfo.HomeBearing / 2; |
||
475 | ElectricAirPacket.VoltageCell7 = GPSInfo.HomeDistance/20; |
||
476 | ElectricAirPacket.VoltageCell13 = ElectricAirPacket.VoltageCell6; |
||
477 | ElectricAirPacket.VoltageCell14 = ElectricAirPacket.VoltageCell7; |
||
478 | if(!GPSPacket.WarnBeep) ElectricAirPacket.m_sec = BuildHoTT_Vario(); else ElectricAirPacket.m_sec = VARIO_ZERO; |
||
479 | ElectricAirPacket.m_3sec = 120; |
||
480 | ElectricAirPacket.InputVoltage = UBat; |
||
481 | ElectricAirPacket.Temperature1 = MinBlTemperture + 20; |
||
482 | ElectricAirPacket.Temperature2 = MaxBlTemperture + 20; |
||
483 | ElectricAirPacket.Capacity = Capacity.UsedCapacity/10; |
||
484 | // ElectricAirPacket.WarnBeep = 0;//HoTT_Waring(); |
||
485 | ElectricAirPacket.WarnBeep = GPSPacket.WarnBeep; |
||
486 | ElectricAirPacket.Current = Capacity.ActualCurrent; |
||
487 | HoTT_DataPointer = (unsigned char *) &ElectricAirPacket; |
||
488 | ElectricAirPacket.FlightTimeMinutes = FlugSekunden / 60; |
||
489 | ElectricAirPacket.FlightTimeSeconds = FlugSekunden % 60; |
||
490 | return(sizeof(ElectricAirPacket)); |
||
491 | break; |
||
492 | case HOTT_GENERAL_PACKET_ID: |
||
493 | GetHottestBl(); |
||
494 | HoTTGeneral.Rpm = GPSInfo.HomeDistance/100; |
||
495 | HoTTGeneral.VoltageCell1 = CompassCorrected / 2; |
||
496 | HoTTGeneral.VoltageCell2 = KompassValue / 2; |
||
497 | //HoTTGeneral.VoltageCell3 = Magnetstaerke -> macht NC |
||
498 | //HoTTGeneral.VoltageCell4 = Inclinition -> macht NC |
||
499 | HoTTGeneral.VoltageCell5 = DebugOut.Analog[28]; // I2C ErrorCounter |
||
500 | HoTTGeneral.VoltageCell6 = GPSInfo.HomeBearing / 2; |
||
501 | if(UBat > BattLowVoltageWarning + 2) HoTTGeneral.FuelPercent = (UBat - (BattLowVoltageWarning + 2)) * 3; |
||
502 | else HoTTGeneral.FuelPercent = 0; |
||
503 | if(HoTTGeneral.FuelPercent > 100) HoTTGeneral.FuelPercent = 100; |
||
504 | HoTTGeneral.FuelCapacity = NC_ErrorCode;//HoehenWert/100; // Oelpegel |
||
505 | // if(HoTTGeneral.FuelCapacity < 0) HoTTGeneral.FuelCapacity = 0; |
||
506 | HoTTGeneral.Altitude = HoehenWert/100 + 500; |
||
507 | HoTTGeneral.Battery1 = UBat; |
||
508 | HoTTGeneral.Battery2 = UBat; |
||
509 | if(!GPSPacket.WarnBeep) HoTTGeneral.m_sec = BuildHoTT_Vario(); else HoTTGeneral.m_sec = VARIO_ZERO; |
||
510 | HoTTGeneral.m_3sec = 120 + GPSPacket.WarnBeep; |
||
511 | HoTTGeneral.InputVoltage = UBat; |
||
512 | HoTTGeneral.Temperature1 = MinBlTemperture + 20; |
||
513 | HoTTGeneral.Temperature2 = MaxBlTemperture + 20; |
||
514 | HoTTGeneral.Capacity = Capacity.UsedCapacity/10; |
||
515 | HoTTGeneral.WarnBeep = 0;//HoTT_Waring(); |
||
516 | HoTTGeneral.Current = Capacity.ActualCurrent; |
||
517 | //HoTTGeneral.ErrorNumber = HoTTErrorCode(); |
||
518 | HoTT_DataPointer = (unsigned char *) &HoTTGeneral; |
||
519 | return(sizeof(HoTTGeneral)); |
||
520 | break; |
||
521 | default: return(0); |
||
522 | } |
||
523 | } |
||
524 | |||
525 | //--------------------------------------------------------------- |
||
526 | void HoTT_Menu(void) |
||
527 | { |
||
528 | static unsigned char line, page = 0,show_current = 0,show_mag = 0, show_poti = 0; |
||
529 | unsigned char tmp; |
||
530 | HoTTVarioMeter = (HoTTVarioMeter * 7 + VarioMeter) / 8; |
||
531 | |||
532 | // if(HottKeyboard) {beeptime = 1000;}; |
||
533 | |||
534 | switch(page) |
||
535 | { |
||
536 | case 0: |
||
537 | switch(line++) |
||
538 | { |
||
539 | case 0: |
||
540 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
541 | HoTT_printfxy_BLINK(0,0," %2i.%1iV ",UBat/10, UBat%10) |
||
542 | else |
||
543 | HoTT_printfxy(0,0," %2i.%1iV ",UBat/10, UBat%10) |
||
544 | |||
545 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
||
546 | { |
||
547 | if(HoehenReglerAktiv) HoTT_printfxy_INV(10,0,"ALT:%4im %c", (int16_t)(HoehenWert/100),VarioCharacter) |
||
548 | else HoTT_printfxy(10,0,"ALT:%4im ", (int16_t)(HoehenWert/100)) |
||
549 | } |
||
550 | else HoTT_printfxy(10,0,"ALT:---- "); |
||
551 | break; |
||
552 | case 1: |
||
553 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
554 | HoTT_printfxy_BLINK(0,1," %2i:%02i ",FlugSekunden/60,FlugSekunden%60) |
||
555 | else HoTT_printfxy(0,1," %2i:%02i ",FlugSekunden/60,FlugSekunden%60); |
||
556 | HoTT_printfxy(10,1,"DIR: %3d%c",CompassCorrected, HoTT_GRAD); |
||
557 | if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(20,1,"C") else HoTT_printfxy(20,1," "); |
||
558 | break; |
||
559 | case 2: |
||
560 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
561 | HoTT_printfxy_BLINK(0,2," %5i ",Capacity.UsedCapacity) |
||
562 | else HoTT_printfxy(0,2," %5i ",Capacity.UsedCapacity); |
||
563 | HoTT_printfxy(12,2,"I:%2i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
||
564 | break; |
||
565 | case 3: |
||
566 | HoTT_printfxy(9,0,":"); |
||
567 | HoTT_printfxy(9,1,":"); |
||
568 | HoTT_printfxy(9,2,":"); |
||
569 | HoTT_printfxy(0,3,"---------+-----------"); |
||
570 | |||
571 | // HoTT_printfxy(0,3,"---------------------"); |
||
572 | HoTT_printfxy(0,6,"---------------------"); |
||
573 | break; |
||
574 | case 4: |
||
575 | if(NaviDataOkay) |
||
576 | { |
||
577 | HoTT_printfxy(9,4,":"); |
||
578 | HoTT_printfxy(0,4,"SAT:%2d ",GPSInfo.NumOfSats); |
||
579 | HoTT_printfxy(10,4,"DIST:%3dm",GPSInfo.HomeDistance/10); |
||
580 | switch (GPSInfo.SatFix) |
||
581 | { |
||
582 | case SATFIX_3D: |
||
583 | if(GPSInfo.Flags & FLAG_DIFFSOLN) HoTT_printfxy(7,4,"D ") |
||
584 | else HoTT_printfxy(7,4,"3D"); |
||
585 | break; |
||
586 | default: |
||
587 | HoTT_printfxy_BLINK(7,4,"!!"); |
||
588 | break; |
||
589 | } |
||
590 | } |
||
591 | else |
||
592 | { |
||
593 | Hott_ClearLine(4); |
||
594 | } |
||
595 | break; |
||
596 | case 5: |
||
597 | if(NaviDataOkay) |
||
598 | { |
||
599 | if(show_mag) |
||
600 | { |
||
601 | HoTT_printfxy(0,5,"MAG:%3u%% ",EarthMagneticField); |
||
602 | HoTT_printfxy(12,5,"HM:%3d%c %c", GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter); |
||
603 | HoTT_printfxy(9,5,"incl:%2d%c(%2i)",EarthMagneticInclination, HoTT_GRAD,EarthMagneticInclinationTheoretic); |
||
604 | } |
||
605 | else |
||
606 | { |
||
607 | HoTT_printfxy(0,5," %2um/s: HM:%3d%c %c",GPSInfo.Speed, GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter); |
||
608 | } |
||
609 | } |
||
610 | else Hott_ClearLine(5); |
||
611 | break; |
||
612 | case 6: |
||
613 | break; |
||
614 | case 7: if(NC_ErrorCode) |
||
615 | { |
||
616 | if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER) |
||
617 | { |
||
618 | Hott_ClearLine(7); |
||
619 | HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode); |
||
620 | } |
||
621 | else |
||
622 | { |
||
623 | HoTT_printfxy(0,7,"ERR: "); _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);}; |
||
624 | } |
||
625 | else |
||
626 | if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy(1,7,"!! LiPo voltage !!") |
||
627 | else HoTT_printfxy(0,7," www.MikroKopter.de "); |
||
628 | break; |
||
629 | case 8: //ASCIIPacket.WarnBeep = HoTT_Waring(); |
||
630 | // ASCIIPacket.WarnBeep = Parameter_UserParam1; |
||
631 | case 9: |
||
632 | case 10: |
||
633 | case 11: |
||
634 | case 12: |
||
635 | case 13: |
||
636 | case 14: |
||
637 | case 15: |
||
638 | case 16: |
||
639 | if(HottKeyboard == HOTT_KEY_DOWN) { LIBFC_HoTT_Clear(); page = 5; line = 0;} |
||
640 | else |
||
641 | if(HottKeyboard == HOTT_KEY_SET) { if(show_mag) show_mag = 0; else show_mag = 1;} |
||
642 | else |
||
643 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 1; line = 0;}; |
||
644 | HottKeyboard = 0; |
||
645 | break; |
||
646 | default: line = 0; |
||
647 | break; |
||
648 | } |
||
649 | break; |
||
650 | case 1: |
||
651 | switch(line++) |
||
652 | { |
||
653 | case 0: |
||
654 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
655 | HoTT_printfxy_BLINK(0,0," %2i:%02i %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity) |
||
656 | else HoTT_printfxy(0,0," %2i:%02i %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity); |
||
657 | break; |
||
658 | case 1: |
||
659 | HoTT_printfxy(0,1,"DIR:%3d%c",CompassCorrected, HoTT_GRAD); |
||
660 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
||
661 | { |
||
662 | if(HoehenReglerAktiv) HoTT_printfxy_INV(10,1,"ALT:%4im", (int16_t)(HoehenWert/100)) |
||
663 | else HoTT_printfxy(10,1,"ALT:%4im", (int16_t)(HoehenWert/100)) |
||
664 | } |
||
665 | else HoTT_printfxy(10,1,"ALT:---- "); |
||
666 | HoTT_printfxy(20,1,"%c",VarioCharacter); |
||
667 | break; |
||
668 | case 2: |
||
669 | if(NaviDataOkay) |
||
670 | { |
||
671 | HoTT_printfxy(1,2,"HM:%3d%c DIST:%3dm %c", GPSInfo.HomeBearing, HoTT_GRAD, GPSInfo.HomeDistance/10, NC_GPS_ModeCharacter); |
||
672 | } |
||
673 | else |
||
674 | { |
||
675 | Hott_ClearLine(2); |
||
676 | } |
||
677 | break; |
||
678 | case 3: |
||
679 | HoTT_printfxy(0,3,"PWR:%2i.%1iA (%iW) ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10,Capacity.ActualPower); |
||
680 | if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(19,3,"CF") else HoTT_printfxy(19,3," "); |
||
681 | break; |
||
682 | case 4: |
||
683 | if(NaviDataOkay) |
||
684 | { |
||
685 | HoTT_printfxy(0,4,"GPS:%2um/s SAT:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
||
686 | switch (GPSInfo.SatFix) |
||
687 | { |
||
688 | case SATFIX_3D: |
||
689 | HoTT_printfxy(16,4," 3D "); |
||
690 | break; |
||
691 | //case SATFIX_2D: |
||
692 | //case SATFIX_NONE: |
||
693 | default: |
||
694 | HoTT_printfxy_BLINK(16,4,"NOFIX"); |
||
695 | break; |
||
696 | } |
||
697 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
||
698 | { |
||
699 | HoTT_printfxy(16,4,"DGPS "); |
||
700 | } |
||
701 | } |
||
702 | else |
||
703 | { //012345678901234567890 |
||
704 | HoTT_printfxy(0,4," No NaviCtrl "); |
||
705 | } |
||
706 | break; |
||
707 | case 5: |
||
708 | if(show_current) |
||
709 | { |
||
710 | // 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); |
||
711 | 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); |
||
712 | } |
||
713 | else |
||
714 | { |
||
715 | HoTT_printfxy(0,5,"%3i %3i %3i %3i%cC", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature,HoTT_GRAD); |
||
716 | } |
||
717 | break; |
||
718 | case 6: |
||
719 | if(show_current) |
||
720 | { |
||
721 | if(RequiredMotors == 4) Hott_ClearLine(6); |
||
722 | else |
||
723 | // 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) |
||
724 | 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) |
||
725 | else |
||
726 | // 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); |
||
727 | 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); |
||
728 | } |
||
729 | else |
||
730 | { |
||
731 | if(RequiredMotors == 4) Hott_ClearLine(6); |
||
732 | else |
||
733 | if(RequiredMotors == 6) HoTT_printfxy(0,6,"%3i %3i%cC ", Motor[4].Temperature, Motor[5].Temperature,HoTT_GRAD) |
||
734 | else |
||
735 | 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); |
||
736 | } |
||
737 | break; |
||
738 | case 7: if(NC_ErrorCode) |
||
739 | { |
||
740 | if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER) |
||
741 | { |
||
742 | Hott_ClearLine(7); |
||
743 | HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode); |
||
744 | } |
||
745 | else |
||
746 | { |
||
747 | HoTT_printfxy(0,7,"ERR: "); _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);}; |
||
748 | } |
||
749 | else |
||
750 | if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy(1,7,"!! LiPo voltage !!") |
||
751 | else HoTT_printfxy(0,7," www.MikroKopter.de "); |
||
752 | break; |
||
753 | case 8: // ASCIIPacket.WarnBeep = HoTT_Waring(); |
||
754 | // ASCIIPacket.WarnBeep = Parameter_UserParam1; |
||
755 | case 9: |
||
756 | case 10: |
||
757 | case 11: |
||
758 | case 12: |
||
759 | case 13: |
||
760 | case 14: |
||
761 | case 15: |
||
762 | case 16: |
||
763 | if(HottKeyboard == HOTT_KEY_SET) { if(show_current) show_current = 0; else show_current = 1; Hott_ClearLine(5); Hott_ClearLine(6);} |
||
764 | else |
||
765 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 2; line = 0;} |
||
766 | else |
||
767 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 0; line = 0;} |
||
768 | //if(HottKeyboard) HoTT_printfxy(15,6,"%KEY:%02x ",HottKeyboard); |
||
769 | HottKeyboard = 0; |
||
770 | break; |
||
771 | default: line = 0; |
||
772 | break; |
||
773 | } |
||
774 | break; |
||
775 | case 2: |
||
776 | switch(line++) |
||
777 | { |
||
778 | case 0: |
||
779 | HoTT_printfxy_INV(0,0,"Setting:%u %s ",ActiveParamSet,EE_Parameter.Name); |
||
780 | break; |
||
781 | case 1: HoTT_printfxy(0,1,"Min:%2i.%1iV %s ",BattLowVoltageWarning/10, BattLowVoltageWarning%10, Mixer.Name); |
||
782 | break; |
||
783 | case 2: HoTT_printfxy(0,2,"ALT:"); |
||
784 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
||
785 | { |
||
786 | if(!(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER)) HoTT_printf("POTI:%3u ", Parameter_HoehenSchalter) |
||
787 | else |
||
788 | { |
||
789 | if(Parameter_HoehenSchalter > 50) HoTT_printf("(ON) ") else HoTT_printf("(OFF) "); |
||
790 | if((Parameter_ExtraConfig & CFG2_HEIGHT_LIMIT)) HoTT_printf("LIMIT", Parameter_HoehenSchalter) |
||
791 | else HoTT_printf("VARIO", Parameter_HoehenSchalter); |
||
792 | } |
||
793 | } |
||
794 | else |
||
795 | HoTT_printf("DISABLED"); |
||
796 | break; |
||
797 | case 3: HoTT_printfxy(0,3,"CF:"); |
||
798 | if(!EE_Parameter.CareFreeChannel) HoTT_printf("DISABLED") |
||
799 | else |
||
800 | { |
||
801 | if(CareFree) HoTT_printf(" (ON) ") else HoTT_printf(" (OFF)"); |
||
802 | if(EE_Parameter.ExtraConfig & CFG_LEARNABLE_CAREFREE) HoTT_printf(" TEACH"); |
||
803 | } |
||
804 | break; |
||
805 | case 4: HoTT_printfxy(0,4,"GPS:"); |
||
806 | if(!(Parameter_GlobalConfig & CFG_GPS_AKTIV)) HoTT_printf("DISABLED") |
||
807 | else |
||
808 | { |
||
809 | tmp = GetChannelValue(EE_Parameter.NaviGpsModeChannel); |
||
810 | if(tmp < 50) HoTT_printf("(FREE)") |
||
811 | else |
||
812 | if(tmp >= 180) HoTT_printf("(HOME)") |
||
813 | else |
||
814 | if(EE_Parameter.ExtraConfig & CFG_GPS_AID) HoTT_printf("(AID) ") |
||
815 | else HoTT_printf("(HOLD)") |
||
816 | } |
||
817 | if(EE_Parameter.FailSafeTime) HoTT_printfxy(10,4," FS:%usek ",EE_Parameter.FailSafeTime) |
||
818 | |||
819 | break; |
||
820 | case 5: HoTT_printfxy(0,5,"HOME ALT:"); |
||
821 | if(EE_Parameter.ComingHomeAltitude) HoTT_printf("%um",EE_Parameter.ComingHomeAltitude) else HoTT_printf("HOLD "); |
||
822 | break; |
||
823 | case 6: |
||
824 | if(!show_poti) |
||
825 | { |
||
826 | HoTT_printfxy(0,6,"Ni:%4i Ro:%4i C:%3i",PPM_in[EE_Parameter.Kanalbelegung[K_NICK]],PPM_in[EE_Parameter.Kanalbelegung[K_ROLL]], Parameter_ServoNickControl); |
||
827 | HoTT_printfxy(0,7,"Gs:%4i Ya:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]]+127,PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]); |
||
828 | } |
||
829 | else |
||
830 | { |
||
831 | HoTT_printfxy(0,6,"P1:%4i P2:%4i 3:%3i",Poti1,Poti2, Poti3); |
||
832 | HoTT_printfxy(0,7,"P4:%4i P5:%4i 6:%3i",Poti4,Poti5, Poti6); |
||
833 | } |
||
834 | |||
835 | break; |
||
836 | case 7: //HoTT_printfxy(0,6,"WARNINGS:"); |
||
837 | if(HoTTBlink) |
||
838 | { |
||
839 | LIBFC_HoTT_SetPos(6 * 21); |
||
840 | if(!(Parameter_GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV)) HoTT_printf_BLINK("COUPLING OFF! "); |
||
841 | if(EE_Parameter.BitConfig & (CFG_LOOP_LINKS | CFG_LOOP_RECHTS | CFG_LOOP_UNTEN | CFG_LOOP_OBEN)) HoTT_printf_BLINK("LOOPING! "); |
||
842 | if(Parameter_GlobalConfig & CFG_HEADING_HOLD) HoTT_printf_BLINK("HH! "); |
||
843 | if(!(Parameter_GlobalConfig & CFG_KOMPASS_AKTIV)) HoTT_printf_BLINK("COMPASS OFF! "); |
||
844 | } |
||
845 | break; |
||
846 | case 8: //ASCIIPacket.WarnBeep = HoTT_Waring(); |
||
847 | break; |
||
848 | case 9: |
||
849 | case 10: |
||
850 | case 11: |
||
851 | case 12: |
||
852 | case 13: |
||
853 | case 14: |
||
854 | case 15: |
||
855 | case 16: |
||
856 | if(HottKeyboard == HOTT_KEY_SET) { if(show_poti) show_poti = 0; else show_poti = 1; Hott_ClearLine(6); Hott_ClearLine(7);} |
||
857 | else |
||
858 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 3; line = 0;} |
||
859 | else |
||
860 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 1; line = 0;}; |
||
861 | HottKeyboard = 0; |
||
862 | break; |
||
863 | default: line = 0; |
||
864 | break; |
||
865 | } |
||
866 | break; |
||
867 | case 3: |
||
868 | switch(line++) |
||
869 | { |
||
870 | static unsigned char load_waypoint_tmp2 = 1, changed2; |
||
871 | case 0: |
||
872 | HoTT_printfxy(0,0,"Load Waypoints"); |
||
873 | HoTT_printfxy(0,1,"(Relative Positions)"); |
||
874 | // HoTT_printfxy(0,1,"(Absolute)"); |
||
875 | break; |
||
876 | case 1: |
||
877 | if(NaviData_WaypointNumber) HoTT_printfxy(0,6,"Active WP:%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
||
878 | else HoTT_printfxy(0,6,"No WPs active ") |
||
879 | break; |
||
880 | case 2: |
||
881 | HoTT_printfxy(0,7,"%2i.%1iV ",UBat/10, UBat%10) |
||
882 | HoTT_printfxy(11,7,"%s",WPL_Name) |
||
883 | case 3: |
||
884 | case 4: |
||
885 | case 5: |
||
886 | if(load_waypoint_tmp2) |
||
887 | { |
||
888 | if(changed2 && HoTTBlink) HoTT_printfxy(10,3," ") |
||
889 | else HoTT_printfxy(10,3,"%2i ",load_waypoint_tmp2); |
||
890 | HoTT_printfxy(0,3,"Load list:") |
||
891 | } |
||
892 | else |
||
893 | { |
||
894 | HoTT_printfxy(0,3,"Load list: -- "); |
||
895 | } |
||
896 | if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,4,"No SD-Card ") |
||
897 | else |
||
898 | { |
||
899 | if(GPSInfo.SatFix == SATFIX_3D) |
||
900 | { |
||
901 | if(changed2 && load_waypoint_tmp2) HoTT_printfxy(0,4,"(Set -> Load)") |
||
902 | else HoTT_printfxy(0,4," "); |
||
903 | if(HottKeyboard == HOTT_KEY_SET) { if(load_waypoint_tmp2) ToNC_Load_WP_List = load_waypoint_tmp2 | 128; changed2 = 0;} |
||
904 | } else HoTT_printfxy(0,4,"!No GPS-Fix! "); |
||
905 | } |
||
906 | if(HottKeyboard == HOTT_KEY_UP && load_waypoint_tmp2 < NaviData_MaxWpListIndex) { changed2 = 1; load_waypoint_tmp2++;HoTTBlink = 0;} |
||
907 | if(HottKeyboard == HOTT_KEY_DOWN && load_waypoint_tmp2 > 1) { changed2 = 1; load_waypoint_tmp2--;HoTTBlink = 0;}; |
||
908 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 4; line = 0;} |
||
909 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 2; line = 0;}; |
||
910 | HottKeyboard = 0; |
||
911 | break; |
||
912 | default: line = 0; |
||
913 | break; |
||
914 | } |
||
915 | break; |
||
916 | case 4: |
||
917 | switch(line++) |
||
918 | { |
||
919 | static unsigned char load_waypoint_tmp = 1, changed; |
||
920 | case 0: |
||
921 | HoTT_printfxy(0,0,"Load Waypoints"); |
||
922 | HoTT_printfxy(0,1,"(Fixed Positions)"); |
||
923 | break; |
||
924 | case 1: |
||
925 | if(NaviData_WaypointNumber) HoTT_printfxy(0,6,"Active WP:%2d/%d ",NaviData_WaypointIndex,NaviData_WaypointNumber) |
||
926 | else HoTT_printfxy(0,6,"No WPs active ") |
||
927 | break; |
||
928 | case 2: |
||
929 | HoTT_printfxy(0,7,"%2i.%1iV ",UBat/10, UBat%10) |
||
930 | HoTT_printfxy(11,7,"%s",WPL_Name) |
||
931 | case 3: |
||
932 | case 4: |
||
933 | case 5: |
||
934 | HoTT_printfxy(0,3,"Load list:") |
||
935 | if(load_waypoint_tmp) |
||
936 | { |
||
937 | if(changed && HoTTBlink) HoTT_printfxy(10,3," ") |
||
938 | else HoTT_printfxy(10,3,"%2d (FIX)",load_waypoint_tmp); |
||
939 | } |
||
940 | else |
||
941 | { |
||
942 | HoTT_printfxy(10,3," --") |
||
943 | } |
||
944 | |||
945 | if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,4,"No SD-Card ") |
||
946 | else |
||
947 | { |
||
948 | if(changed && load_waypoint_tmp) HoTT_printfxy(0,4,"(Set -> Load)") |
||
949 | else HoTT_printfxy(0,4," "); |
||
950 | } |
||
951 | if(HottKeyboard == HOTT_KEY_UP && load_waypoint_tmp < NaviData_MaxWpListIndex) { changed = 1; load_waypoint_tmp++; HoTTBlink = 0;} |
||
952 | if(HottKeyboard == HOTT_KEY_DOWN && load_waypoint_tmp > 1) { changed = 1; load_waypoint_tmp--; HoTTBlink = 0;}; |
||
953 | if(HottKeyboard == HOTT_KEY_SET) { if(load_waypoint_tmp) ToNC_Load_WP_List = load_waypoint_tmp; changed = 0;} |
||
954 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;} |
||
955 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;}; |
||
956 | HottKeyboard = 0; |
||
957 | break; |
||
958 | default: line = 0; |
||
959 | break; |
||
960 | } |
||
961 | break; |
||
962 | case 5: |
||
963 | switch(line++) |
||
964 | { |
||
965 | static unsigned char wp_tmp, changed; |
||
966 | case 0: |
||
967 | HoTT_printfxy(0,0,"Store single Position"); |
||
968 | // HoTT_printfxy(0,1,"(Fixed Positions)"); |
||
969 | break; |
||
970 | case 1: |
||
971 | HoTT_printfxy(0,2," %2i.%1iV ",UBat/10, UBat%10) |
||
972 | HoTT_printfxy(0,3," %2i:%02i ",FlugSekunden/60,FlugSekunden%60); |
||
973 | // HoTT_printfxy(0,4,"Dist:%3dm",NaviData_TargetDistance) |
||
974 | break; |
||
975 | case 2: |
||
976 | HoTT_printfxy(11,2,"ALT:%4im", (int16_t)(HoehenWert/100)) |
||
977 | HoTT_printfxy(11,3,"DIR: %3d%c",CompassCorrected, HoTT_GRAD); |
||
978 | HoTT_printfxy(11,4,"Cam: %3i",Parameter_ServoNickControl); |
||
979 | break; |
||
980 | case 3: |
||
981 | case 4: |
||
982 | case 5: |
||
983 | HoTT_printfxy(0,6,"Store point:") |
||
984 | if(wp_tmp) |
||
985 | { |
||
986 | if(changed && HoTTBlink) HoTT_printfxy(13,6," ") |
||
987 | else HoTT_printfxy(13,6,"%2d ",wp_tmp); |
||
988 | } |
||
989 | else |
||
990 | { |
||
991 | HoTT_printfxy(13,6,"--") |
||
992 | } |
||
993 | |||
994 | if(GPSInfo.SatFix == SATFIX_3D) |
||
995 | { |
||
996 | if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,7,"No SD-Card ") |
||
997 | else |
||
998 | { |
||
999 | if(changed && wp_tmp) HoTT_printfxy(0,7,"(Set -> Store)") |
||
1000 | else Hott_ClearLine(7); |
||
1001 | } |
||
1002 | if(HottKeyboard == HOTT_KEY_SET) { if(wp_tmp) ToNC_Store_SingePoint = wp_tmp; changed = 0;} |
||
1003 | } |
||
1004 | else HoTT_printfxy(0,7,"!No GPS-Fix! "); |
||
1005 | |||
1006 | if(HottKeyboard == HOTT_KEY_UP && wp_tmp < NaviData_MaxWpListIndex) { changed = 1; wp_tmp++; HoTTBlink = 0;} |
||
1007 | if(HottKeyboard == HOTT_KEY_DOWN && wp_tmp > 1) { changed = 1; wp_tmp--; HoTTBlink = 0;}; |
||
1008 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;} |
||
1009 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;}; |
||
1010 | HottKeyboard = 0; |
||
1011 | break; |
||
1012 | default: line = 0; |
||
1013 | break; |
||
1014 | } |
||
1015 | break; |
||
1016 | case 6: |
||
1017 | switch(line++) |
||
1018 | { |
||
1019 | static unsigned char wp_tmp, changed; |
||
1020 | case 0: |
||
1021 | HoTT_printfxy(0,0,"Load single Position"); |
||
1022 | // HoTT_printfxy(0,1,"(Fixed Positions)"); |
||
1023 | break; |
||
1024 | case 1: |
||
1025 | HoTT_printfxy(0,2," %2i.%1iV ",UBat/10, UBat%10) |
||
1026 | HoTT_printfxy(0,3," %2i:%02i ",FlugSekunden/60,FlugSekunden%60); |
||
1027 | // HoTT_printfxy(0,4,"Dist:%3dm",NaviData_TargetDistance) |
||
1028 | if(NaviData_WaypointNumber) HoTT_printfxy(0,5,"WP:%2d/%d Dist:%3dm ",NaviData_WaypointIndex,NaviData_WaypointNumber,NaviData_TargetDistance) |
||
1029 | else Hott_ClearLine(5); |
||
1030 | break; |
||
1031 | case 2: |
||
1032 | if(FromNC_AltitudeSpeed) |
||
1033 | HoTT_printfxy(8,2,"ALT:%4i/%im ", (int16_t)(HoehenWert/100),(int16_t)(FromNC_AltitudeSetpoint/100)) |
||
1034 | else |
||
1035 | HoTT_printfxy(8,2,"ALT:%4im ",(int16_t)(HoehenWert/100)) |
||
1036 | |||
1037 | HoTT_printfxy(8,3,"DIR: %3d%c",CompassCorrected, HoTT_GRAD); |
||
1038 | HoTT_printfxy(8,4,"Cam: %3i",Parameter_ServoNickControl); |
||
1039 | break; |
||
1040 | // HoTT_printfxy(11,7,"%s",WPL_Name) |
||
1041 | case 3: |
||
1042 | case 4: |
||
1043 | case 5: |
||
1044 | if(HottKeyboard) DebugOut.Analog[17]++; |
||
1045 | HoTT_printfxy(0,6,"load point:") |
||
1046 | if(wp_tmp) |
||
1047 | { |
||
1048 | if(changed && HoTTBlink) HoTT_printfxy(11,6," ") |
||
1049 | else HoTT_printfxy(11,6,"%2d",wp_tmp); |
||
1050 | } |
||
1051 | else |
||
1052 | { |
||
1053 | HoTT_printfxy(11,6,"--") |
||
1054 | } |
||
1055 | |||
1056 | if(NaviData_MaxWpListIndex == 0) HoTT_printfxy(0,7,"No SD-Card ") |
||
1057 | else |
||
1058 | { |
||
1059 | if(changed && wp_tmp) HoTT_printfxy(0,7,"(Set -> Load)") |
||
1060 | else |
||
1061 | { |
||
1062 | Hott_ClearLine(7); |
||
1063 | if(NaviData_WaypointNumber) HoTT_printfxy(0,7,"%s",WPL_Name); |
||
1064 | } |
||
1065 | } |
||
1066 | if(HottKeyboard == HOTT_KEY_UP && wp_tmp < NaviData_MaxWpListIndex) { changed = 1; wp_tmp++; HoTTBlink = 0;} |
||
1067 | if(HottKeyboard == HOTT_KEY_DOWN && wp_tmp > 1) { changed = 1; wp_tmp--; HoTTBlink = 0;}; |
||
1068 | if(HottKeyboard == HOTT_KEY_SET) { if(wp_tmp) ToNC_Load_SingePoint = wp_tmp; changed = 0;} |
||
1069 | // if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page++; line = 0;} |
||
1070 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page--; line = 0;}; |
||
1071 | HottKeyboard = 0; |
||
1072 | break; |
||
1073 | default: line = 0; |
||
1074 | break; |
||
1075 | } |
||
1076 | break; |
||
1077 | default: page = 0; |
||
1078 | break; |
||
1079 | } |
||
1080 | } |
||
1081 | |||
1082 | #endif |
||
1083 | |||
1084 | |||
1085 |