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