Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2263 | holgerb | 1 | #include "libfc.h" |
2182 | ingob | 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 | |||
2263 | holgerb | 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 | }; |
||
2182 | ingob | 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", |
||
2341 | holgerb | 72 | // { "-=.M_K.=-" , " ", 1, 0 , 0 }, // first one is device name // datatype 1 = -8192...8192 |
73 | { "MK " , " ", 1, 0 , 0 }, // first one is device name // datatype 1 = -8192...8192 |
||
2183 | holgerb | 74 | { "Voltage " , "V ", 1, 0 , 1 }, // ID 1 |
75 | { "Current " , "A ", 1, 0 , 1 }, // ID 2 |
||
76 | { "Capacity " , "Ah ", 1, 0 , 2 }, // ID 3 |
||
77 | { "Altitude " , "m ", 1, 0 , 0 }, // ID 4 |
||
78 | { "Compass " , "° ", 1, 0 , 0 }, // ID 5 |
||
79 | { "Sats " , " ", 1, 0 , 0 }, // ID 6 |
||
80 | { "Speed " , "m/s", 1, 0 , 0 }, // ID 7 |
||
81 | { "Distance " , "m ", 1, 0 , 0 }, // ID 8 |
||
82 | { "Home-Dir " , "° ", 1, 0 , 0 }, // ID 9 |
||
2182 | ingob | 83 | { "max.Temp. " , "°C ", 1, 0 , 0 }, // ID 10 |
2183 | holgerb | 84 | { "Magn.field" , "% ", 1, 0 , 0 }, // ID 11 |
2182 | ingob | 85 | { "Vario " , " ", 1, 0 , 0 }, // ID 12 |
2183 | holgerb | 86 | { "ErrorCode " , " ", 1, 0 , 0 }, // ID 13 |
2375 | ingob | 87 | { "Latitude " , " ", 9, 0 , 0 }, // ID 14 special data type for coordinates Import: fixed position in list ID 14 - DO NOT MOVE !!! |
88 | { "Longitude " , " ", 9, 0 , 0 }, // ID 15 special data type for coordinates Import: fixed position in list ID 15 - DO NOT MOVE !!! |
||
2182 | ingob | 89 | }; |
90 | |||
91 | |||
2263 | holgerb | 92 | void BuildJeti_Vario(void) |
93 | { |
||
94 | signed int tmp = 0; |
||
95 | static signed int JetiVarioMeter = 0; |
||
96 | JetiVarioMeter = (JetiVarioMeter * 3 + VarioMeter) / 4; |
||
97 | |||
98 | if(VarioCharacter == '+') |
||
99 | { |
||
100 | tmp = (AltitudeSetpointTrimming * EE_Parameter.Hoehe_Verstaerkung) / 32 + 5; |
||
101 | } |
||
102 | else |
||
103 | if(VarioCharacter == '-') |
||
104 | { |
||
105 | tmp = (AltitudeSetpointTrimming * EE_Parameter.Hoehe_Verstaerkung) / 32 - 5; |
||
106 | } |
||
107 | else |
||
108 | if((VarioCharacter == ' ') && (FC_StatusFlags & FC_STATUS_FLY)) |
||
109 | { |
||
110 | tmp = (JetiVarioMeter/32); |
||
111 | } |
||
112 | else |
||
113 | if(VarioCharacter == '^') tmp = FromNC_AltitudeSpeed; |
||
114 | else |
||
115 | if(VarioCharacter == 'v') tmp = tmp - FromNC_AltitudeSpeed; |
||
116 | |||
117 | JetiExData[12].Value = tmp; |
||
118 | } |
||
119 | |||
120 | |||
2182 | ingob | 121 | // -------------------------------------------------------------------------------------------------- |
122 | void JetiEX_Update(void) |
||
123 | { |
||
2263 | holgerb | 124 | |
2375 | ingob | 125 | #define GPS_NORTH 0 |
126 | #define GPS_SOUTH 2 |
||
127 | #define GPS_EAST 0 |
||
128 | #define GPS_WEST 2 |
||
129 | #define GPS_LONGITUDE 1 |
||
130 | #define GPS_LATITUDE 0 |
||
131 | |||
132 | GetHottestBl(); |
||
2182 | ingob | 133 | |
134 | JetiExData[1].Value = UBat; |
||
135 | JetiExData[2].Value = Capacity.ActualCurrent; |
||
136 | JetiExData[3].Value = Capacity.UsedCapacity / 10; |
||
137 | JetiExData[4].Value = HoehenWert / 100; |
||
138 | JetiExData[5].Value = KompassValue; |
||
139 | JetiExData[6].Value = GPSInfo.NumOfSats; |
||
140 | JetiExData[7].Value = GPSInfo.Speed; |
||
141 | JetiExData[8].Value = GPSInfo.HomeDistance / 10; |
||
142 | JetiExData[9].Value = GPSInfo.HomeBearing; |
||
2373 | holgerb | 143 | JetiExData[10].Value = MaxBlTemperture; |
2182 | ingob | 144 | JetiExData[11].Value = EarthMagneticField; |
2263 | holgerb | 145 | // JetiExData[12].Value = Vario; |
146 | JetiExData[13].Value = NC_ErrorCode; |
||
2375 | ingob | 147 | |
148 | JetiExData[14].Value = 53 * 0x10000 + 23467; |
||
149 | JetiExData[14].DecimalPointPos = GPS_LATITUDE + GPS_NORTH; |
||
150 | |||
151 | JetiExData[15].Value = 7 * 0x10000 + 34178; |
||
152 | JetiExData[15].DecimalPointPos = GPS_LONGITUDE + GPS_WEST ; |
||
153 | |||
154 | |||
155 | |||
2182 | ingob | 156 | } |
157 | #endif |