Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2506 | - | 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 | { "MK " , " ", 1, 0 , 0 }, // first one is device name // datatype 1 = -8192...8192 |
||
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 |
||
83 | { "max.Temp. " , "°C ", 1, 0 , 0 }, // ID 10 |
||
84 | { "Magn.field" , "% ", 1, 0 , 0 }, // ID 11 |
||
85 | { "Vario " , " ", 1, 0 , 0 }, // ID 12 |
||
86 | { "ErrorCode " , " ", 1, 0 , 0 }, // ID 13 |
||
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 !!! |
||
89 | }; |
||
90 | |||
91 | |||
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 | |||
121 | // -------------------------------------------------------------------------------------------------- |
||
122 | void JetiEX_Update(void) |
||
123 | { |
||
124 | |||
125 | GetHottestBl(); |
||
126 | |||
127 | JetiExData[1].Value = UBat; |
||
128 | JetiExData[2].Value = Capacity.ActualCurrent; |
||
129 | JetiExData[3].Value = Capacity.UsedCapacity / 10; |
||
130 | JetiExData[4].Value = HoehenWert / 100; |
||
131 | JetiExData[5].Value = KompassValue; |
||
132 | JetiExData[6].Value = GPSInfo.NumOfSats; |
||
133 | JetiExData[7].Value = GPSInfo.Speed; |
||
134 | JetiExData[8].Value = GPSInfo.HomeDistance / 10; |
||
135 | JetiExData[9].Value = GPSInfo.HomeBearing; |
||
136 | JetiExData[10].Value = MaxBlTemperture; |
||
137 | JetiExData[11].Value = EarthMagneticField; |
||
138 | // JetiExData[12].Value = Vario; // wird in BuildJeti_Vario() gemacht |
||
139 | JetiExData[13].Value = NC_ErrorCode; |
||
140 | //JetiExData[14].Value = 53 * 0x10000 + 23467; // GPS-Latitude (macht NC_Fills_HoTT_Telemety() ) |
||
141 | //JetiExData[15].Value = 7 * 0x10000 + 23467; // GPS-Longitude (macht NC_Fills_HoTT_Telemety() ) |
||
142 | |||
143 | } |
||
144 | #endif |