Rev 2081 | 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 | |||
1943 | holgerb | 82 | GPSPacket_t GPSPacket; |
83 | VarioPacket_t VarioPacket; |
||
84 | ASCIIPacket_t ASCIIPacket; |
||
85 | ElectricAirPacket_t ElectricAirPacket; |
||
86 | HoTTGeneral_t HoTTGeneral; |
||
1944 | holgerb | 87 | int HoTTVarioMeter = 0; |
1943 | holgerb | 88 | |
1930 | holgerb | 89 | const char PROGMEM NC_ERROR_TEXT[MAX_ERR_NUMBER][17] = |
90 | { |
||
91 | //0123456789123456 |
||
92 | "No Error \0", // 0 |
||
93 | "Not compatible \0", // 1 |
||
94 | "MK3Mag not compa\0", // 2 |
||
95 | "No FC communicat\0", // 3 |
||
96 | "MK3Mag communica\0", // 4 |
||
97 | "GPS communicatio\0", // 5 |
||
98 | "compass value \0", // 6 |
||
99 | "RC Signal lost \0", // 7 |
||
100 | "FC spi rx error \0", // 8 |
||
101 | "No NC communicat\0", // 9 |
||
102 | "FC Nick Gyro \0", // 10 |
||
103 | "FC Roll Gyro \0", // 11 |
||
104 | "FC Yaw Gyro \0", // 12 |
||
105 | "FC Nick ACC \0", // 13 |
||
106 | "FC Roll ACC \0", // 14 |
||
107 | "FC Z-ACC \0", // 15 |
||
108 | "Pressure sensor \0", // 16 |
||
1936 | holgerb | 109 | "I2C FC->BL-Ctrl \0", // 17 |
1930 | holgerb | 110 | "Bl Missing \0", // 18 |
111 | "Mixer Error \0", // 19 |
||
1937 | holgerb | 112 | "Carefree Error \0", // 20 |
1944 | holgerb | 113 | "GPS Fix lost \0", // 21 |
1948 | holgerb | 114 | "Magnet Error \0", // 22 |
115 | "Motor restart \0", // 23 |
||
2008 | holgerb | 116 | "BL Limitation \0", // 24 |
117 | "GPS Range \0", // 25 |
||
2009 | holgerb | 118 | "No SD-Card \0", // 26 |
119 | "SD-Logging error\0", // 27 |
||
2034 | holgerb | 120 | "Flying range! \0", // 28 |
121 | "Max Altitude! \0" // 29 |
||
1930 | holgerb | 122 | }; |
1919 | holgerb | 123 | |
1943 | holgerb | 124 | unsigned char MaxBlTempertaure = 0; |
125 | unsigned char MinBlTempertaure = 0; |
||
126 | unsigned char HottestBl = 0; |
||
127 | |||
128 | void GetHottestBl(void) |
||
129 | { |
||
130 | static unsigned char search = 0,tmp_max,tmp_min,who; |
||
131 | if(Motor[search].Temperature > tmp_max) { tmp_max = Motor[search].Temperature; who = search;} |
||
132 | else |
||
133 | if(Motor[search].Temperature) if(Motor[search].Temperature < tmp_min) tmp_min = Motor[search].Temperature; |
||
134 | if(++search > MAX_MOTORS) |
||
135 | { |
||
136 | search = 0; |
||
137 | if(tmp_min != 255) MinBlTempertaure = tmp_min; else MinBlTempertaure = 0; |
||
138 | MaxBlTempertaure = tmp_max; |
||
139 | HottestBl = who; |
||
140 | tmp_min = 255; |
||
141 | tmp_max = 0; |
||
142 | who = 0; |
||
143 | } |
||
144 | } |
||
145 | |||
1919 | holgerb | 146 | //--------------------------------------------------------------- |
1917 | holgerb | 147 | void Hott_ClearLine(unsigned char line) |
148 | { |
||
149 | HoTT_printfxy(0,line," "); |
||
150 | } |
||
1919 | holgerb | 151 | //--------------------------------------------------------------- |
1917 | holgerb | 152 | |
1919 | holgerb | 153 | unsigned char HoTT_Waring(void) |
154 | { |
||
155 | if(FC_StatusFlags & FC_STATUS_LOWBAT) return(VOICE_MINIMALE_EINGANSSPANNUNG); |
||
1933 | holgerb | 156 | if(MotorenEin && NC_ErrorCode) return(VOICE_BEEP); |
2008 | holgerb | 157 | //if(Parameter_UserParam1) return(Parameter_UserParam1); |
1919 | holgerb | 158 | return(0); |
159 | } |
||
160 | |||
161 | //--------------------------------------------------------------- |
||
1942 | holgerb | 162 | void NC_Fills_HoTT_Telemety(void) |
1940 | holgerb | 163 | { |
2034 | holgerb | 164 | unsigned char *ptr = NULL; |
1940 | holgerb | 165 | unsigned char max = 0,i,z; |
166 | switch(FromNaviCtrl.Param.Byte[11]) |
||
167 | { |
||
168 | case HOTT_VARIO_PACKET_ID: |
||
169 | ptr = (unsigned char *) &VarioPacket; |
||
170 | max = sizeof(VarioPacket); |
||
171 | break; |
||
172 | case HOTT_GPS_PACKET_ID: |
||
173 | ptr = (unsigned char *) &GPSPacket; |
||
174 | max = sizeof(GPSPacket); |
||
175 | break; |
||
176 | case HOTT_ELECTRIC_AIR_PACKET_ID: |
||
177 | ptr = (unsigned char *) &ElectricAirPacket; |
||
178 | max = sizeof(ElectricAirPacket); |
||
179 | break; |
||
1943 | holgerb | 180 | case HOTT_GENERAL_PACKET_ID: |
181 | ptr = (unsigned char *) &HoTTGeneral; |
||
182 | max = sizeof(HoTTGeneral); |
||
183 | break; |
||
1940 | holgerb | 184 | } |
185 | z = FromNaviCtrl.Param.Byte[0]; // Data allocation |
||
186 | |||
187 | for(i=0; i < FromNaviCtrl.Param.Byte[1]; i++) |
||
188 | { |
||
189 | if(z >= max) break; |
||
190 | ptr[z] = FromNaviCtrl.Param.Byte[2+i]; |
||
191 | z++; |
||
192 | } |
||
193 | } |
||
194 | |||
1942 | holgerb | 195 | unsigned int BuildHoTT_Vario(void) |
196 | { |
||
1944 | holgerb | 197 | unsigned int tmp = 30000; |
198 | if(VarioCharacter == '+' || VarioCharacter == '-') |
||
199 | { |
||
200 | tmp = 30000 + (AltitudeSetpointTrimming * EE_Parameter.Hoehe_Verstaerkung) / 3; |
||
201 | if(tmp < 30000 && tmp > 30000 - 50) tmp = 30000 - 50; // weil es sonst erst bei < 0,5m/sek piept |
||
202 | } |
||
1942 | holgerb | 203 | else |
1944 | holgerb | 204 | if((VarioCharacter == ' ') && (FC_StatusFlags & FC_STATUS_FLY)) |
205 | { |
||
206 | tmp = 30000 + HoTTVarioMeter; |
||
207 | if(tmp > 30000) |
||
208 | { |
||
209 | if(tmp < 30000 + 100) tmp = 30000; |
||
210 | else tmp -= 100; |
||
211 | } |
||
212 | if(tmp < 30000) |
||
213 | { |
||
214 | if(tmp > 30000 - 100) tmp = 30000; |
||
215 | else tmp += 100; |
||
216 | } |
||
217 | } |
||
218 | else |
||
219 | if(VarioCharacter == '^') tmp = 30000 + FromNC_AltitudeSpeed * 10; |
||
220 | else |
||
221 | if(VarioCharacter == 'v') tmp = 30000 - FromNC_AltitudeSpeed * 10; |
||
222 | |||
1942 | holgerb | 223 | return(tmp); |
224 | } |
||
225 | |||
1943 | holgerb | 226 | |
1940 | holgerb | 227 | //--------------------------------------------------------------- |
1919 | holgerb | 228 | unsigned char HoTT_Telemety(unsigned char packet_request) |
229 | { |
||
230 | switch(packet_request) |
||
231 | { |
||
232 | case HOTT_VARIO_PACKET_ID: |
||
1921 | holgerb | 233 | VarioPacket.Altitude = HoehenWert/100 + 500; |
1942 | holgerb | 234 | VarioPacket.m_sec = BuildHoTT_Vario(); |
1943 | holgerb | 235 | VarioPacket.m_3sec = VarioPacket.m_sec; |
236 | VarioPacket.m_10sec = VarioPacket.m_sec; |
||
1919 | holgerb | 237 | if (VarioPacket.Altitude < VarioPacket.MinAltitude) VarioPacket.MinAltitude = VarioPacket.Altitude; |
238 | if (VarioPacket.Altitude > VarioPacket.MaxAltitude) VarioPacket.MaxAltitude = VarioPacket.Altitude; |
||
239 | VarioPacket.WarnBeep = HoTT_Waring(); |
||
240 | HoTT_DataPointer = (unsigned char *) &VarioPacket; |
||
241 | return(sizeof(VarioPacket)); |
||
242 | break; |
||
1921 | holgerb | 243 | |
1919 | holgerb | 244 | case HOTT_GPS_PACKET_ID: |
1921 | holgerb | 245 | GPSPacket.Altitude = HoehenWert/100 + 500; |
1943 | holgerb | 246 | // GPSPacket.Distance = GPSInfo.HomeDistance/10; // macht die NC |
247 | // GPSPacket.Heading = GPSInfo.HomeBearing/2; // macht die NC |
||
248 | // GPSPacket.Speed = (GPSInfo.Speed * 36) / 10; // macht die NC |
||
1942 | holgerb | 249 | GPSPacket.m_sec = BuildHoTT_Vario(); |
1921 | holgerb | 250 | GPSPacket.m_3sec = 120; |
251 | GPSPacket.m_10sec = 0; |
||
1919 | holgerb | 252 | GPSPacket.WarnBeep = HoTT_Waring(); |
253 | HoTT_DataPointer = (unsigned char *) &GPSPacket; |
||
254 | return(sizeof(GPSPacket)); |
||
255 | break; |
||
256 | case HOTT_ELECTRIC_AIR_PACKET_ID: |
||
1943 | holgerb | 257 | GetHottestBl(); |
1940 | holgerb | 258 | ElectricAirPacket.Altitude = HoehenWert/100 + 500; |
1921 | holgerb | 259 | ElectricAirPacket.Battery1 = UBat; |
1940 | holgerb | 260 | ElectricAirPacket.Battery2 = UBat; |
1943 | holgerb | 261 | ElectricAirPacket.VoltageCell1 = ErsatzKompassInGrad / 2; |
262 | ElectricAirPacket.VoltageCell8 = ElectricAirPacket.VoltageCell1; |
||
1944 | holgerb | 263 | ElectricAirPacket.VoltageCell6 = GPSInfo.HomeBearing / 2; |
1943 | holgerb | 264 | ElectricAirPacket.VoltageCell7 = GPSInfo.HomeDistance/20; |
1944 | holgerb | 265 | ElectricAirPacket.VoltageCell13 = ElectricAirPacket.VoltageCell6; |
1943 | holgerb | 266 | ElectricAirPacket.VoltageCell14 = ElectricAirPacket.VoltageCell7; |
1942 | holgerb | 267 | ElectricAirPacket.m_sec = BuildHoTT_Vario(); |
1940 | holgerb | 268 | ElectricAirPacket.m_3sec = 120; |
269 | ElectricAirPacket.InputVoltage = UBat; |
||
1943 | holgerb | 270 | ElectricAirPacket.Temperature1 = MinBlTempertaure + 20; |
271 | ElectricAirPacket.Temperature2 = MaxBlTempertaure + 20; |
||
1940 | holgerb | 272 | ElectricAirPacket.Capacity = Capacity.UsedCapacity/10; |
1919 | holgerb | 273 | ElectricAirPacket.WarnBeep = HoTT_Waring(); |
1940 | holgerb | 274 | ElectricAirPacket.Current = Capacity.ActualCurrent; |
1919 | holgerb | 275 | HoTT_DataPointer = (unsigned char *) &ElectricAirPacket; |
276 | return(sizeof(ElectricAirPacket)); |
||
277 | break; |
||
1943 | holgerb | 278 | case HOTT_GENERAL_PACKET_ID: |
279 | GetHottestBl(); |
||
280 | HoTTGeneral.Rpm = GPSInfo.HomeDistance/100; |
||
281 | HoTTGeneral.VoltageCell1 = ErsatzKompassInGrad / 2; |
||
1944 | holgerb | 282 | HoTTGeneral.VoltageCell6 = GPSInfo.HomeBearing / 2; |
1943 | holgerb | 283 | if(UBat > BattLowVoltageWarning + 5) HoTTGeneral.FuelPercent = (UBat - (BattLowVoltageWarning + 6)) * 3; |
284 | else HoTTGeneral.FuelPercent = 0; |
||
1944 | holgerb | 285 | HoTTGeneral.FuelCapacity = HoehenWert/100; |
286 | if(HoTTGeneral.FuelCapacity < 0) HoTTGeneral.FuelCapacity = 0; |
||
1943 | holgerb | 287 | HoTTGeneral.Altitude = HoehenWert/100 + 500; |
288 | HoTTGeneral.Battery1 = UBat; |
||
289 | HoTTGeneral.Battery2 = UBat; |
||
290 | HoTTGeneral.m_sec = BuildHoTT_Vario(); |
||
291 | HoTTGeneral.m_3sec = 120; |
||
292 | HoTTGeneral.InputVoltage = UBat; |
||
293 | HoTTGeneral.Temperature1 = MinBlTempertaure + 20; |
||
294 | HoTTGeneral.Temperature2 = MaxBlTempertaure + 20; |
||
295 | HoTTGeneral.Capacity = Capacity.UsedCapacity/10; |
||
296 | HoTTGeneral.WarnBeep = HoTT_Waring(); |
||
297 | HoTTGeneral.Current = Capacity.ActualCurrent; |
||
298 | HoTT_DataPointer = (unsigned char *) &HoTTGeneral; |
||
299 | return(sizeof(HoTTGeneral)); |
||
300 | break; |
||
1919 | holgerb | 301 | default: return(0); |
302 | } |
||
303 | } |
||
304 | |||
305 | //--------------------------------------------------------------- |
||
1917 | holgerb | 306 | void HoTT_Menu(void) |
307 | { |
||
1982 | holgerb | 308 | static unsigned char line, page = 0,show_current = 0,show_mag = 0, show_poti = 0; |
1921 | holgerb | 309 | unsigned char tmp; |
1944 | holgerb | 310 | HoTTVarioMeter = (HoTTVarioMeter * 7 + VarioMeter) / 8; |
311 | |||
1921 | holgerb | 312 | if(page == 0) |
1933 | holgerb | 313 | switch(line++) |
1917 | holgerb | 314 | { |
1919 | holgerb | 315 | case 0: |
1923 | holgerb | 316 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
1939 | holgerb | 317 | HoTT_printfxy_BLINK(0,0," %2i.%1iV ",UBat/10, UBat%10) |
318 | else |
||
319 | HoTT_printfxy(0,0," %2i.%1iV ",UBat/10, UBat%10) |
||
320 | |||
321 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
||
322 | { |
||
323 | if(HoehenReglerAktiv) HoTT_printfxy_INV(10,0,"ALT:%4im %c", (int16_t)(HoehenWert/100),VarioCharacter) |
||
324 | else HoTT_printfxy(10,0,"ALT:%4im ", (int16_t)(HoehenWert/100)) |
||
325 | } |
||
326 | else HoTT_printfxy(10,0,"ALT:---- "); |
||
327 | break; |
||
328 | case 1: |
||
329 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
330 | HoTT_printfxy_BLINK(0,1," %2i:%02i ",FlugSekunden/60,FlugSekunden%60) |
||
331 | else HoTT_printfxy(0,1," %2i:%02i ",FlugSekunden/60,FlugSekunden%60); |
||
1941 | holgerb | 332 | HoTT_printfxy(10,1,"DIR: %3d%c",ErsatzKompassInGrad, HoTT_GRAD); |
1949 | holgerb | 333 | if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(20,1,"C") else HoTT_printfxy(20,1," "); |
1939 | holgerb | 334 | break; |
335 | case 2: |
||
336 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
337 | HoTT_printfxy_BLINK(0,2," %5i ",Capacity.UsedCapacity) |
||
338 | else HoTT_printfxy(0,2," %5i ",Capacity.UsedCapacity); |
||
1940 | holgerb | 339 | HoTT_printfxy(12,2,"I:%2i.%1iA ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10); |
1939 | holgerb | 340 | break; |
341 | case 3: |
||
2072 | holgerb | 342 | HoTT_printfxy(9,0,":"); |
343 | HoTT_printfxy(9,1,":"); |
||
344 | HoTT_printfxy(9,2,":"); |
||
1939 | holgerb | 345 | HoTT_printfxy(0,3,"---------+-----------"); |
2072 | holgerb | 346 | |
347 | // HoTT_printfxy(0,3,"---------------------"); |
||
1939 | holgerb | 348 | HoTT_printfxy(0,6,"---------------------"); |
349 | break; |
||
350 | case 4: |
||
351 | if(NaviDataOkay) |
||
352 | { |
||
2072 | holgerb | 353 | HoTT_printfxy(9,4,":"); |
1939 | holgerb | 354 | HoTT_printfxy(0,4,"SAT:%2d ",GPSInfo.NumOfSats); |
355 | HoTT_printfxy(10,4,"DIST:%3dm",GPSInfo.HomeDistance/10); |
||
356 | switch (GPSInfo.SatFix) |
||
357 | { |
||
358 | case SATFIX_3D: |
||
359 | if(GPSInfo.Flags & FLAG_DIFFSOLN) HoTT_printfxy(7,4,"D ") |
||
360 | else HoTT_printfxy(7,4,"3D"); |
||
361 | break; |
||
362 | default: |
||
1943 | holgerb | 363 | HoTT_printfxy_BLINK(7,4,"!!"); |
1939 | holgerb | 364 | break; |
365 | } |
||
366 | } |
||
367 | else |
||
1944 | holgerb | 368 | { |
1940 | holgerb | 369 | Hott_ClearLine(4); |
1939 | holgerb | 370 | } |
371 | break; |
||
372 | case 5: |
||
373 | if(NaviDataOkay) |
||
374 | { |
||
1972 | holgerb | 375 | if(show_mag) |
376 | { |
||
377 | HoTT_printfxy(0,5,"MAG:%3u%% ",EarthMagneticField); |
||
1939 | holgerb | 378 | HoTT_printfxy(12,5,"HM:%3d%c %c", GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter); |
1972 | holgerb | 379 | HoTT_printfxy(9,5,"incl:%2d%c(%2i)",EarthMagneticInclination, HoTT_GRAD,EarthMagneticInclinationTheoretic); |
380 | } |
||
381 | else |
||
382 | { |
||
2072 | holgerb | 383 | //HoTT_printfxy(9,5,":"); |
384 | HoTT_printfxy(0,5," %2um/s: HM:%3d%c %c",GPSInfo.Speed, GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter); |
||
385 | // HoTT_printfxy(11,5,""); |
||
1972 | holgerb | 386 | } |
1939 | holgerb | 387 | } |
1940 | holgerb | 388 | else Hott_ClearLine(5); |
1939 | holgerb | 389 | break; |
390 | case 6: |
||
391 | break; |
||
392 | case 7: if(NC_ErrorCode) |
||
393 | { |
||
394 | if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER) |
||
395 | { |
||
396 | Hott_ClearLine(7); |
||
397 | HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode); |
||
398 | } |
||
399 | else |
||
400 | { |
||
401 | HoTT_printfxy(0,7,"ERR: "); _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);}; |
||
402 | } |
||
403 | else HoTT_printfxy(0,7," www.MikroKopter.de "); |
||
404 | break; |
||
405 | case 8: ASCIIPacket.WarnBeep = HoTT_Waring(); |
||
406 | // ASCIIPacket.WarnBeep = Parameter_UserParam1; |
||
407 | case 9: |
||
408 | case 10: |
||
409 | case 11: |
||
410 | case 12: |
||
411 | case 13: |
||
412 | case 14: |
||
413 | case 15: |
||
414 | case 16: |
||
1972 | holgerb | 415 | if(HottKeyboard == HOTT_KEY_SET) { if(show_mag) show_mag = 0; else show_mag = 1;} |
416 | else |
||
1949 | holgerb | 417 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 1; line = 0;}; |
1939 | holgerb | 418 | HottKeyboard = 0; |
419 | break; |
||
420 | default: line = 0; |
||
421 | break; |
||
422 | } |
||
423 | else |
||
424 | if(page == 1) |
||
425 | switch(line++) |
||
426 | { |
||
427 | case 0: |
||
428 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
1923 | holgerb | 429 | HoTT_printfxy_BLINK(0,0," %2i:%02i %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity) |
430 | else HoTT_printfxy(0,0," %2i:%02i %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity); |
||
1917 | holgerb | 431 | break; |
432 | case 1: |
||
1921 | holgerb | 433 | HoTT_printfxy(0,1,"DIR:%3d%c",KompassValue, HoTT_GRAD); |
1917 | holgerb | 434 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
1920 | holgerb | 435 | { |
436 | if(HoehenReglerAktiv) HoTT_printfxy_INV(10,1,"ALT:%4im", (int16_t)(HoehenWert/100)) |
||
437 | else HoTT_printfxy(10,1,"ALT:%4im", (int16_t)(HoehenWert/100)) |
||
438 | } |
||
439 | else HoTT_printfxy(10,1,"ALT:---- "); |
||
440 | HoTT_printfxy(20,1,"%c",VarioCharacter); |
||
1917 | holgerb | 441 | break; |
442 | case 2: |
||
443 | if(NaviDataOkay) |
||
444 | { |
||
1923 | holgerb | 445 | HoTT_printfxy(1,2,"HM:%3d%c DIST:%3dm %c", GPSInfo.HomeBearing, HoTT_GRAD, GPSInfo.HomeDistance/10, NC_GPS_ModeCharacter); |
1917 | holgerb | 446 | } |
447 | else |
||
448 | { |
||
1923 | holgerb | 449 | Hott_ClearLine(2); |
1917 | holgerb | 450 | } |
451 | break; |
||
1923 | holgerb | 452 | case 3: |
453 | HoTT_printfxy(0,3,"PWR:%2i.%1iA (%iW) ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10,Capacity.ActualPower); |
||
1949 | holgerb | 454 | if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(19,3,"CF") else HoTT_printfxy(19,3," "); |
1923 | holgerb | 455 | break; |
1917 | holgerb | 456 | case 4: |
457 | if(NaviDataOkay) |
||
458 | { |
||
1919 | holgerb | 459 | HoTT_printfxy(0,4,"GPS:%2um/s SAT:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
1917 | holgerb | 460 | switch (GPSInfo.SatFix) |
461 | { |
||
462 | case SATFIX_3D: |
||
463 | HoTT_printfxy(16,4," 3D "); |
||
464 | break; |
||
1925 | holgerb | 465 | //case SATFIX_2D: |
466 | //case SATFIX_NONE: |
||
1917 | holgerb | 467 | default: |
1925 | holgerb | 468 | HoTT_printfxy_BLINK(16,4,"NOFIX"); |
1917 | holgerb | 469 | break; |
470 | } |
||
471 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
||
472 | { |
||
473 | HoTT_printfxy(16,4,"DGPS "); |
||
474 | } |
||
475 | } |
||
476 | else |
||
477 | { //012345678901234567890 |
||
1930 | holgerb | 478 | HoTT_printfxy(0,4," No NaviCtrl "); |
1917 | holgerb | 479 | } |
480 | break; |
||
481 | case 5: |
||
1949 | holgerb | 482 | if(show_current) |
483 | { |
||
484 | 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); |
||
485 | } |
||
486 | else |
||
487 | { |
||
488 | HoTT_printfxy(0,5,"%3i %3i %3i %3i%cC", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature,HoTT_GRAD); |
||
489 | } |
||
1917 | holgerb | 490 | break; |
491 | case 6: |
||
1949 | holgerb | 492 | if(show_current) |
493 | { |
||
1917 | holgerb | 494 | if(RequiredMotors == 4) Hott_ClearLine(6); |
495 | else |
||
1949 | holgerb | 496 | 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) |
497 | else |
||
498 | 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); |
||
499 | } |
||
500 | else |
||
501 | { |
||
502 | if(RequiredMotors == 4) Hott_ClearLine(6); |
||
503 | else |
||
1923 | holgerb | 504 | if(RequiredMotors == 6) HoTT_printfxy(0,6,"%3i %3i%cC ", Motor[4].Temperature, Motor[5].Temperature,HoTT_GRAD) |
1917 | holgerb | 505 | else |
1923 | holgerb | 506 | 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 | 507 | } |
1917 | holgerb | 508 | break; |
1930 | holgerb | 509 | case 7: if(NC_ErrorCode) |
510 | { |
||
511 | if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER) |
||
512 | { |
||
513 | Hott_ClearLine(7); |
||
514 | HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode); |
||
515 | } |
||
516 | else |
||
517 | { |
||
518 | HoTT_printfxy(0,7,"ERR: "); _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);}; |
||
519 | } |
||
1937 | holgerb | 520 | else HoTT_printfxy(0,7," www.MikroKopter.de "); |
1917 | holgerb | 521 | break; |
1919 | holgerb | 522 | case 8: ASCIIPacket.WarnBeep = HoTT_Waring(); |
523 | // ASCIIPacket.WarnBeep = Parameter_UserParam1; |
||
1921 | holgerb | 524 | case 9: |
1917 | holgerb | 525 | case 10: |
526 | case 11: |
||
527 | case 12: |
||
528 | case 13: |
||
1919 | holgerb | 529 | case 14: |
530 | case 15: |
||
531 | case 16: |
||
1949 | holgerb | 532 | if(HottKeyboard == HOTT_KEY_SET) { if(show_current) show_current = 0; else show_current = 1; Hott_ClearLine(5); Hott_ClearLine(6);} |
533 | else |
||
534 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 2; line = 0;} |
||
535 | else |
||
536 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 0; line = 0;} |
||
537 | //if(HottKeyboard) HoTT_printfxy(15,6,"%KEY:%02x ",HottKeyboard); |
||
1921 | holgerb | 538 | HottKeyboard = 0; |
539 | break; |
||
1933 | holgerb | 540 | default: line = 0; |
1921 | holgerb | 541 | break; |
542 | } |
||
543 | else |
||
1939 | holgerb | 544 | if(page == 2) |
1933 | holgerb | 545 | switch(line++) |
1921 | holgerb | 546 | { |
547 | case 0: |
||
548 | HoTT_printfxy_INV(0,0,"Setting:%u %s ",GetActiveParamSet(),EE_Parameter.Name); |
||
549 | break; |
||
550 | case 1: HoTT_printfxy(0,1,"Min:%2i.%1iV %s ",BattLowVoltageWarning/10, BattLowVoltageWarning%10, Mixer.Name); |
||
551 | break; |
||
1923 | holgerb | 552 | case 2: HoTT_printfxy(0,2,"ALT:"); |
1921 | holgerb | 553 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
554 | { |
||
555 | if(!(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER)) HoTT_printf("POTI:%3u ", Parameter_HoehenSchalter) |
||
556 | else |
||
557 | { |
||
558 | if(Parameter_HoehenSchalter > 50) HoTT_printf("(ON) ") else HoTT_printf("(OFF) "); |
||
559 | if((Parameter_ExtraConfig & CFG2_HEIGHT_LIMIT)) HoTT_printf("LIMIT", Parameter_HoehenSchalter) |
||
560 | else HoTT_printf("VARIO", Parameter_HoehenSchalter); |
||
561 | } |
||
562 | } |
||
563 | else |
||
564 | HoTT_printf("DISABLED"); |
||
565 | break; |
||
1923 | holgerb | 566 | case 3: HoTT_printfxy(0,3,"CF:"); |
1921 | holgerb | 567 | if(!EE_Parameter.CareFreeModeControl) HoTT_printf("DISABLED") |
568 | else |
||
569 | { |
||
570 | if(CareFree) HoTT_printf(" (ON) ") else HoTT_printf(" (OFF)"); |
||
571 | if(EE_Parameter.ExtraConfig & CFG_LEARNABLE_CAREFREE) HoTT_printf(" TEACH"); |
||
572 | } |
||
573 | break; |
||
1923 | holgerb | 574 | case 4: HoTT_printfxy(0,4,"GPS:"); |
575 | if(!(Parameter_GlobalConfig & CFG_GPS_AKTIV)) HoTT_printf("DISABLED") |
||
576 | else |
||
577 | { |
||
578 | CHK_POTI(tmp,EE_Parameter.NaviGpsModeControl); |
||
579 | if(tmp < 50) HoTT_printf("(FREE)") |
||
580 | else |
||
581 | if(tmp >= 180) HoTT_printf("(HOME)") |
||
582 | else |
||
583 | if(EE_Parameter.ExtraConfig & CFG_GPS_AID) HoTT_printf("(AID) ") |
||
584 | else HoTT_printf("(HOLD)") |
||
585 | } |
||
586 | if(EE_Parameter.FailSafeTime) HoTT_printfxy(10,4," FS:%usek ",EE_Parameter.FailSafeTime) |
||
587 | |||
588 | break; |
||
589 | case 5: HoTT_printfxy(0,5,"HOME ALT:"); |
||
590 | if(EE_Parameter.ComingHomeAltitude) HoTT_printf("%um",EE_Parameter.ComingHomeAltitude) else HoTT_printf("HOLD "); |
||
591 | break; |
||
1921 | holgerb | 592 | case 6: |
1982 | holgerb | 593 | if(!show_poti) |
594 | { |
||
595 | 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); |
||
596 | HoTT_printfxy(0,7,"Gs:%4i Ya:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]]+127,PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]); |
||
597 | } |
||
598 | else |
||
599 | { |
||
600 | HoTT_printfxy(0,6,"P1:%4i P2:%4i 3:%3i",Poti1,Poti2, Poti3); |
||
601 | HoTT_printfxy(0,7,"P4:%4i P5:%4i 6:%3i",Poti4,Poti5, Poti6); |
||
602 | } |
||
603 | |||
1921 | holgerb | 604 | break; |
605 | case 7: //HoTT_printfxy(0,6,"WARNINGS:"); |
||
606 | if(HoTTBlink) |
||
607 | { |
||
608 | LIBFC_HoTT_SetPos(6 * 21); |
||
609 | if(!(Parameter_GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV)) HoTT_printf_BLINK("COUPLING OFF! "); |
||
610 | if(EE_Parameter.BitConfig & (CFG_LOOP_LINKS | CFG_LOOP_RECHTS | CFG_LOOP_UNTEN | CFG_LOOP_OBEN)) HoTT_printf_BLINK("LOOPING! "); |
||
611 | if(Parameter_GlobalConfig & CFG_HEADING_HOLD) HoTT_printf_BLINK("HH! "); |
||
612 | if(!(Parameter_GlobalConfig & CFG_KOMPASS_AKTIV)) HoTT_printf_BLINK("COMPASS OFF! "); |
||
613 | } |
||
614 | break; |
||
615 | case 8: ASCIIPacket.WarnBeep = HoTT_Waring(); |
||
616 | break; |
||
617 | case 9: |
||
618 | case 10: |
||
619 | case 11: |
||
620 | case 12: |
||
621 | case 13: |
||
622 | case 14: |
||
623 | case 15: |
||
624 | case 16: |
||
1982 | holgerb | 625 | if(HottKeyboard == HOTT_KEY_SET) { if(show_poti) show_poti = 0; else show_poti = 1; Hott_ClearLine(6); Hott_ClearLine(7);} |
626 | else |
||
1949 | holgerb | 627 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 1; line = 0;}; |
1921 | holgerb | 628 | HottKeyboard = 0; |
629 | break; |
||
1933 | holgerb | 630 | default: line = 0; |
1917 | holgerb | 631 | break; |
632 | } |
||
1921 | holgerb | 633 | else page = 0; |
1917 | holgerb | 634 | } |
635 | |||
1925 | holgerb | 636 | #endif |
1917 | holgerb | 637 | |
638 | |||
639 |