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