Rev 2322 | Rev 2344 | Go to most recent revision | 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 | |||
1925 | holgerb | 59 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
60 | |||
1920 | holgerb | 61 | #define HoTT_printf(format, args...) { _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);} |
62 | #define HoTT_printfxy(x,y,format, args...) { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);} |
||
63 | #define HoTT_printfxy_INV(x,y,format, args...) { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);} |
||
64 | #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 | 65 | #define HoTT_printf_BLINK(format, args...) { _printf_P(&LIBFC_HoTT_Putchar_BLINK, PSTR(format) , ## args);} |
66 | #define HoTT_printf_INV(format, args...) { _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);} |
||
1917 | holgerb | 67 | |
1919 | holgerb | 68 | #define VOICE_MINIMALE_EINGANSSPANNUNG 16 |
69 | #define VOICE_BEEP 5 |
||
1920 | holgerb | 70 | #define HoTT_GRAD 96 |
71 | #define HoTT_LINKS 123 |
||
72 | #define HoTT_RECHTS 124 |
||
73 | #define HoTT_OBEN 125 |
||
74 | #define HoTT_UNTEN 126 |
||
1917 | holgerb | 75 | |
1949 | holgerb | 76 | #define HOTT_KEY_RIGHT 1 |
77 | #define HOTT_KEY_DOWN 2 |
||
78 | #define HOTT_KEY_UP 4 |
||
79 | #define HOTT_KEY_SET 6 |
||
80 | #define HOTT_KEY_LEFT 8 |
||
81 | |||
2322 | holgerb | 82 | #define VARIO_ZERO 30000 |
2178 | holgerb | 83 | unsigned char NaviData_WaypointIndex = 0, NaviData_WaypointNumber = 0, NaviData_TargetHoldTime = 0; |
84 | unsigned int NaviData_TargetDistance = 0; |
||
85 | |||
1943 | holgerb | 86 | GPSPacket_t GPSPacket; |
87 | VarioPacket_t VarioPacket; |
||
88 | ASCIIPacket_t ASCIIPacket; |
||
89 | ElectricAirPacket_t ElectricAirPacket; |
||
90 | HoTTGeneral_t HoTTGeneral; |
||
2090 | holgerb | 91 | unsigned char SpeakHoTT = SPEAK_MIKROKOPTER; |
2190 | holgerb | 92 | unsigned char ToNC_SpeakHoTT = 0; |
1944 | holgerb | 93 | int HoTTVarioMeter = 0; |
2090 | holgerb | 94 | const char PROGMEM MIKROKOPTER[] = {" MikroKopter "}; |
2120 | holgerb | 95 | const char PROGMEM UNDERVOLTAGE[] = {" !! LiPo voltage !! "}; |
1930 | holgerb | 96 | const char PROGMEM NC_ERROR_TEXT[MAX_ERR_NUMBER][17] = |
97 | { |
||
98 | //0123456789123456 |
||
99 | "No Error \0", // 0 |
||
100 | "Not compatible \0", // 1 |
||
101 | "MK3Mag not compa\0", // 2 |
||
102 | "No FC communicat\0", // 3 |
||
2188 | holgerb | 103 | "Compass communic\0", // 4 |
1930 | holgerb | 104 | "GPS communicatio\0", // 5 |
105 | "compass value \0", // 6 |
||
106 | "RC Signal lost \0", // 7 |
||
107 | "FC spi rx error \0", // 8 |
||
108 | "No NC communicat\0", // 9 |
||
109 | "FC Nick Gyro \0", // 10 |
||
110 | "FC Roll Gyro \0", // 11 |
||
111 | "FC Yaw Gyro \0", // 12 |
||
112 | "FC Nick ACC \0", // 13 |
||
113 | "FC Roll ACC \0", // 14 |
||
114 | "FC Z-ACC \0", // 15 |
||
115 | "Pressure sensor \0", // 16 |
||
1936 | holgerb | 116 | "I2C FC->BL-Ctrl \0", // 17 |
1930 | holgerb | 117 | "Bl Missing \0", // 18 |
118 | "Mixer Error \0", // 19 |
||
1937 | holgerb | 119 | "Carefree Error \0", // 20 |
1944 | holgerb | 120 | "GPS Fix lost \0", // 21 |
1948 | holgerb | 121 | "Magnet Error \0", // 22 |
122 | "Motor restart \0", // 23 |
||
2008 | holgerb | 123 | "BL Limitation \0", // 24 |
124 | "GPS Range \0", // 25 |
||
2009 | holgerb | 125 | "No SD-Card \0", // 26 |
126 | "SD-Logging error\0", // 27 |
||
2034 | holgerb | 127 | "Flying range! \0", // 28 |
2146 | holgerb | 128 | "Max Altitude! \0", // 29 |
2186 | holgerb | 129 | "No GPS fix \0", // 30 |
130 | "compass not cal.\0" // 31 |
||
1930 | holgerb | 131 | }; |
1919 | holgerb | 132 | |
2090 | holgerb | 133 | |
134 | const char PROGMEM HOTT_ERROR[MAX_ERR_NUMBER][2] = |
||
135 | { // 1 -> only in flight 0 -> also on ground |
||
136 | //0123456789123456 |
||
137 | {0,0},// "No Error \0", // 0 |
||
138 | {SPEAK_ERROR,0},// "Not compatible \0", // 1 |
||
139 | {SPEAK_ERROR,0},// "MK3Mag not compa\0", // 2 |
||
140 | {SPEAK_ERR_NAVI,1},// "No FC communicat\0", // 3 |
||
141 | {SPEAK_ERR_COMPASS,1},// "MK3Mag communica\0", // 4 |
||
142 | {SPEAK_ERR_GPS,0},// "GPS communicatio\0", // 5 |
||
143 | {SPEAK_ERR_COMPASS,1},// "compass value \0", // 6 |
||
144 | {SPEAK_ERR_RECEICER,0},// "RC Signal lost \0", // 7 |
||
145 | {SPEAK_ERR_NAVI,0},// "FC spi rx error \0", // 8 |
||
146 | {SPEAK_ERR_NAVI,0},// "No NC communicat\0", // 9 |
||
147 | {SPEAK_ERR_SENSOR,0},// "FC Nick Gyro \0", // 10 |
||
148 | {SPEAK_ERR_SENSOR,0},// "FC Roll Gyro \0", // 11 |
||
149 | {SPEAK_ERR_SENSOR,0},// "FC Yaw Gyro \0", // 12 |
||
150 | {SPEAK_ERR_SENSOR,0},// "FC Nick ACC \0", // 13 |
||
151 | {SPEAK_ERR_SENSOR,0},// "FC Roll ACC \0", // 14 |
||
152 | {SPEAK_ERR_SENSOR,0},// "FC Z-ACC \0", // 15 |
||
153 | {SPEAK_ERR_SENSOR,0},// "Pressure sensor \0", // 16 |
||
154 | {SPEAK_ERR_DATABUS,1},// "I2C FC->BL-Ctrl \0", // 17 |
||
155 | {SPEAK_ERR_DATABUS,1},// "Bl Missing \0", // 18 |
||
156 | {SPEAK_ERROR,0},// "Mixer Error \0", // 19 |
||
157 | {SPEAK_CF_OFF,1},// "Carefree Error \0", // 20 |
||
158 | {SPEAK_GPS_FIX,1},// "GPS Fix lost \0", // 21 |
||
159 | {SPEAK_ERR_COMPASS,0},// "Magnet Error \0", // 22 |
||
160 | {SPEAK_ERR_MOTOR,1},// "Motor restart \0", // 23 |
||
161 | {SPEAK_MAX_TEMPERAT,1},// "BL Limitation \0", // 24 |
||
162 | {SPEAK_MAX_RANGE,1},// "GPS Range \0", // 25 |
||
163 | {SPEAK_ERROR,1},// "No SD-Card \0", // 26 |
||
164 | {SPEAK_ERROR,1},// "SD-Logging error\0", // 27 |
||
165 | {SPEAK_MAX_RANGE,1},// "Flying range! \0", // 28 |
||
2146 | holgerb | 166 | {SPEAK_MAX_ALTITUD,1},// "Max Altitude! \0" // 29 |
167 | {SPEAK_GPS_FIX,1}// "no GPS Fix, // 30 |
||
2090 | holgerb | 168 | }; |
169 | |||
170 | |||
1943 | holgerb | 171 | unsigned char MaxBlTempertaure = 0; |
172 | unsigned char MinBlTempertaure = 0; |
||
173 | unsigned char HottestBl = 0; |
||
174 | |||
175 | void GetHottestBl(void) |
||
176 | { |
||
177 | static unsigned char search = 0,tmp_max,tmp_min,who; |
||
178 | if(Motor[search].Temperature > tmp_max) { tmp_max = Motor[search].Temperature; who = search;} |
||
179 | else |
||
180 | if(Motor[search].Temperature) if(Motor[search].Temperature < tmp_min) tmp_min = Motor[search].Temperature; |
||
181 | if(++search > MAX_MOTORS) |
||
182 | { |
||
183 | search = 0; |
||
184 | if(tmp_min != 255) MinBlTempertaure = tmp_min; else MinBlTempertaure = 0; |
||
185 | MaxBlTempertaure = tmp_max; |
||
186 | HottestBl = who; |
||
187 | tmp_min = 255; |
||
188 | tmp_max = 0; |
||
189 | who = 0; |
||
190 | } |
||
191 | } |
||
192 | |||
1919 | holgerb | 193 | //--------------------------------------------------------------- |
1917 | holgerb | 194 | void Hott_ClearLine(unsigned char line) |
195 | { |
||
196 | HoTT_printfxy(0,line," "); |
||
197 | } |
||
1919 | holgerb | 198 | //--------------------------------------------------------------- |
1917 | holgerb | 199 | |
2178 | holgerb | 200 | |
1919 | holgerb | 201 | unsigned char HoTT_Waring(void) |
202 | { |
||
2090 | holgerb | 203 | unsigned char status = 0; |
204 | static char old_status = 0; |
||
205 | static int repeat; |
||
2120 | holgerb | 206 | //if(Parameter_UserParam1) return(Parameter_UserParam1); |
2190 | holgerb | 207 | ToNC_SpeakHoTT = SpeakHoTT; |
2090 | holgerb | 208 | if(FC_StatusFlags & FC_STATUS_LOWBAT) status = VOICE_MINIMALE_EINGANSSPANNUNG; |
209 | else |
||
2263 | holgerb | 210 | if(NC_ErrorCode) // Fehlercodes |
2090 | holgerb | 211 | { |
212 | if(MotorenEin || !pgm_read_byte(&HOTT_ERROR[NC_ErrorCode][1])) status = pgm_read_byte(&HOTT_ERROR[NC_ErrorCode][0]); |
||
213 | } |
||
2263 | holgerb | 214 | if(!status) // Sprachansagen |
2091 | holgerb | 215 | { |
2263 | holgerb | 216 | // if(!(GetParamByte(PID_SPEAK_HOTT_CFG) & 0x01)) SpeakHoTT = 0; // is the voice wanted? |
217 | if(!(EE_Parameter.GlobalConfig3 & CFG3_SPEAK_ALL)) SpeakHoTT = 0; // is the voice wanted? |
||
2091 | holgerb | 218 | else status = SpeakHoTT; |
2190 | holgerb | 219 | } |
220 | else ToNC_SpeakHoTT = status; |
||
2090 | holgerb | 221 | |
2263 | holgerb | 222 | if(old_status == status) // Gleichen Fehler nur alle 5 sek bringen |
2090 | holgerb | 223 | { |
224 | if(!CheckDelay(repeat)) return(0); |
||
225 | repeat = SetDelay(5000); |
||
226 | } |
||
227 | else repeat = SetDelay(2000); |
||
228 | |||
229 | if(status) |
||
230 | { |
||
231 | if(status == SpeakHoTT) SpeakHoTT = 0; |
||
232 | } |
||
233 | old_status = status; |
||
2120 | holgerb | 234 | // DebugOut.Analog[16] = status; |
2090 | holgerb | 235 | return(status); |
1919 | holgerb | 236 | } |
237 | |||
2178 | holgerb | 238 | /* |
239 | unsigned char HoTTErrorCode(void) |
||
240 | { |
||
241 | return(NC_ErrorCode); |
||
242 | } |
||
243 | */ |
||
1919 | holgerb | 244 | //--------------------------------------------------------------- |
1942 | holgerb | 245 | void NC_Fills_HoTT_Telemety(void) |
1940 | holgerb | 246 | { |
2034 | holgerb | 247 | unsigned char *ptr = NULL; |
1940 | holgerb | 248 | unsigned char max = 0,i,z; |
249 | switch(FromNaviCtrl.Param.Byte[11]) |
||
250 | { |
||
251 | case HOTT_VARIO_PACKET_ID: |
||
252 | ptr = (unsigned char *) &VarioPacket; |
||
253 | max = sizeof(VarioPacket); |
||
254 | break; |
||
255 | case HOTT_GPS_PACKET_ID: |
||
256 | ptr = (unsigned char *) &GPSPacket; |
||
257 | max = sizeof(GPSPacket); |
||
258 | break; |
||
259 | case HOTT_ELECTRIC_AIR_PACKET_ID: |
||
260 | ptr = (unsigned char *) &ElectricAirPacket; |
||
261 | max = sizeof(ElectricAirPacket); |
||
262 | break; |
||
1943 | holgerb | 263 | case HOTT_GENERAL_PACKET_ID: |
264 | ptr = (unsigned char *) &HoTTGeneral; |
||
265 | max = sizeof(HoTTGeneral); |
||
266 | break; |
||
1940 | holgerb | 267 | } |
268 | z = FromNaviCtrl.Param.Byte[0]; // Data allocation |
||
269 | |||
270 | for(i=0; i < FromNaviCtrl.Param.Byte[1]; i++) |
||
271 | { |
||
272 | if(z >= max) break; |
||
273 | ptr[z] = FromNaviCtrl.Param.Byte[2+i]; |
||
274 | z++; |
||
275 | } |
||
276 | } |
||
277 | |||
1942 | holgerb | 278 | unsigned int BuildHoTT_Vario(void) |
279 | { |
||
2322 | holgerb | 280 | unsigned int tmp = VARIO_ZERO; |
1944 | holgerb | 281 | if(VarioCharacter == '+' || VarioCharacter == '-') |
282 | { |
||
2322 | holgerb | 283 | tmp = VARIO_ZERO + (AltitudeSetpointTrimming * EE_Parameter.Hoehe_Verstaerkung) / 3; |
284 | if(tmp < VARIO_ZERO && tmp > VARIO_ZERO - 50) tmp = VARIO_ZERO - 50; // weil es sonst erst bei < 0,5m/sek piept |
||
1944 | holgerb | 285 | } |
1942 | holgerb | 286 | else |
1944 | holgerb | 287 | if((VarioCharacter == ' ') && (FC_StatusFlags & FC_STATUS_FLY)) |
288 | { |
||
2322 | holgerb | 289 | tmp = VARIO_ZERO + HoTTVarioMeter; |
290 | if(tmp > VARIO_ZERO) |
||
1944 | holgerb | 291 | { |
2322 | holgerb | 292 | if(tmp < VARIO_ZERO + 100) tmp = VARIO_ZERO; |
1944 | holgerb | 293 | else tmp -= 100; |
294 | } |
||
2322 | holgerb | 295 | if(tmp < VARIO_ZERO) |
1944 | holgerb | 296 | { |
2322 | holgerb | 297 | if(tmp > VARIO_ZERO - 100) tmp = VARIO_ZERO; |
1944 | holgerb | 298 | else tmp += 100; |
299 | } |
||
300 | } |
||
301 | else |
||
2322 | holgerb | 302 | if(VarioCharacter == '^') tmp = VARIO_ZERO + FromNC_AltitudeSpeed * 10; |
1944 | holgerb | 303 | else |
2322 | holgerb | 304 | if(VarioCharacter == 'v') tmp = VARIO_ZERO - FromNC_AltitudeSpeed * 10; |
1942 | holgerb | 305 | return(tmp); |
306 | } |
||
307 | |||
1940 | holgerb | 308 | //--------------------------------------------------------------- |
1919 | holgerb | 309 | unsigned char HoTT_Telemety(unsigned char packet_request) |
310 | { |
||
2322 | holgerb | 311 | unsigned char i; |
2090 | holgerb | 312 | //Debug("rqst: %02X",packet_request); |
1919 | holgerb | 313 | switch(packet_request) |
314 | { |
||
315 | case HOTT_VARIO_PACKET_ID: |
||
2322 | holgerb | 316 | GPSPacket.WarnBeep = HoTT_Waring(); // Achtung: das ist richtig hier, damit der Varioton schon vorher abgestellt wird |
1921 | holgerb | 317 | VarioPacket.Altitude = HoehenWert/100 + 500; |
2322 | holgerb | 318 | if(!GPSPacket.WarnBeep) VarioPacket.m_sec = BuildHoTT_Vario(); else VarioPacket.m_sec = VARIO_ZERO; |
1943 | holgerb | 319 | VarioPacket.m_3sec = VarioPacket.m_sec; |
320 | VarioPacket.m_10sec = VarioPacket.m_sec; |
||
1919 | holgerb | 321 | if (VarioPacket.Altitude < VarioPacket.MinAltitude) VarioPacket.MinAltitude = VarioPacket.Altitude; |
322 | if (VarioPacket.Altitude > VarioPacket.MaxAltitude) VarioPacket.MaxAltitude = VarioPacket.Altitude; |
||
2090 | holgerb | 323 | VarioPacket.WarnBeep = 0;//HoTT_Waring(); |
1919 | holgerb | 324 | HoTT_DataPointer = (unsigned char *) &VarioPacket; |
2090 | holgerb | 325 | VarioPacket.FreeCharacters[0] = VarioCharacter; |
326 | if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) VarioPacket.FreeCharacters[1] = 'C'; else VarioPacket.FreeCharacters[1] = ' '; |
||
327 | // VarioPacket.FreeCharacters[2] = ' '; |
||
328 | if(NC_ErrorCode) |
||
329 | { |
||
330 | VarioPacket.Text[0] = NC_ErrorCode/10 + '0'; |
||
331 | VarioPacket.Text[1] = NC_ErrorCode%10 + '0'; |
||
332 | VarioPacket.Text[2] = ':'; |
||
2183 | holgerb | 333 | for(i=0; i<16;i++) VarioPacket.Text[i+3] = pgm_read_byte(&NC_ERROR_TEXT[NC_ErrorCode][i]); |
2090 | holgerb | 334 | } |
2120 | holgerb | 335 | else |
336 | if(FC_StatusFlags & FC_STATUS_LOWBAT) for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&UNDERVOLTAGE[i]); // no Error |
||
337 | else |
||
2178 | holgerb | 338 | if(NaviData_WaypointNumber) |
339 | { |
||
340 | unsigned int tmp_int; |
||
341 | unsigned char tmp; |
||
342 | VarioPacket.Text[0] = 'W'; VarioPacket.Text[1] = 'P'; |
||
343 | VarioPacket.Text[2] = ' '; |
||
344 | VarioPacket.Text[3] = '0'+(NaviData_WaypointIndex) / 10; |
||
345 | VarioPacket.Text[4] = '0'+(NaviData_WaypointIndex) % 10; |
||
346 | VarioPacket.Text[5] = '/'; |
||
347 | VarioPacket.Text[6] = '0'+(NaviData_WaypointNumber) / 10; |
||
348 | VarioPacket.Text[7] = '0'+(NaviData_WaypointNumber) % 10; |
||
349 | VarioPacket.Text[8] = ' '; |
||
350 | tmp_int = NaviData_TargetDistance; |
||
351 | if(tmp_int > 1000) { VarioPacket.Text[9] = '0'+(tmp_int) / 1000; tmp_int %= 1000;} |
||
352 | else VarioPacket.Text[9] = ' '; |
||
353 | if(tmp_int > 100) { VarioPacket.Text[10] = '0'+(tmp_int) / 100; tmp_int %= 100;} |
||
354 | else VarioPacket.Text[10] = ' '; |
||
355 | VarioPacket.Text[11] = '0'+(tmp_int) / 10; |
||
356 | VarioPacket.Text[12] = '0'+(tmp_int) % 10; |
||
357 | VarioPacket.Text[13] = 'm'; |
||
358 | VarioPacket.Text[14] = ' '; |
||
359 | tmp = NaviData_TargetHoldTime; |
||
360 | if(tmp > 100) { VarioPacket.Text[15] = '0'+(tmp) / 100; tmp %= 100;} else VarioPacket.Text[15] = ' '; |
||
361 | VarioPacket.Text[16] = '0'+(tmp) / 10; |
||
362 | VarioPacket.Text[17] = '0'+(tmp) % 10; |
||
363 | VarioPacket.Text[18] = 's'; |
||
364 | VarioPacket.Text[19] = ' '; |
||
365 | //unsigned char NaviData_WaypointIndex = 0, NaviData_WaypointNumber = 0, NaviData_TargetHoldTime = 0; |
||
366 | //unsigned int NaviData_TargetDistance = 0; |
||
367 | } |
||
368 | else |
||
2120 | holgerb | 369 | for(i=0; i<21;i++) VarioPacket.Text[i] = pgm_read_byte(&MIKROKOPTER[i]); // no Error |
1919 | holgerb | 370 | return(sizeof(VarioPacket)); |
371 | break; |
||
1921 | holgerb | 372 | |
1919 | holgerb | 373 | case HOTT_GPS_PACKET_ID: |
2186 | holgerb | 374 | GPSPacket.Altitude = HoehenWert/100 + 500; |
1943 | holgerb | 375 | // GPSPacket.Distance = GPSInfo.HomeDistance/10; // macht die NC |
376 | // GPSPacket.Heading = GPSInfo.HomeBearing/2; // macht die NC |
||
377 | // GPSPacket.Speed = (GPSInfo.Speed * 36) / 10; // macht die NC |
||
2322 | holgerb | 378 | // GPSPacket.WarnBeep = HoTT_Waring(); //(wird jetzt weiter oben gemacht) |
379 | if(!GPSPacket.WarnBeep) GPSPacket.m_sec = BuildHoTT_Vario(); else GPSPacket.m_sec = VARIO_ZERO; |
||
1921 | holgerb | 380 | GPSPacket.m_3sec = 120; |
2090 | holgerb | 381 | GPSPacket.NumOfSats = GPSInfo.NumOfSats; |
382 | if(GPSInfo.Flags & FLAG_DIFFSOLN) GPSPacket.SatFix = 'D'; |
||
383 | else |
||
384 | if(GPSInfo.SatFix == SATFIX_3D) GPSPacket.SatFix = ' '; |
||
385 | else GPSPacket.SatFix = '!'; |
||
1919 | holgerb | 386 | HoTT_DataPointer = (unsigned char *) &GPSPacket; |
2090 | holgerb | 387 | GPSPacket.FreeCharacters[0] = NC_GPS_ModeCharacter; |
388 | GPSPacket.FreeCharacters[2] = GPSPacket.SatFix; |
||
389 | GPSPacket.HomeDirection = GPSInfo.HomeBearing / 2;//230; |
||
1919 | holgerb | 390 | return(sizeof(GPSPacket)); |
391 | break; |
||
392 | case HOTT_ELECTRIC_AIR_PACKET_ID: |
||
1943 | holgerb | 393 | GetHottestBl(); |
1940 | holgerb | 394 | ElectricAirPacket.Altitude = HoehenWert/100 + 500; |
1921 | holgerb | 395 | ElectricAirPacket.Battery1 = UBat; |
1940 | holgerb | 396 | ElectricAirPacket.Battery2 = UBat; |
1943 | holgerb | 397 | ElectricAirPacket.VoltageCell1 = ErsatzKompassInGrad / 2; |
398 | ElectricAirPacket.VoltageCell8 = ElectricAirPacket.VoltageCell1; |
||
1944 | holgerb | 399 | ElectricAirPacket.VoltageCell6 = GPSInfo.HomeBearing / 2; |
1943 | holgerb | 400 | ElectricAirPacket.VoltageCell7 = GPSInfo.HomeDistance/20; |
1944 | holgerb | 401 | ElectricAirPacket.VoltageCell13 = ElectricAirPacket.VoltageCell6; |
1943 | holgerb | 402 | ElectricAirPacket.VoltageCell14 = ElectricAirPacket.VoltageCell7; |
2322 | holgerb | 403 | if(!GPSPacket.WarnBeep) ElectricAirPacket.m_sec = BuildHoTT_Vario(); else ElectricAirPacket.m_sec = VARIO_ZERO; |
1940 | holgerb | 404 | ElectricAirPacket.m_3sec = 120; |
405 | ElectricAirPacket.InputVoltage = UBat; |
||
1943 | holgerb | 406 | ElectricAirPacket.Temperature1 = MinBlTempertaure + 20; |
407 | ElectricAirPacket.Temperature2 = MaxBlTempertaure + 20; |
||
1940 | holgerb | 408 | ElectricAirPacket.Capacity = Capacity.UsedCapacity/10; |
2090 | holgerb | 409 | ElectricAirPacket.WarnBeep = 0;//HoTT_Waring(); |
1940 | holgerb | 410 | ElectricAirPacket.Current = Capacity.ActualCurrent; |
1919 | holgerb | 411 | HoTT_DataPointer = (unsigned char *) &ElectricAirPacket; |
2090 | holgerb | 412 | ElectricAirPacket.FlightTimeMinutes = FlugSekunden / 60; |
413 | ElectricAirPacket.FlightTimeSeconds = FlugSekunden % 60; |
||
1919 | holgerb | 414 | return(sizeof(ElectricAirPacket)); |
415 | break; |
||
1943 | holgerb | 416 | case HOTT_GENERAL_PACKET_ID: |
417 | GetHottestBl(); |
||
418 | HoTTGeneral.Rpm = GPSInfo.HomeDistance/100; |
||
419 | HoTTGeneral.VoltageCell1 = ErsatzKompassInGrad / 2; |
||
1944 | holgerb | 420 | HoTTGeneral.VoltageCell6 = GPSInfo.HomeBearing / 2; |
1943 | holgerb | 421 | if(UBat > BattLowVoltageWarning + 5) HoTTGeneral.FuelPercent = (UBat - (BattLowVoltageWarning + 6)) * 3; |
422 | else HoTTGeneral.FuelPercent = 0; |
||
1944 | holgerb | 423 | HoTTGeneral.FuelCapacity = HoehenWert/100; |
424 | if(HoTTGeneral.FuelCapacity < 0) HoTTGeneral.FuelCapacity = 0; |
||
1943 | holgerb | 425 | HoTTGeneral.Altitude = HoehenWert/100 + 500; |
426 | HoTTGeneral.Battery1 = UBat; |
||
427 | HoTTGeneral.Battery2 = UBat; |
||
2322 | holgerb | 428 | if(!GPSPacket.WarnBeep) HoTTGeneral.m_sec = BuildHoTT_Vario(); else HoTTGeneral.m_sec = VARIO_ZERO; |
1943 | holgerb | 429 | HoTTGeneral.m_3sec = 120; |
430 | HoTTGeneral.InputVoltage = UBat; |
||
431 | HoTTGeneral.Temperature1 = MinBlTempertaure + 20; |
||
432 | HoTTGeneral.Temperature2 = MaxBlTempertaure + 20; |
||
433 | HoTTGeneral.Capacity = Capacity.UsedCapacity/10; |
||
2090 | holgerb | 434 | HoTTGeneral.WarnBeep = 0;//HoTT_Waring(); |
1943 | holgerb | 435 | HoTTGeneral.Current = Capacity.ActualCurrent; |
2178 | holgerb | 436 | //HoTTGeneral.ErrorNumber = HoTTErrorCode(); |
1943 | holgerb | 437 | HoTT_DataPointer = (unsigned char *) &HoTTGeneral; |
438 | return(sizeof(HoTTGeneral)); |
||
439 | break; |
||
1919 | holgerb | 440 | default: return(0); |
441 | } |
||
442 | } |
||
443 | |||
444 | //--------------------------------------------------------------- |
||
1917 | holgerb | 445 | void HoTT_Menu(void) |
446 | { |
||
1982 | holgerb | 447 | static unsigned char line, page = 0,show_current = 0,show_mag = 0, show_poti = 0; |
1921 | holgerb | 448 | unsigned char tmp; |
1944 | holgerb | 449 | HoTTVarioMeter = (HoTTVarioMeter * 7 + VarioMeter) / 8; |
450 | |||
1921 | holgerb | 451 | if(page == 0) |
1933 | holgerb | 452 | switch(line++) |
1917 | holgerb | 453 | { |
1919 | holgerb | 454 | case 0: |
1923 | holgerb | 455 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
1939 | holgerb | 456 | HoTT_printfxy_BLINK(0,0," %2i.%1iV ",UBat/10, UBat%10) |
457 | else |
||
458 | HoTT_printfxy(0,0," %2i.%1iV ",UBat/10, UBat%10) |
||
459 | |||
460 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
||
461 | { |
||
462 | if(HoehenReglerAktiv) HoTT_printfxy_INV(10,0,"ALT:%4im %c", (int16_t)(HoehenWert/100),VarioCharacter) |
||
463 | else HoTT_printfxy(10,0,"ALT:%4im ", (int16_t)(HoehenWert/100)) |
||
464 | } |
||
465 | else HoTT_printfxy(10,0,"ALT:---- "); |
||
466 | break; |
||
467 | case 1: |
||
468 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
469 | HoTT_printfxy_BLINK(0,1," %2i:%02i ",FlugSekunden/60,FlugSekunden%60) |
||
470 | else HoTT_printfxy(0,1," %2i:%02i ",FlugSekunden/60,FlugSekunden%60); |
||
1941 | holgerb | 471 | HoTT_printfxy(10,1,"DIR: %3d%c",ErsatzKompassInGrad, HoTT_GRAD); |
1949 | holgerb | 472 | if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(20,1,"C") else HoTT_printfxy(20,1," "); |
1939 | holgerb | 473 | break; |
474 | case 2: |
||
475 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
476 | HoTT_printfxy_BLINK(0,2," %5i ",Capacity.UsedCapacity) |
||
477 | else HoTT_printfxy(0,2," %5i ",Capacity.UsedCapacity); |
||
1940 | holgerb | 478 | HoTT_printfxy(12,2,"I:%2i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
1939 | holgerb | 479 | break; |
480 | case 3: |
||
2072 | holgerb | 481 | HoTT_printfxy(9,0,":"); |
482 | HoTT_printfxy(9,1,":"); |
||
483 | HoTT_printfxy(9,2,":"); |
||
1939 | holgerb | 484 | HoTT_printfxy(0,3,"---------+-----------"); |
2072 | holgerb | 485 | |
486 | // HoTT_printfxy(0,3,"---------------------"); |
||
1939 | holgerb | 487 | HoTT_printfxy(0,6,"---------------------"); |
488 | break; |
||
489 | case 4: |
||
490 | if(NaviDataOkay) |
||
491 | { |
||
2072 | holgerb | 492 | HoTT_printfxy(9,4,":"); |
1939 | holgerb | 493 | HoTT_printfxy(0,4,"SAT:%2d ",GPSInfo.NumOfSats); |
494 | HoTT_printfxy(10,4,"DIST:%3dm",GPSInfo.HomeDistance/10); |
||
495 | switch (GPSInfo.SatFix) |
||
496 | { |
||
497 | case SATFIX_3D: |
||
498 | if(GPSInfo.Flags & FLAG_DIFFSOLN) HoTT_printfxy(7,4,"D ") |
||
499 | else HoTT_printfxy(7,4,"3D"); |
||
500 | break; |
||
501 | default: |
||
1943 | holgerb | 502 | HoTT_printfxy_BLINK(7,4,"!!"); |
1939 | holgerb | 503 | break; |
504 | } |
||
505 | } |
||
506 | else |
||
1944 | holgerb | 507 | { |
1940 | holgerb | 508 | Hott_ClearLine(4); |
1939 | holgerb | 509 | } |
510 | break; |
||
511 | case 5: |
||
512 | if(NaviDataOkay) |
||
513 | { |
||
1972 | holgerb | 514 | if(show_mag) |
515 | { |
||
516 | HoTT_printfxy(0,5,"MAG:%3u%% ",EarthMagneticField); |
||
1939 | holgerb | 517 | HoTT_printfxy(12,5,"HM:%3d%c %c", GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter); |
1972 | holgerb | 518 | HoTT_printfxy(9,5,"incl:%2d%c(%2i)",EarthMagneticInclination, HoTT_GRAD,EarthMagneticInclinationTheoretic); |
519 | } |
||
520 | else |
||
521 | { |
||
2072 | holgerb | 522 | HoTT_printfxy(0,5," %2um/s: HM:%3d%c %c",GPSInfo.Speed, GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter); |
1972 | holgerb | 523 | } |
1939 | holgerb | 524 | } |
1940 | holgerb | 525 | else Hott_ClearLine(5); |
1939 | holgerb | 526 | break; |
527 | case 6: |
||
528 | break; |
||
529 | case 7: if(NC_ErrorCode) |
||
530 | { |
||
531 | if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER) |
||
532 | { |
||
533 | Hott_ClearLine(7); |
||
534 | HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode); |
||
535 | } |
||
536 | else |
||
537 | { |
||
538 | HoTT_printfxy(0,7,"ERR: "); _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);}; |
||
539 | } |
||
2120 | holgerb | 540 | else |
541 | if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy(1,7,"!! LiPo voltage !!") |
||
1939 | holgerb | 542 | else HoTT_printfxy(0,7," www.MikroKopter.de "); |
543 | break; |
||
2090 | holgerb | 544 | case 8: //ASCIIPacket.WarnBeep = HoTT_Waring(); |
1939 | holgerb | 545 | // ASCIIPacket.WarnBeep = Parameter_UserParam1; |
546 | case 9: |
||
547 | case 10: |
||
548 | case 11: |
||
549 | case 12: |
||
550 | case 13: |
||
551 | case 14: |
||
552 | case 15: |
||
553 | case 16: |
||
1972 | holgerb | 554 | if(HottKeyboard == HOTT_KEY_SET) { if(show_mag) show_mag = 0; else show_mag = 1;} |
555 | else |
||
1949 | holgerb | 556 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 1; line = 0;}; |
1939 | holgerb | 557 | HottKeyboard = 0; |
558 | break; |
||
559 | default: line = 0; |
||
560 | break; |
||
561 | } |
||
562 | else |
||
563 | if(page == 1) |
||
564 | switch(line++) |
||
565 | { |
||
566 | case 0: |
||
567 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
1923 | holgerb | 568 | HoTT_printfxy_BLINK(0,0," %2i:%02i %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity) |
569 | else HoTT_printfxy(0,0," %2i:%02i %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity); |
||
1917 | holgerb | 570 | break; |
571 | case 1: |
||
1921 | holgerb | 572 | HoTT_printfxy(0,1,"DIR:%3d%c",KompassValue, HoTT_GRAD); |
1917 | holgerb | 573 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
1920 | holgerb | 574 | { |
575 | if(HoehenReglerAktiv) HoTT_printfxy_INV(10,1,"ALT:%4im", (int16_t)(HoehenWert/100)) |
||
576 | else HoTT_printfxy(10,1,"ALT:%4im", (int16_t)(HoehenWert/100)) |
||
577 | } |
||
578 | else HoTT_printfxy(10,1,"ALT:---- "); |
||
579 | HoTT_printfxy(20,1,"%c",VarioCharacter); |
||
1917 | holgerb | 580 | break; |
581 | case 2: |
||
582 | if(NaviDataOkay) |
||
583 | { |
||
1923 | holgerb | 584 | HoTT_printfxy(1,2,"HM:%3d%c DIST:%3dm %c", GPSInfo.HomeBearing, HoTT_GRAD, GPSInfo.HomeDistance/10, NC_GPS_ModeCharacter); |
1917 | holgerb | 585 | } |
586 | else |
||
587 | { |
||
1923 | holgerb | 588 | Hott_ClearLine(2); |
1917 | holgerb | 589 | } |
590 | break; |
||
1923 | holgerb | 591 | case 3: |
592 | HoTT_printfxy(0,3,"PWR:%2i.%1iA (%iW) ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10,Capacity.ActualPower); |
||
1949 | holgerb | 593 | if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(19,3,"CF") else HoTT_printfxy(19,3," "); |
1923 | holgerb | 594 | break; |
1917 | holgerb | 595 | case 4: |
596 | if(NaviDataOkay) |
||
597 | { |
||
1919 | holgerb | 598 | HoTT_printfxy(0,4,"GPS:%2um/s SAT:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
1917 | holgerb | 599 | switch (GPSInfo.SatFix) |
600 | { |
||
601 | case SATFIX_3D: |
||
602 | HoTT_printfxy(16,4," 3D "); |
||
603 | break; |
||
1925 | holgerb | 604 | //case SATFIX_2D: |
605 | //case SATFIX_NONE: |
||
1917 | holgerb | 606 | default: |
1925 | holgerb | 607 | HoTT_printfxy_BLINK(16,4,"NOFIX"); |
1917 | holgerb | 608 | break; |
609 | } |
||
610 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
||
611 | { |
||
612 | HoTT_printfxy(16,4,"DGPS "); |
||
613 | } |
||
614 | } |
||
615 | else |
||
616 | { //012345678901234567890 |
||
1930 | holgerb | 617 | HoTT_printfxy(0,4," No NaviCtrl "); |
1917 | holgerb | 618 | } |
619 | break; |
||
620 | case 5: |
||
1949 | holgerb | 621 | if(show_current) |
622 | { |
||
623 | 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); |
||
624 | } |
||
625 | else |
||
626 | { |
||
627 | HoTT_printfxy(0,5,"%3i %3i %3i %3i%cC", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature,HoTT_GRAD); |
||
628 | } |
||
1917 | holgerb | 629 | break; |
630 | case 6: |
||
1949 | holgerb | 631 | if(show_current) |
632 | { |
||
1917 | holgerb | 633 | if(RequiredMotors == 4) Hott_ClearLine(6); |
634 | else |
||
1949 | holgerb | 635 | 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) |
636 | else |
||
637 | 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); |
||
638 | } |
||
639 | else |
||
640 | { |
||
641 | if(RequiredMotors == 4) Hott_ClearLine(6); |
||
642 | else |
||
1923 | holgerb | 643 | if(RequiredMotors == 6) HoTT_printfxy(0,6,"%3i %3i%cC ", Motor[4].Temperature, Motor[5].Temperature,HoTT_GRAD) |
1917 | holgerb | 644 | else |
1923 | holgerb | 645 | 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 | 646 | } |
1917 | holgerb | 647 | break; |
1930 | holgerb | 648 | case 7: if(NC_ErrorCode) |
649 | { |
||
650 | if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER) |
||
651 | { |
||
652 | Hott_ClearLine(7); |
||
653 | HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode); |
||
654 | } |
||
655 | else |
||
656 | { |
||
657 | HoTT_printfxy(0,7,"ERR: "); _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);}; |
||
658 | } |
||
2120 | holgerb | 659 | else |
660 | if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy(1,7,"!! LiPo voltage !!") |
||
1937 | holgerb | 661 | else HoTT_printfxy(0,7," www.MikroKopter.de "); |
1917 | holgerb | 662 | break; |
2090 | holgerb | 663 | case 8: // ASCIIPacket.WarnBeep = HoTT_Waring(); |
1919 | holgerb | 664 | // ASCIIPacket.WarnBeep = Parameter_UserParam1; |
1921 | holgerb | 665 | case 9: |
1917 | holgerb | 666 | case 10: |
667 | case 11: |
||
668 | case 12: |
||
669 | case 13: |
||
1919 | holgerb | 670 | case 14: |
671 | case 15: |
||
672 | case 16: |
||
1949 | holgerb | 673 | if(HottKeyboard == HOTT_KEY_SET) { if(show_current) show_current = 0; else show_current = 1; Hott_ClearLine(5); Hott_ClearLine(6);} |
674 | else |
||
675 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 2; line = 0;} |
||
676 | else |
||
677 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 0; line = 0;} |
||
678 | //if(HottKeyboard) HoTT_printfxy(15,6,"%KEY:%02x ",HottKeyboard); |
||
1921 | holgerb | 679 | HottKeyboard = 0; |
680 | break; |
||
1933 | holgerb | 681 | default: line = 0; |
1921 | holgerb | 682 | break; |
683 | } |
||
684 | else |
||
1939 | holgerb | 685 | if(page == 2) |
1933 | holgerb | 686 | switch(line++) |
1921 | holgerb | 687 | { |
688 | case 0: |
||
689 | HoTT_printfxy_INV(0,0,"Setting:%u %s ",GetActiveParamSet(),EE_Parameter.Name); |
||
690 | break; |
||
691 | case 1: HoTT_printfxy(0,1,"Min:%2i.%1iV %s ",BattLowVoltageWarning/10, BattLowVoltageWarning%10, Mixer.Name); |
||
692 | break; |
||
1923 | holgerb | 693 | case 2: HoTT_printfxy(0,2,"ALT:"); |
1921 | holgerb | 694 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
695 | { |
||
696 | if(!(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER)) HoTT_printf("POTI:%3u ", Parameter_HoehenSchalter) |
||
697 | else |
||
698 | { |
||
699 | if(Parameter_HoehenSchalter > 50) HoTT_printf("(ON) ") else HoTT_printf("(OFF) "); |
||
700 | if((Parameter_ExtraConfig & CFG2_HEIGHT_LIMIT)) HoTT_printf("LIMIT", Parameter_HoehenSchalter) |
||
701 | else HoTT_printf("VARIO", Parameter_HoehenSchalter); |
||
702 | } |
||
703 | } |
||
704 | else |
||
705 | HoTT_printf("DISABLED"); |
||
706 | break; |
||
1923 | holgerb | 707 | case 3: HoTT_printfxy(0,3,"CF:"); |
2342 | holgerb | 708 | if(!EE_Parameter.CareFreeChannel) HoTT_printf("DISABLED") |
1921 | holgerb | 709 | else |
710 | { |
||
711 | if(CareFree) HoTT_printf(" (ON) ") else HoTT_printf(" (OFF)"); |
||
712 | if(EE_Parameter.ExtraConfig & CFG_LEARNABLE_CAREFREE) HoTT_printf(" TEACH"); |
||
713 | } |
||
714 | break; |
||
1923 | holgerb | 715 | case 4: HoTT_printfxy(0,4,"GPS:"); |
716 | if(!(Parameter_GlobalConfig & CFG_GPS_AKTIV)) HoTT_printf("DISABLED") |
||
717 | else |
||
718 | { |
||
2342 | holgerb | 719 | tmp = GetChannelValue(EE_Parameter.NaviGpsModeChannel); |
1923 | holgerb | 720 | if(tmp < 50) HoTT_printf("(FREE)") |
721 | else |
||
722 | if(tmp >= 180) HoTT_printf("(HOME)") |
||
723 | else |
||
724 | if(EE_Parameter.ExtraConfig & CFG_GPS_AID) HoTT_printf("(AID) ") |
||
725 | else HoTT_printf("(HOLD)") |
||
726 | } |
||
727 | if(EE_Parameter.FailSafeTime) HoTT_printfxy(10,4," FS:%usek ",EE_Parameter.FailSafeTime) |
||
728 | |||
729 | break; |
||
730 | case 5: HoTT_printfxy(0,5,"HOME ALT:"); |
||
731 | if(EE_Parameter.ComingHomeAltitude) HoTT_printf("%um",EE_Parameter.ComingHomeAltitude) else HoTT_printf("HOLD "); |
||
732 | break; |
||
1921 | holgerb | 733 | case 6: |
1982 | holgerb | 734 | if(!show_poti) |
735 | { |
||
736 | 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); |
||
737 | HoTT_printfxy(0,7,"Gs:%4i Ya:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]]+127,PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]); |
||
738 | } |
||
739 | else |
||
740 | { |
||
741 | HoTT_printfxy(0,6,"P1:%4i P2:%4i 3:%3i",Poti1,Poti2, Poti3); |
||
742 | HoTT_printfxy(0,7,"P4:%4i P5:%4i 6:%3i",Poti4,Poti5, Poti6); |
||
743 | } |
||
744 | |||
1921 | holgerb | 745 | break; |
746 | case 7: //HoTT_printfxy(0,6,"WARNINGS:"); |
||
747 | if(HoTTBlink) |
||
748 | { |
||
749 | LIBFC_HoTT_SetPos(6 * 21); |
||
750 | if(!(Parameter_GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV)) HoTT_printf_BLINK("COUPLING OFF! "); |
||
751 | if(EE_Parameter.BitConfig & (CFG_LOOP_LINKS | CFG_LOOP_RECHTS | CFG_LOOP_UNTEN | CFG_LOOP_OBEN)) HoTT_printf_BLINK("LOOPING! "); |
||
752 | if(Parameter_GlobalConfig & CFG_HEADING_HOLD) HoTT_printf_BLINK("HH! "); |
||
753 | if(!(Parameter_GlobalConfig & CFG_KOMPASS_AKTIV)) HoTT_printf_BLINK("COMPASS OFF! "); |
||
754 | } |
||
755 | break; |
||
2090 | holgerb | 756 | case 8: //ASCIIPacket.WarnBeep = HoTT_Waring(); |
1921 | holgerb | 757 | break; |
758 | case 9: |
||
759 | case 10: |
||
760 | case 11: |
||
761 | case 12: |
||
762 | case 13: |
||
763 | case 14: |
||
764 | case 15: |
||
765 | case 16: |
||
1982 | holgerb | 766 | if(HottKeyboard == HOTT_KEY_SET) { if(show_poti) show_poti = 0; else show_poti = 1; Hott_ClearLine(6); Hott_ClearLine(7);} |
2263 | holgerb | 767 | // else |
768 | // if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 3; line = 0;} |
||
1982 | holgerb | 769 | else |
1949 | holgerb | 770 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 1; line = 0;}; |
1921 | holgerb | 771 | HottKeyboard = 0; |
772 | break; |
||
1933 | holgerb | 773 | default: line = 0; |
1917 | holgerb | 774 | break; |
775 | } |
||
2263 | holgerb | 776 | /* else |
2091 | holgerb | 777 | if(page == 3) |
778 | switch(line++) |
||
779 | { |
||
780 | case 0: |
||
781 | HoTT_printfxy(0,2,"Speak:"); |
||
782 | break; |
||
783 | case 1: |
||
2263 | holgerb | 784 | // if(GetParamByte(PID_SPEAK_HOTT_CFG) & 0x01) |
785 | if(!(GlobalConfig3 & CFG3_SPEAK_ALL) & 0x01)) HoTT_printfxy_INV(7,2,"All Messages ") |
||
2091 | holgerb | 786 | else HoTT_printfxy_INV(7,2,"Warnings only"); |
787 | break; |
||
788 | case 2: |
||
789 | HoTT_printfxy(1,4,"Use (set) to select"); |
||
790 | break; |
||
791 | default: |
||
792 | if(HottKeyboard == HOTT_KEY_SET) |
||
793 | { |
||
794 | SetParamByte(PID_SPEAK_HOTT_CFG, GetParamByte(PID_SPEAK_HOTT_CFG) ^ 0x01); |
||
795 | } |
||
796 | else |
||
797 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 2; line = 0;}; |
||
798 | HottKeyboard = 0; |
||
799 | line = 0; |
||
800 | break; |
||
801 | } |
||
2263 | holgerb | 802 | */ |
1921 | holgerb | 803 | else page = 0; |
1917 | holgerb | 804 | } |
805 | |||
1925 | holgerb | 806 | #endif |
1917 | holgerb | 807 | |
808 | |||
809 |