Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2299 | - | 1 | #include "libfc.h" |
2 | #include "printf_P.h" |
||
3 | #include "main.h" |
||
4 | #include "spi.h" |
||
5 | #include "capacity.h" |
||
6 | #include "jeti_ex.h" |
||
7 | #include "hottmenu.h" |
||
8 | |||
9 | #if (defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__)) |
||
10 | |||
11 | const char PROGMEM JETI_CODE[53] = |
||
12 | { |
||
13 | 0, // 0 |
||
14 | 'O', // SPEAK_ERR_CALIBARTION 1 |
||
15 | 'P', // SPEAK_ERR_RECEICER 2 |
||
16 | 'Q', // SPEAK_ERR_DATABUS 3 |
||
17 | 'R', // SPEAK_ERR_NAVI 4 |
||
18 | 'S', // SPEAK_ERROR 5 |
||
19 | 'T', // SPEAK_ERR_COMPASS 6 |
||
20 | 'S', // SPEAK_ERR_SENSOR 7 |
||
21 | 'V', // SPEAK_ERR_GPS 8 |
||
22 | 'W', // SPEAK_ERR_MOTOR 9 |
||
23 | 'H', // SPEAK_MAX_TEMPERAT 10 |
||
24 | 0, // SPEAK_ALTI_REACHED 11 |
||
25 | 'X', // SPEAK_WP_REACHED 12 |
||
26 | 'Y', // SPEAK_NEXT_WP 13 |
||
27 | 0, // SPEAK_LANDING 14 |
||
28 | 'Z', // SPEAK_GPS_FIX 15 |
||
29 | 'U', // SPEAK_UNDERVOLTAGE 16 |
||
30 | 'E', // SPEAK_GPS_HOLD 17 |
||
31 | 'F', // SPEAK_GPS_HOME 18 |
||
32 | 'G', // SPEAK_GPS_OFF 19 |
||
33 | 'H', // SPEAK_BEEP 20 |
||
34 | 'A', // SPEAK_MIKROKOPTER 21 |
||
35 | 0, // SPEAK_CAPACITY 22 |
||
36 | 'I', // SPEAK_CF_OFF 23 |
||
37 | 'B', // SPEAK_CALIBRATE 24 |
||
38 | 'J', // SPEAK_MAX_RANGE 25 |
||
39 | 'J', // SPEAK_MAX_ALTITUD 26 |
||
40 | 0, // 27 |
||
41 | 0, // 28 |
||
42 | 0, // 29 |
||
43 | 0, // 30 |
||
44 | 0, // 31 |
||
45 | 0, // 32 |
||
46 | 0, // 33 |
||
47 | 0, // 34 |
||
48 | 0, // 35 |
||
49 | 0, // 36 |
||
50 | 0, // 37 |
||
51 | 'D', // SPEAK_MK_OFF 38 |
||
52 | 'L', // SPEAK_ALTITUDE_ON 39 |
||
53 | 'M', // SPEAK_ALTITUDE_OFF 40 |
||
54 | 0, // 41 |
||
55 | 0, // 42 |
||
56 | 0, // 43 |
||
57 | 0, // 44 |
||
58 | 0, // 45 |
||
59 | 'N', // SPEAK_CF_ON 46 |
||
60 | 0, // SPEAK_SINKING 47 |
||
61 | 0, // SPEAK_RISING 48 |
||
62 | 0, // SPEAK_HOLDING 49 |
||
63 | 'K', // SPEAK_GPS_ON 50 |
||
64 | 0, // SPEAK_FOLLWING 51 |
||
65 | 'C' // SPEAK_STARTING 52 |
||
66 | }; |
||
67 | |||
68 | JetiExPacket_t JetiExData[JETI_EX_PARAMETER_COUNT + 1] = // Parameter count + DeviceName (ID0) |
||
69 | { |
||
70 | // Label[10] unit[3], data type, Data , position of decimal point |
||
71 | // "1234567890", "123", |
||
72 | { "-=.M_K.=-" , " ", 1, 0 , 0 }, // first one is device name // datatype 1 = -8192...8192 |
||
73 | { "Voltage " , "V ", 1, 0 , 1 }, // ID 1 |
||
74 | { "Current " , "A ", 1, 0 , 1 }, // ID 2 |
||
75 | { "Capacity " , "Ah ", 1, 0 , 2 }, // ID 3 |
||
76 | { "Altitude " , "m ", 1, 0 , 0 }, // ID 4 |
||
77 | { "Compass " , "° ", 1, 0 , 0 }, // ID 5 |
||
78 | { "Sats " , " ", 1, 0 , 0 }, // ID 6 |
||
79 | { "Speed " , "m/s", 1, 0 , 0 }, // ID 7 |
||
80 | { "Distance " , "m ", 1, 0 , 0 }, // ID 8 |
||
81 | { "Home-Dir " , "° ", 1, 0 , 0 }, // ID 9 |
||
82 | { "max.Temp. " , "°C ", 1, 0 , 0 }, // ID 10 |
||
83 | { "Magn.field" , "% ", 1, 0 , 0 }, // ID 11 |
||
84 | { "Vario " , " ", 1, 0 , 0 }, // ID 12 |
||
85 | { "ErrorCode " , " ", 1, 0 , 0 }, // ID 13 |
||
86 | { "frei " , " ", 1, 0 , 3 }, // ID 14 |
||
87 | { "frei " , " ", 1, 0 , 3 }, // ID 15 |
||
88 | }; |
||
89 | |||
90 | |||
91 | void BuildJeti_Vario(void) |
||
92 | { |
||
93 | signed int tmp = 0; |
||
94 | static signed int JetiVarioMeter = 0; |
||
95 | JetiVarioMeter = (JetiVarioMeter * 3 + VarioMeter) / 4; |
||
96 | |||
97 | if(VarioCharacter == '+') |
||
98 | { |
||
99 | tmp = (AltitudeSetpointTrimming * EE_Parameter.Hoehe_Verstaerkung) / 32 + 5; |
||
100 | } |
||
101 | else |
||
102 | if(VarioCharacter == '-') |
||
103 | { |
||
104 | tmp = (AltitudeSetpointTrimming * EE_Parameter.Hoehe_Verstaerkung) / 32 - 5; |
||
105 | } |
||
106 | else |
||
107 | if((VarioCharacter == ' ') && (FC_StatusFlags & FC_STATUS_FLY)) |
||
108 | { |
||
109 | tmp = (JetiVarioMeter/32); |
||
110 | } |
||
111 | else |
||
112 | if(VarioCharacter == '^') tmp = FromNC_AltitudeSpeed; |
||
113 | else |
||
114 | if(VarioCharacter == 'v') tmp = tmp - FromNC_AltitudeSpeed; |
||
115 | |||
116 | JetiExData[12].Value = tmp; |
||
117 | } |
||
118 | |||
119 | |||
120 | // -------------------------------------------------------------------------------------------------- |
||
121 | void JetiEX_Update(void) |
||
122 | { |
||
123 | |||
124 | GetHottestBl(); |
||
125 | |||
126 | JetiExData[1].Value = UBat; |
||
127 | JetiExData[2].Value = Capacity.ActualCurrent; |
||
128 | JetiExData[3].Value = Capacity.UsedCapacity / 10; |
||
129 | JetiExData[4].Value = HoehenWert / 100; |
||
130 | JetiExData[5].Value = KompassValue; |
||
131 | JetiExData[6].Value = GPSInfo.NumOfSats; |
||
132 | JetiExData[7].Value = GPSInfo.Speed; |
||
133 | JetiExData[8].Value = GPSInfo.HomeDistance / 10; |
||
134 | JetiExData[9].Value = GPSInfo.HomeBearing; |
||
135 | JetiExData[10].Value = MaxBlTempertaure; |
||
136 | JetiExData[11].Value = EarthMagneticField; |
||
137 | // JetiExData[12].Value = Vario; |
||
138 | JetiExData[13].Value = NC_ErrorCode; |
||
139 | } |
||
140 | #endif |