Rev 1919 | Rev 1921 | 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 | |||
1920 | holgerb | 7 | #define HoTT_printf(format, args...) { _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);} |
8 | #define HoTT_printfxy(x,y,format, args...) { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar, PSTR(format) , ## args);} |
||
9 | #define HoTT_printfxy_INV(x,y,format, args...) { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar_INV, PSTR(format) , ## args);} |
||
10 | #define HoTT_printfxy_BLINK(x,y,format, args...) { LIBFC_HoTT_SetPos(y * 21 + x); _printf_P(&LIBFC_HoTT_Putchar_BLINK, PSTR(format) , ## args);} |
||
1917 | holgerb | 11 | |
1919 | holgerb | 12 | #define VOICE_MINIMALE_EINGANSSPANNUNG 16 |
13 | #define VOICE_BEEP 5 |
||
1920 | holgerb | 14 | #define HoTT_GRAD 96 |
15 | #define HoTT_LINKS 123 |
||
16 | #define HoTT_RECHTS 124 |
||
17 | #define HoTT_OBEN 125 |
||
18 | #define HoTT_UNTEN 126 |
||
1917 | holgerb | 19 | |
1919 | holgerb | 20 | |
21 | //--------------------------------------------------------------- |
||
1917 | holgerb | 22 | void Hott_ClearLine(unsigned char line) |
23 | { |
||
24 | HoTT_printfxy(0,line," "); |
||
25 | } |
||
1919 | holgerb | 26 | //--------------------------------------------------------------- |
1917 | holgerb | 27 | |
1919 | holgerb | 28 | unsigned char HoTT_Waring(void) |
29 | { |
||
30 | if(FC_StatusFlags & FC_STATUS_LOWBAT) return(VOICE_MINIMALE_EINGANSSPANNUNG); |
||
31 | if(MotorenEin && NC_ErrorCode) return(VOICE_BEEP); |
||
32 | return(0); |
||
33 | } |
||
34 | |||
35 | //--------------------------------------------------------------- |
||
36 | unsigned char HoTT_Telemety(unsigned char packet_request) |
||
37 | { |
||
38 | switch(packet_request) |
||
39 | { |
||
40 | case HOTT_VARIO_PACKET_ID: |
||
41 | VarioPacket.Altitude = HoehenWert + 500; |
||
42 | if (VarioPacket.Altitude < VarioPacket.MinAltitude) VarioPacket.MinAltitude = VarioPacket.Altitude; |
||
43 | if (VarioPacket.Altitude > VarioPacket.MaxAltitude) VarioPacket.MaxAltitude = VarioPacket.Altitude; |
||
44 | VarioPacket.WarnBeep = HoTT_Waring(); |
||
45 | HoTT_DataPointer = (unsigned char *) &VarioPacket; |
||
46 | return(sizeof(VarioPacket)); |
||
47 | break; |
||
48 | case HOTT_GPS_PACKET_ID: |
||
49 | GPSPacket.Altitude = HoehenWert + 500 + 30; |
||
50 | GPSPacket.Hoehe = GPSPacket.Altitude; |
||
51 | GPSPacket.Distance = GPSInfo.HomeDistance/10; |
||
52 | GPSPacket.Heading++; |
||
53 | GPSPacket.WarnBeep = HoTT_Waring(); |
||
54 | HoTT_DataPointer = (unsigned char *) &GPSPacket; |
||
55 | return(sizeof(GPSPacket)); |
||
56 | break; |
||
57 | case HOTT_ELECTRIC_AIR_PACKET_ID: |
||
58 | ElectricAirPacket.Altitude++; |
||
59 | ElectricAirPacket.Battery1++; |
||
60 | ElectricAirPacket.Capacity++; |
||
61 | ElectricAirPacket.WarnBeep = HoTT_Waring(); |
||
62 | HoTT_DataPointer = (unsigned char *) &ElectricAirPacket; |
||
63 | return(sizeof(ElectricAirPacket)); |
||
64 | break; |
||
65 | default: return(0); |
||
66 | } |
||
67 | } |
||
68 | |||
69 | //--------------------------------------------------------------- |
||
1917 | holgerb | 70 | void HoTT_Menu(void) |
71 | { |
||
72 | static unsigned char what; |
||
73 | switch(what++) |
||
74 | { |
||
1919 | holgerb | 75 | case 0: |
76 | HoTT_printfxy(0,0,"%2i.%1iV ",UBat/10, UBat%10); |
||
77 | if(FC_StatusFlags & FC_STATUS_LOWBAT) HoTT_printfxy_INV(6,0,"!!",UBat/10, UBat%10); |
||
1920 | holgerb | 78 | HoTT_printfxy(6,0,"%4imAh %2i:%02i ",Capacity.UsedCapacity,FlugSekunden/60,FlugSekunden%60); |
1917 | holgerb | 79 | break; |
80 | case 1: |
||
1920 | holgerb | 81 | HoTT_printfxy(0,1,"DIR:%3d%c",(int)(ErsatzKompass / GIER_GRAD_FAKTOR), HoTT_GRAD); |
1917 | holgerb | 82 | if(Parameter_GlobalConfig & CFG_HOEHENREGELUNG) |
1920 | holgerb | 83 | { |
84 | if(HoehenReglerAktiv) HoTT_printfxy_INV(10,1,"ALT:%4im", (int16_t)(HoehenWert/100)) |
||
85 | else HoTT_printfxy(10,1,"ALT:%4im", (int16_t)(HoehenWert/100)) |
||
86 | } |
||
87 | else HoTT_printfxy(10,1,"ALT:---- "); |
||
88 | HoTT_printfxy(20,1,"%c",VarioCharacter); |
||
1917 | holgerb | 89 | break; |
90 | case 2: |
||
1920 | holgerb | 91 | HoTT_printfxy(0,2,"I=%3i.%1iA%4iW ",Capacity.ActualCurrent/10, Capacity.ActualCurrent%10,Capacity.ActualPower); |
1917 | holgerb | 92 | break; |
93 | case 3: |
||
94 | if(NaviDataOkay) |
||
95 | { |
||
1920 | holgerb | 96 | HoTT_printfxy(0,3,"Home:%3dm %3d%c %c", GPSInfo.HomeDistance/10, GPSInfo.HomeBearing, HoTT_GRAD, NC_GPS_ModeCharacter); |
97 | if(FC_StatusFlags2 & FC_STATUS2_CAREFREE) HoTT_printfxy(17,3,"CF") else HoTT_printfxy(17,3," "); |
||
1917 | holgerb | 98 | } |
99 | else |
||
100 | { |
||
101 | Hott_ClearLine(3); |
||
102 | } |
||
103 | break; |
||
104 | case 4: |
||
105 | if(NaviDataOkay) |
||
106 | { |
||
1919 | holgerb | 107 | HoTT_printfxy(0,4,"GPS:%2um/s SAT:%d ",GPSInfo.Speed,GPSInfo.NumOfSats); |
1917 | holgerb | 108 | switch (GPSInfo.SatFix) |
109 | { |
||
110 | case SATFIX_3D: |
||
111 | HoTT_printfxy(16,4," 3D "); |
||
112 | break; |
||
113 | |||
114 | case SATFIX_2D: |
||
115 | case SATFIX_NONE: |
||
116 | default: |
||
1920 | holgerb | 117 | HoTT_printfxy_INV(16,4,"NOFIX"); |
1917 | holgerb | 118 | break; |
119 | } |
||
120 | if(GPSInfo.Flags & FLAG_DIFFSOLN) |
||
121 | { |
||
122 | HoTT_printfxy(16,4,"DGPS "); |
||
123 | } |
||
124 | } |
||
125 | else |
||
126 | { //012345678901234567890 |
||
127 | HoTT_printfxy(0,4,"No NaviCtrl! "); |
||
128 | } |
||
129 | break; |
||
130 | case 5: |
||
1920 | holgerb | 131 | HoTT_printfxy(0,5,"%3i %3i %3i %3i%cC ", Motor[0].Temperature, Motor[1].Temperature, Motor[2].Temperature, Motor[3].Temperature,HoTT_GRAD); |
1917 | holgerb | 132 | break; |
133 | case 6: |
||
134 | if(RequiredMotors == 4) Hott_ClearLine(6); |
||
135 | else |
||
1920 | holgerb | 136 | if(RequiredMotors == 6) HoTT_printfxy(0,6,"%3i %3i%cC ", Motor[4].Temperature, Motor[5].Temperature,HoTT_GRAD) |
1917 | holgerb | 137 | else |
138 | if(RequiredMotors > 6) HoTT_printfxy(0,6,"%3i %3i %3i %3i%cC ", Motor[4].Temperature, Motor[5].Temperature, Motor[6].Temperature, Motor[7].Temperature,0x6D); |
||
1919 | holgerb | 139 | //HoTT_printfxy(0,6,"%2x:%c %c %c %c %c %c %c %c ",Parameter_UserParam1,Parameter_UserParam1,Parameter_UserParam1+1,Parameter_UserParam1+2,Parameter_UserParam1+3,Parameter_UserParam1+4,Parameter_UserParam1+5,Parameter_UserParam1+6 ,Parameter_UserParam1+7 ,Parameter_UserParam1+8); |
1920 | holgerb | 140 | //HoTT_printfxy(15,6,"%KEY:%02x",HottKeyboard); |
141 | //if(HoTTBlink) HoTT_printfxy_INV(10,6,"BLINK"); |
||
1917 | holgerb | 142 | break; |
1920 | holgerb | 143 | case 7: if(NC_ErrorCode) {Hott_ClearLine(7); HoTT_printfxy_BLINK(3,7,"ERROR: %2d ",NC_ErrorCode);} |
1917 | holgerb | 144 | else HoTT_printfxy(0,7," www.MikroKopter.de "); |
145 | break; |
||
1919 | holgerb | 146 | case 8: ASCIIPacket.WarnBeep = HoTT_Waring(); |
147 | // ASCIIPacket.WarnBeep = Parameter_UserParam1; |
||
1917 | holgerb | 148 | case 9: |
149 | case 10: |
||
150 | case 11: |
||
151 | case 12: |
||
152 | case 13: |
||
1919 | holgerb | 153 | case 14: |
154 | case 15: |
||
155 | case 16: |
||
156 | break; |
||
1917 | holgerb | 157 | |
1919 | holgerb | 158 | |
1917 | holgerb | 159 | /* |
160 | 012345678901234567890 |
||
161 | +++++++++++++++++++++ |
||
162 | 13,8V 1234mAh 12:30 0 |
||
163 | Dir:180° Alt: 123m + 1 |
||
164 | GPS: 10Sat DGPS PH CF 2 |
||
165 | Home: 280° 123m 3 |
||
166 | I=23A P=123W Max=123 4 |
||
167 | BL1-4: 11 22 33 44°C 5 |
||
168 | BL5-8: 55 66 77 88°C 6 |
||
169 | No Error 7 |
||
170 | +++++++++++++++++++++ |
||
171 | */ |
||
172 | default: what = 0; |
||
173 | break; |
||
174 | } |
||
175 | } |
||
176 | |||
177 | |||
178 | |||
179 | |||
180 |