Go to most recent revision | Details | 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 | { |
||
1982 | holgerb | 250 | static unsigned char line, page = 0,show_current = 0,show_mag = 0, show_poti = 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 | { |
||
1972 | holgerb | 315 | if(show_mag) |
316 | { |
||
317 | HoTT_printfxy(0,5,"MAG:%3u%% ",EarthMagneticField); |
||
1939 | holgerb | 318 | HoTT_printfxy(12,5,"HM:%3d%c %c", GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter); |
1972 | holgerb | 319 | HoTT_printfxy(9,5,"incl:%2d%c(%2i)",EarthMagneticInclination, HoTT_GRAD,EarthMagneticInclinationTheoretic); |
320 | } |
||
321 | else |
||
322 | { |
||
323 | HoTT_printfxy(9,5,"I"); |
||
324 | HoTT_printfxy(0,5," %2um/s",GPSInfo.Speed,GPSInfo.NumOfSats); |
||
325 | HoTT_printfxy(11,5," HM:%3d%c %c", GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter); |
||
326 | } |
||
1939 | holgerb | 327 | } |
1940 | holgerb | 328 | else Hott_ClearLine(5); |
1939 | holgerb | 329 | break; |
330 | case 6: |
||
331 | break; |
||
332 | case 7: if(NC_ErrorCode) |
||
333 | { |
||
334 | if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER) |
||
335 | { |
||
336 | Hott_ClearLine(7); |
||
337 | HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode); |
||
338 | } |
||
339 | else |
||
340 | { |
||
341 | HoTT_printfxy(0,7,"ERR: "); _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);}; |
||
342 | } |
||
343 | else HoTT_printfxy(0,7," www.MikroKopter.de "); |
||
344 | break; |
||
345 | case 8: ASCIIPacket.WarnBeep = HoTT_Waring(); |
||
346 | // ASCIIPacket.WarnBeep = Parameter_UserParam1; |
||
347 | case 9: |
||
348 | case 10: |
||
349 | case 11: |
||
350 | case 12: |
||
351 | case 13: |
||
352 | case 14: |
||
353 | case 15: |
||
354 | case 16: |
||
1972 | holgerb | 355 | if(HottKeyboard == HOTT_KEY_SET) { if(show_mag) show_mag = 0; else show_mag = 1;} |
356 | else |
||
1949 | holgerb | 357 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 1; line = 0;}; |
1939 | holgerb | 358 | HottKeyboard = 0; |
359 | break; |
||
360 | default: line = 0; |
||
361 | break; |
||
362 | } |
||
363 | else |
||
364 | if(page == 1) |
||
365 | switch(line++) |
||
366 | { |
||
367 | case 0: |
||
368 | if(FC_StatusFlags & FC_STATUS_LOWBAT) |
||
1923 | holgerb | 369 | HoTT_printfxy_BLINK(0,0," %2i:%02i %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity) |
370 | else HoTT_printfxy(0,0," %2i:%02i %2i.%1iV %4imAh",FlugSekunden/60,FlugSekunden%60,UBat/10, UBat%10,Capacity.UsedCapacity); |
||
1917 | holgerb | 371 | break; |
372 | case 1: |
||
1921 | holgerb | 373 | HoTT_printfxy(0,1,"DIR:%3d%c",KompassValue, HoTT_GRAD); |
1917 | holgerb | 374 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
1920 | holgerb | 375 | { |
376 | if(HoehenReglerAktiv) HoTT_printfxy_INV(10,1,"ALT:%4im", (int16_t)(HoehenWert/100)) |
||
377 | else HoTT_printfxy(10,1,"ALT:%4im", (int16_t)(HoehenWert/100)) |
||
378 | } |
||
379 | else HoTT_printfxy(10,1,"ALT:---- "); |
||
380 | HoTT_printfxy(20,1,"%c",VarioCharacter); |
||
1917 | holgerb | 381 | break; |
382 | case 2: |
||
383 | if(NaviDataOkay) |
||
384 | { |
||
1923 | holgerb | 385 | HoTT_printfxy(1,2,"HM:%3d%c DIST:%3dm %c", GPSInfo.HomeBearing, HoTT_GRAD, GPSInfo.HomeDistance/10, NC_GPS_ModeCharacter); |
1917 | holgerb | 386 | } |
387 | else |
||
388 | { |
||
1923 | holgerb | 389 | Hott_ClearLine(2); |
1917 | holgerb | 390 | } |
391 | break; |
||
1923 | holgerb | 392 | case 3: |
393 | HoTT_printfxy(0,3,"PWR:%2i.%1iA (%iW) ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10,Capacity.ActualPower); |
||
1949 | holgerb | 394 | if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy_INV(19,3,"CF") else HoTT_printfxy(19,3," "); |
1923 | holgerb | 395 | break; |
1917 | holgerb | 396 | case 4: |
397 | if(NaviDataOkay) |
||
398 | { |
||
1919 | holgerb | 399 | HoTT_printfxy(0,4,"GPS:%2um/s SAT:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
1917 | holgerb | 400 | switch (GPSInfo.SatFix) |
401 | { |
||
402 | case SATFIX_3D: |
||
403 | HoTT_printfxy(16,4," 3D "); |
||
404 | break; |
||
1925 | holgerb | 405 | //case SATFIX_2D: |
406 | //case SATFIX_NONE: |
||
1917 | holgerb | 407 | default: |
1925 | holgerb | 408 | HoTT_printfxy_BLINK(16,4,"NOFIX"); |
1917 | holgerb | 409 | break; |
410 | } |
||
411 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
||
412 | { |
||
413 | HoTT_printfxy(16,4,"DGPS "); |
||
414 | } |
||
415 | } |
||
416 | else |
||
417 | { //012345678901234567890 |
||
1930 | holgerb | 418 | HoTT_printfxy(0,4," No NaviCtrl "); |
1917 | holgerb | 419 | } |
420 | break; |
||
421 | case 5: |
||
1949 | holgerb | 422 | if(show_current) |
423 | { |
||
424 | 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); |
||
425 | } |
||
426 | else |
||
427 | { |
||
428 | HoTT_printfxy(0,5,"%3i %3i %3i %3i%cC", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature,HoTT_GRAD); |
||
429 | } |
||
1917 | holgerb | 430 | break; |
431 | case 6: |
||
1949 | holgerb | 432 | if(show_current) |
433 | { |
||
1917 | holgerb | 434 | if(RequiredMotors == 4) Hott_ClearLine(6); |
435 | else |
||
1949 | holgerb | 436 | 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) |
437 | else |
||
438 | 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); |
||
439 | } |
||
440 | else |
||
441 | { |
||
442 | if(RequiredMotors == 4) Hott_ClearLine(6); |
||
443 | else |
||
1923 | holgerb | 444 | if(RequiredMotors == 6) HoTT_printfxy(0,6,"%3i %3i%cC ", Motor[4].Temperature, Motor[5].Temperature,HoTT_GRAD) |
1917 | holgerb | 445 | else |
1923 | holgerb | 446 | 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 | 447 | } |
1917 | holgerb | 448 | break; |
1930 | holgerb | 449 | case 7: if(NC_ErrorCode) |
450 | { |
||
451 | if(HoTTBlink && NC_ErrorCode < MAX_ERR_NUMBER) |
||
452 | { |
||
453 | Hott_ClearLine(7); |
||
454 | HoTT_printfxy_INV(0,7,"ERR: %2d !",NC_ErrorCode); |
||
455 | } |
||
456 | else |
||
457 | { |
||
458 | HoTT_printfxy(0,7,"ERR: "); _printf_P(&LIBFC_HoTT_Putchar, NC_ERROR_TEXT[NC_ErrorCode] , 0);}; |
||
459 | } |
||
1937 | holgerb | 460 | else HoTT_printfxy(0,7," www.MikroKopter.de "); |
1917 | holgerb | 461 | break; |
1919 | holgerb | 462 | case 8: ASCIIPacket.WarnBeep = HoTT_Waring(); |
463 | // ASCIIPacket.WarnBeep = Parameter_UserParam1; |
||
1921 | holgerb | 464 | case 9: |
1917 | holgerb | 465 | case 10: |
466 | case 11: |
||
467 | case 12: |
||
468 | case 13: |
||
1919 | holgerb | 469 | case 14: |
470 | case 15: |
||
471 | case 16: |
||
1949 | holgerb | 472 | if(HottKeyboard == HOTT_KEY_SET) { if(show_current) show_current = 0; else show_current = 1; Hott_ClearLine(5); Hott_ClearLine(6);} |
473 | else |
||
474 | if(HottKeyboard == HOTT_KEY_LEFT) { LIBFC_HoTT_Clear(); page = 2; line = 0;} |
||
475 | else |
||
476 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 0; line = 0;} |
||
477 | //if(HottKeyboard) HoTT_printfxy(15,6,"%KEY:%02x ",HottKeyboard); |
||
1921 | holgerb | 478 | HottKeyboard = 0; |
479 | break; |
||
1933 | holgerb | 480 | default: line = 0; |
1921 | holgerb | 481 | break; |
482 | } |
||
483 | else |
||
1939 | holgerb | 484 | if(page == 2) |
1933 | holgerb | 485 | switch(line++) |
1921 | holgerb | 486 | { |
487 | case 0: |
||
488 | HoTT_printfxy_INV(0,0,"Setting:%u %s ",GetActiveParamSet(),EE_Parameter.Name); |
||
489 | break; |
||
490 | case 1: HoTT_printfxy(0,1,"Min:%2i.%1iV %s ",BattLowVoltageWarning/10, BattLowVoltageWarning%10, Mixer.Name); |
||
491 | break; |
||
1923 | holgerb | 492 | case 2: HoTT_printfxy(0,2,"ALT:"); |
1921 | holgerb | 493 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
494 | { |
||
495 | if(!(EE_Parameter.GlobalConfig & CFG_HOEHEN_SCHALTER)) HoTT_printf("POTI:%3u ", Parameter_HoehenSchalter) |
||
496 | else |
||
497 | { |
||
498 | if(Parameter_HoehenSchalter > 50) HoTT_printf("(ON) ") else HoTT_printf("(OFF) "); |
||
499 | if((Parameter_ExtraConfig & CFG2_HEIGHT_LIMIT)) HoTT_printf("LIMIT", Parameter_HoehenSchalter) |
||
500 | else HoTT_printf("VARIO", Parameter_HoehenSchalter); |
||
501 | } |
||
502 | } |
||
503 | else |
||
504 | HoTT_printf("DISABLED"); |
||
505 | break; |
||
1923 | holgerb | 506 | case 3: HoTT_printfxy(0,3,"CF:"); |
1921 | holgerb | 507 | if(!EE_Parameter.CareFreeModeControl) HoTT_printf("DISABLED") |
508 | else |
||
509 | { |
||
510 | if(CareFree) HoTT_printf(" (ON) ") else HoTT_printf(" (OFF)"); |
||
511 | if(EE_Parameter.ExtraConfig & CFG_LEARNABLE_CAREFREE) HoTT_printf(" TEACH"); |
||
512 | } |
||
513 | break; |
||
1923 | holgerb | 514 | case 4: HoTT_printfxy(0,4,"GPS:"); |
515 | if(!(Parameter_GlobalConfig & CFG_GPS_AKTIV)) HoTT_printf("DISABLED") |
||
516 | else |
||
517 | { |
||
518 | CHK_POTI(tmp,EE_Parameter.NaviGpsModeControl); |
||
519 | if(tmp < 50) HoTT_printf("(FREE)") |
||
520 | else |
||
521 | if(tmp >= 180) HoTT_printf("(HOME)") |
||
522 | else |
||
523 | if(EE_Parameter.ExtraConfig & CFG_GPS_AID) HoTT_printf("(AID) ") |
||
524 | else HoTT_printf("(HOLD)") |
||
525 | } |
||
526 | if(EE_Parameter.FailSafeTime) HoTT_printfxy(10,4," FS:%usek ",EE_Parameter.FailSafeTime) |
||
527 | |||
528 | break; |
||
529 | case 5: HoTT_printfxy(0,5,"HOME ALT:"); |
||
530 | if(EE_Parameter.ComingHomeAltitude) HoTT_printf("%um",EE_Parameter.ComingHomeAltitude) else HoTT_printf("HOLD "); |
||
531 | break; |
||
1921 | holgerb | 532 | case 6: |
1982 | holgerb | 533 | if(!show_poti) |
534 | { |
||
535 | 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); |
||
536 | HoTT_printfxy(0,7,"Gs:%4i Ya:%4i ",PPM_in[EE_Parameter.Kanalbelegung[K_GAS]]+127,PPM_in[EE_Parameter.Kanalbelegung[K_GIER]]); |
||
537 | } |
||
538 | else |
||
539 | { |
||
540 | HoTT_printfxy(0,6,"P1:%4i P2:%4i 3:%3i",Poti1,Poti2, Poti3); |
||
541 | HoTT_printfxy(0,7,"P4:%4i P5:%4i 6:%3i",Poti4,Poti5, Poti6); |
||
542 | } |
||
543 | |||
1921 | holgerb | 544 | break; |
545 | case 7: //HoTT_printfxy(0,6,"WARNINGS:"); |
||
546 | if(HoTTBlink) |
||
547 | { |
||
548 | LIBFC_HoTT_SetPos(6 * 21); |
||
549 | if(!(Parameter_GlobalConfig & CFG_ACHSENKOPPLUNG_AKTIV)) HoTT_printf_BLINK("COUPLING OFF! "); |
||
550 | if(EE_Parameter.BitConfig & (CFG_LOOP_LINKS | CFG_LOOP_RECHTS | CFG_LOOP_UNTEN | CFG_LOOP_OBEN)) HoTT_printf_BLINK("LOOPING! "); |
||
551 | if(Parameter_GlobalConfig & CFG_HEADING_HOLD) HoTT_printf_BLINK("HH! "); |
||
552 | if(!(Parameter_GlobalConfig & CFG_KOMPASS_AKTIV)) HoTT_printf_BLINK("COMPASS OFF! "); |
||
553 | } |
||
554 | break; |
||
555 | case 8: ASCIIPacket.WarnBeep = HoTT_Waring(); |
||
556 | break; |
||
557 | case 9: |
||
558 | case 10: |
||
559 | case 11: |
||
560 | case 12: |
||
561 | case 13: |
||
562 | case 14: |
||
563 | case 15: |
||
564 | case 16: |
||
1982 | holgerb | 565 | if(HottKeyboard == HOTT_KEY_SET) { if(show_poti) show_poti = 0; else show_poti = 1; Hott_ClearLine(6); Hott_ClearLine(7);} |
566 | else |
||
1949 | holgerb | 567 | if(HottKeyboard == HOTT_KEY_RIGHT) { LIBFC_HoTT_Clear(); page = 1; line = 0;}; |
1921 | holgerb | 568 | HottKeyboard = 0; |
569 | break; |
||
1933 | holgerb | 570 | default: line = 0; |
1917 | holgerb | 571 | break; |
572 | } |
||
1921 | holgerb | 573 | else page = 0; |
1917 | holgerb | 574 | } |
575 | |||
1925 | holgerb | 576 | #endif |
1917 | holgerb | 577 | |
578 | |||
579 |