Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
41 | ingob | 1 | #ifndef _MAIN_H |
2 | #define _MAIN_H |
||
1 | ingob | 3 | |
314 | killagreg | 4 | |
318 | holgerb | 5 | //#define FOLLOW_ME |
314 | killagreg | 6 | |
7 | #ifdef FOLLOW_ME |
||
8 | extern u8 TransmitAlsoToFC; |
||
9 | #endif |
||
10 | |||
250 | ingob | 11 | //----------------------- |
256 | killagreg | 12 | //#define DEBUG 0 |
250 | ingob | 13 | //----------------------- |
14 | |||
41 | ingob | 15 | #define VERSION_MAJOR 0 |
318 | holgerb | 16 | #define VERSION_MINOR 25 |
331 | holgerb | 17 | #define VERSION_PATCH 12 |
283 | holgerb | 18 | // 0 = A |
19 | // 1 = B |
||
20 | // 2 = C |
||
21 | // 3 = D |
||
22 | // 4 = E |
||
23 | // 5 = F |
||
24 | // 6 = G |
||
25 | // 7 = H |
||
26 | // 8 = I |
||
287 | holgerb | 27 | // 9 = J |
290 | holgerb | 28 | // 10 = k |
291 | holgerb | 29 | // 11 = L |
294 | holgerb | 30 | // 12 = M |
298 | holgerb | 31 | // 13 = N |
32 | // 14 = o |
||
1 | ingob | 33 | |
193 | killagreg | 34 | #define VERSION_SERIAL_MAJOR 11 |
35 | #define VERSION_SERIAL_MINOR 0 |
||
73 | killagreg | 36 | |
317 | holgerb | 37 | #ifndef FOLLOW_ME |
331 | holgerb | 38 | #define FC_SPI_COMPATIBLE 25 |
317 | holgerb | 39 | #else |
316 | killagreg | 40 | #define FC_SPI_COMPATIBLE 0xFF |
41 | #endif |
||
42 | |||
229 | holgerb | 43 | #define MK3MAG_I2C_COMPATIBLE 3 |
241 | killagreg | 44 | |
320 | holgerb | 45 | // FC.StatusFlags |
255 | killagreg | 46 | #define FC_STATUS_MOTOR_RUN 0x01 |
47 | #define FC_STATUS_FLY 0x02 |
||
48 | #define FC_STATUS_CALIBRATE 0x04 |
||
49 | #define FC_STATUS_START 0x08 |
||
50 | #define FC_STATUS_EMERGENCY_LANDING 0x10 |
||
51 | #define FC_STATUS_LOWBAT 0x20 |
||
279 | holgerb | 52 | #define FC_STATUS_VARIO_TRIM_UP 0x40 |
53 | #define FC_STATUS_VARIO_TRIM_DOWN 0x80 |
||
78 | holgerb | 54 | |
320 | holgerb | 55 | // FC.StatusFlags2 |
294 | holgerb | 56 | #define FC_STATUS2_CAREFREE 0x01 |
57 | #define FC_STATUS2_ALTITUDE_CONTROL 0x02 |
||
322 | holgerb | 58 | #define FC_STATUS2_RC_FAILSAVE_ACTIVE 0x04 |
294 | holgerb | 59 | |
60 | |||
255 | killagreg | 61 | // FC ERRORS FLAGS |
62 | #define FC_ERROR0_GYRO_NICK 0x01 |
||
63 | #define FC_ERROR0_GYRO_ROLL 0x02 |
||
64 | #define FC_ERROR0_GYRO_YAW 0x04 |
||
65 | #define FC_ERROR0_ACC_NICK 0x08 |
||
66 | #define FC_ERROR0_ACC_ROLL 0x10 |
||
67 | #define FC_ERROR0_ACC_TOP 0x20 |
||
68 | #define FC_ERROR0_PRESSURE 0x40 |
||
69 | #define FC_ERROR0_CAREFREE 0x80 |
||
70 | |||
71 | #define FC_ERROR1_I2C 0x01 |
||
72 | #define FC_ERROR1_BL_MISSING 0x02 |
||
73 | #define FC_ERROR1_SPI_RX 0x04 |
||
74 | #define FC_ERROR1_PPM 0x08 |
||
75 | #define FC_ERROR1_MIXER 0x10 |
||
76 | #define FC_ERROR1_RES1 0x20 |
||
77 | #define FC_ERROR1_RES2 0x40 |
||
78 | #define FC_ERROR1_RES3 0x80 |
||
79 | |||
146 | killagreg | 80 | // NC Errors |
81 | #define NCERR_FLAG_FC_COMPATIBLE 0x00000001 |
||
82 | #define NCERR_FLAG_MK3MAG_COMPATIBLE 0x00000002 |
||
83 | #define NCERR_FLAG_FC_COMMUNICATION 0x00000004 |
||
84 | #define NCERR_FLAG_MK3MAG_COMMUNICATION 0x00000008 |
||
85 | #define NCERR_FLAG_MKGPS_COMMUNICATION 0x00000010 |
||
86 | #define NCERR_FLAG_BAD_COMPASS_HEADING 0x00000020 |
||
87 | #define NCERR_FLAG_RC_SIGNAL_LOST 0x00000040 |
||
264 | killagreg | 88 | #define NCERR_FLAG_EEPROM_NOT_FOUND 0x00000080 |
49 | ingob | 89 | |
320 | holgerb | 90 | // Parameter.GlobalConfig |
331 | holgerb | 91 | #define FC_CFG_HOEHENREGELUNG 0x01 |
92 | #define FC_CFG_HOEHEN_SCHALTER 0x02 |
||
93 | #define FC_CFG_HEADING_HOLD 0x04 |
||
94 | #define FC_CFG_KOMPASS_AKTIV 0x08 |
||
95 | #define FC_CFG_KOMPASS_FIX 0x10 |
||
96 | #define FC_CFG_GPS_AKTIV 0x20 |
||
97 | #define FC_CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
||
98 | #define FC_CFG_DREHRATEN_BEGRENZER 0x80 |
||
190 | killagreg | 99 | |
331 | holgerb | 100 | //Parameter.ExtraConfig |
101 | #define CFG2_HEIGHT_LIMIT 0x01 |
||
102 | #define CFG2_VARIO_BEEP 0x02 |
||
103 | #define CFG_SENSITIVE_RC 0x04 |
||
104 | #define CFG_3_3V_REFERENCE 0x08 |
||
105 | #define CFG_NO_RCOFF_BEEPING 0x10 |
||
106 | #define CFG_GPS_AID 0x20 |
||
107 | #define CFG_TEACHABLE_CAREFREE 0x40 |
||
108 | #define CFG_IGNORE_MAG_ERR_AT_STARTUP 0x80 |
||
320 | holgerb | 109 | |
190 | killagreg | 110 | #define LIMIT_MIN(value, min) {if(value <= min) value = min;} |
111 | #define LIMIT_MAX(value, max) {if(value >= max) value = max;} |
||
112 | #define LIMIT_MIN_MAX(value, min, max) {if(value <= min) value = min; else if(value >= max) value = max;} |
||
113 | |||
327 | holgerb | 114 | |
115 | #define Poti1 FC.Poti[0] |
||
116 | #define Poti2 FC.Poti[1] |
||
117 | #define Poti3 FC.Poti[2] |
||
118 | #define Poti4 FC.Poti[3] |
||
119 | #define Poti5 FC.Poti[4] |
||
120 | #define Poti6 FC.Poti[5] |
||
121 | #define Poti7 FC.Poti[6] |
||
122 | #define Poti8 FC.Poti[7] |
||
123 | |||
41 | ingob | 124 | extern u16 BeepTime; |
92 | killagreg | 125 | extern u8 NCFlags; |
255 | killagreg | 126 | extern u8 ClearFCStatusFlags; |
41 | ingob | 127 | void Interrupt_Init(void); |
153 | killagreg | 128 | extern s16 GeoMagDec; |
1 | ingob | 129 | |
41 | ingob | 130 | typedef struct |
131 | { |
||
132 | u8 ActiveSetting; |
||
133 | u8 User1; |
||
134 | u8 User2; |
||
135 | u8 User3; |
||
136 | u8 User4; |
||
137 | u8 User5; |
||
138 | u8 User6; |
||
139 | u8 User7; |
||
140 | u8 User8; |
||
141 | u8 NaviGpsModeControl; |
||
142 | u8 NaviGpsGain; |
||
143 | u8 NaviGpsP; |
||
144 | u8 NaviGpsI; |
||
145 | u8 NaviGpsD; |
||
56 | holgerb | 146 | u8 NaviGpsPLimit; |
147 | u8 NaviGpsILimit; |
||
148 | u8 NaviGpsDLimit; |
||
41 | ingob | 149 | u8 NaviGpsACC; |
150 | u8 NaviGpsMinSat; |
||
151 | u8 NaviStickThreshold; |
||
152 | u8 NaviOperatingRadius; |
||
153 | u8 NaviWindCorrection; |
||
327 | holgerb | 154 | u8 NaviAccCompensation; |
41 | ingob | 155 | u8 NaviSpeedCompensation; |
156 | u8 LowVoltageWarning; |
||
157 | u8 NaviAngleLimitation; |
||
56 | holgerb | 158 | u8 NaviPH_LoginTime; |
320 | holgerb | 159 | u8 OrientationAngle; |
160 | u8 GlobalConfig; |
||
161 | u8 ExtraConfig; |
||
321 | holgerb | 162 | u8 ComingHomeAltitude; |
41 | ingob | 163 | } __attribute__((packed)) Param_t; |
1 | ingob | 164 | |
41 | ingob | 165 | typedef struct |
166 | { |
||
167 | s8 StickNick; |
||
168 | s8 StickRoll; |
||
169 | s8 StickYaw; |
||
170 | s8 StickGas; |
||
190 | killagreg | 171 | u8 Poti[8]; |
41 | ingob | 172 | u8 RC_Quality; |
125 | killagreg | 173 | u8 RC_RSSI; |
206 | killagreg | 174 | u8 BAT_Voltage; |
175 | u16 BAT_Current; |
||
176 | u16 BAT_UsedCapacity; |
||
255 | killagreg | 177 | u8 StatusFlags; |
178 | u8 Error[5]; |
||
294 | holgerb | 179 | u8 StatusFlags2; |
41 | ingob | 180 | } __attribute__((packed)) FC_t; |
1 | ingob | 181 | |
242 | killagreg | 182 | |
41 | ingob | 183 | extern Param_t Parameter; |
78 | holgerb | 184 | extern volatile FC_t FC; |
41 | ingob | 185 | extern s8 ErrorMSG[25]; |
241 | killagreg | 186 | extern u8 ErrorCode; |
41 | ingob | 187 | extern u8 StopNavigation; |
328 | holgerb | 188 | extern u8 ErrorGpsFixLost; |
41 | ingob | 189 | #endif // _MAIN_H |