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