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