Rev 681 | Rev 688 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 681 | Rev 683 | ||
---|---|---|---|
1 | #ifndef _MAIN_H |
1 | #ifndef _MAIN_H |
2 | #define _MAIN_H |
2 | #define _MAIN_H |
3 | 3 | ||
4 | 4 | ||
5 | //#define FOLLOW_ME |
5 | //#define FOLLOW_ME |
6 | 6 | ||
7 | #ifdef FOLLOW_ME |
7 | #ifdef FOLLOW_ME |
8 | extern u8 TransmitAlsoToFC; |
8 | extern u8 TransmitAlsoToFC; |
9 | #endif |
9 | #endif |
10 | 10 | ||
11 | //----------------------- |
11 | //----------------------- |
12 | //#define DEBUG 0 |
12 | //#define DEBUG 0 |
13 | //----------------------- |
13 | //----------------------- |
14 | 14 | ||
15 | #define VERSION_MAJOR 2 |
15 | #define VERSION_MAJOR 2 |
16 | #define VERSION_MINOR 11 |
16 | #define VERSION_MINOR 12 |
17 | #define VERSION_PATCH 6 |
17 | #define VERSION_PATCH 0 |
18 | // 0 = A |
18 | // 0 = A |
19 | // 1 = B |
19 | // 1 = B |
20 | // 2 = C |
20 | // 2 = C |
21 | // 3 = D |
21 | // 3 = D |
22 | // 4 = E |
22 | // 4 = E |
23 | // 5 = F |
23 | // 5 = F |
24 | // 6 = G |
24 | // 6 = G |
25 | // 7 = H |
25 | // 7 = H |
26 | // 8 = I |
26 | // 8 = I |
27 | // 9 = J |
27 | // 9 = J |
28 | // 10 = k |
28 | // 10 = k |
29 | // 11 = L |
29 | // 11 = L |
30 | // 12 = M |
30 | // 12 = M |
31 | // 13 = N |
31 | // 13 = N |
32 | // 14 = O |
32 | // 14 = O |
33 | // 15 = P |
33 | // 15 = P |
34 | // 16 = Q |
34 | // 16 = Q |
35 | // 17 = R |
35 | // 17 = R |
36 | // 18 = S |
36 | // 18 = S |
37 | 37 | ||
38 | #ifndef FOLLOW_ME |
38 | #ifndef FOLLOW_ME |
39 | #define FC_SPI_COMPATIBLE 76 // <------------------ |
39 | #define FC_SPI_COMPATIBLE 76 // <------------------ |
40 | #else |
40 | #else |
41 | #define FC_SPI_COMPATIBLE 0xFF |
41 | #define FC_SPI_COMPATIBLE 0xFF |
42 | #endif |
42 | #endif |
43 | 43 | ||
44 | #define MK3MAG_I2C_COMPATIBLE 3 |
44 | #define MK3MAG_I2C_COMPATIBLE 3 |
45 | #define MAX_MOTORS 16 // since 2.10 (3.2014) |
45 | #define MAX_MOTORS 16 // since 2.10 (3.2014) |
46 | 46 | ||
47 | // FC.StatusFlags |
47 | // FC.StatusFlags |
48 | #define FC_STATUS_MOTOR_RUN 0x01 |
48 | #define FC_STATUS_MOTOR_RUN 0x01 |
49 | #define FC_STATUS_FLY 0x02 |
49 | #define FC_STATUS_FLY 0x02 |
50 | #define FC_STATUS_CALIBRATE 0x04 |
50 | #define FC_STATUS_CALIBRATE 0x04 |
51 | #define FC_STATUS_START 0x08 |
51 | #define FC_STATUS_START 0x08 |
52 | #define FC_STATUS_EMERGENCY_LANDING 0x10 |
52 | #define FC_STATUS_EMERGENCY_LANDING 0x10 |
53 | #define FC_STATUS_LOWBAT 0x20 |
53 | #define FC_STATUS_LOWBAT 0x20 |
54 | #define FC_STATUS_VARIO_TRIM_UP 0x40 |
54 | #define FC_STATUS_VARIO_TRIM_UP 0x40 |
55 | #define FC_STATUS_VARIO_TRIM_DOWN 0x80 |
55 | #define FC_STATUS_VARIO_TRIM_DOWN 0x80 |
56 | 56 | ||
57 | // FC.StatusFlags2 |
57 | // FC.StatusFlags2 |
58 | #define FC_STATUS2_CAREFREE 0x01 |
58 | #define FC_STATUS2_CAREFREE 0x01 |
59 | #define FC_STATUS2_ALTITUDE_CONTROL 0x02 |
59 | #define FC_STATUS2_ALTITUDE_CONTROL 0x02 |
60 | #define FC_STATUS2_RC_FAILSAVE_ACTIVE 0x04 |
60 | #define FC_STATUS2_RC_FAILSAVE_ACTIVE 0x04 |
61 | #define FC_STATUS2_OUT1_ACTIVE 0x08 |
61 | #define FC_STATUS2_OUT1_ACTIVE 0x08 |
62 | #define FC_STATUS2_OUT2_ACTIVE 0x10 |
62 | #define FC_STATUS2_OUT2_ACTIVE 0x10 |
63 | #define FC_STATUS2_WAIT_FOR_TAKEOFF 0x20 // Motor Running, but still on the ground |
63 | #define FC_STATUS2_WAIT_FOR_TAKEOFF 0x20 // Motor Running, but still on the ground |
64 | 64 | ||
65 | // FC.StatusFlags3 |
65 | // FC.StatusFlags3 |
66 | #define FC_STATUS3_REDUNDANCE_AKTIVE 0x01 |
66 | #define FC_STATUS3_REDUNDANCE_AKTIVE 0x01 |
67 | #define FC_STATUS3_BOAT 0x02 |
67 | #define FC_STATUS3_BOAT 0x02 |
68 | #define FC_STATUS3_REDUNDANCE_ERROR 0x04 |
68 | #define FC_STATUS3_REDUNDANCE_ERROR 0x04 |
69 | #define FC_STATUS3_REDUNDANCE_TEST 0x08 |
69 | #define FC_STATUS3_REDUNDANCE_TEST 0x08 |
70 | 70 | ||
71 | #define OSD_FLAG_MASK1 (0x04 + 0x20 + 0x40 + 0x80) |
71 | #define OSD_FLAG_MASK1 (0x04 + 0x20 + 0x40 + 0x80) |
72 | #define OSD_FLAG_MASK2 (0x01 + 0x02 + 0x08 + 0x10) |
72 | #define OSD_FLAG_MASK2 (0x01 + 0x02 + 0x08 + 0x10) |
73 | 73 | ||
74 | // .NCFlags |
74 | // .NCFlags |
75 | #define NC_FLAG_FREE 0x01 |
75 | #define NC_FLAG_FREE 0x01 |
76 | #define NC_FLAG_PH 0x02 |
76 | #define NC_FLAG_PH 0x02 |
77 | #define NC_FLAG_CH 0x04 |
77 | #define NC_FLAG_CH 0x04 |
78 | #define NC_FLAG_RANGE_LIMIT 0x08 |
78 | #define NC_FLAG_RANGE_LIMIT 0x08 |
79 | #define NC_FLAG_NOSERIALLINK 0x10 |
79 | #define NC_FLAG_NOSERIALLINK 0x10 |
80 | #define NC_FLAG_TARGET_REACHED 0x20 |
80 | #define NC_FLAG_TARGET_REACHED 0x20 |
81 | #define NC_FLAG_MANUAL_CONTROL 0x40 |
81 | #define NC_FLAG_MANUAL_CONTROL 0x40 |
82 | #define NC_FLAG_GPS_OK 0x80 |
82 | #define NC_FLAG_GPS_OK 0x80 |
83 | 83 | ||
84 | 84 | ||
85 | // NC calculates |
85 | // NC calculates |
86 | //OSDStatusFlags = (FC.StatusFlags & OSD_FLAG_MASK1) | (FC.StatusFlags2 & OSD_FLAG_MASK2); |
86 | //OSDStatusFlags = (FC.StatusFlags & OSD_FLAG_MASK1) | (FC.StatusFlags2 & OSD_FLAG_MASK2); |
87 | //OSDStatusFlags2 = (FC.StatusFlags & ~OSD_FLAG_MASK1) | (FC.StatusFlags2 & ~OSD_FLAG_MASK2); |
87 | //OSDStatusFlags2 = (FC.StatusFlags & ~OSD_FLAG_MASK1) | (FC.StatusFlags2 & ~OSD_FLAG_MASK2); |
88 | 88 | ||
89 | //calculate Back: |
89 | //calculate Back: |
90 | //FC.StatusFlags = (OSDStatusFlags & OSD_FLAG_MASK1) | (OSDStatusFlags2 & ~OSD_FLAG_MASK1); |
90 | //FC.StatusFlags = (OSDStatusFlags & OSD_FLAG_MASK1) | (OSDStatusFlags2 & ~OSD_FLAG_MASK1); |
91 | //FC.StatusFlags2 = (OSDStatusFlags & OSD_FLAG_MASK2) | (OSDStatusFlags2 & ~OSD_FLAG_MASK2); |
91 | //FC.StatusFlags2 = (OSDStatusFlags & OSD_FLAG_MASK2) | (OSDStatusFlags2 & ~OSD_FLAG_MASK2); |
92 | 92 | ||
93 | // FC ERRORS FLAGS |
93 | // FC ERRORS FLAGS |
94 | #define FC_ERROR0_GYRO_NICK 0x01 |
94 | #define FC_ERROR0_GYRO_NICK 0x01 |
95 | #define FC_ERROR0_GYRO_ROLL 0x02 |
95 | #define FC_ERROR0_GYRO_ROLL 0x02 |
96 | #define FC_ERROR0_GYRO_YAW 0x04 |
96 | #define FC_ERROR0_GYRO_YAW 0x04 |
97 | #define FC_ERROR0_ACC_NICK 0x08 |
97 | #define FC_ERROR0_ACC_NICK 0x08 |
98 | #define FC_ERROR0_ACC_ROLL 0x10 |
98 | #define FC_ERROR0_ACC_ROLL 0x10 |
99 | #define FC_ERROR0_ACC_TOP 0x20 |
99 | #define FC_ERROR0_ACC_TOP 0x20 |
100 | #define FC_ERROR0_PRESSURE 0x40 |
100 | #define FC_ERROR0_PRESSURE 0x40 |
101 | #define FC_ERROR0_CAREFREE 0x80 |
101 | #define FC_ERROR0_CAREFREE 0x80 |
102 | 102 | ||
103 | #define FC_ERROR1_I2C 0x01 |
103 | #define FC_ERROR1_I2C 0x01 |
104 | #define FC_ERROR1_BL_MISSING 0x02 |
104 | #define FC_ERROR1_BL_MISSING 0x02 |
105 | #define FC_ERROR1_SPI_RX 0x04 |
105 | #define FC_ERROR1_SPI_RX 0x04 |
106 | #define FC_ERROR1_PPM 0x08 |
106 | #define FC_ERROR1_PPM 0x08 |
107 | #define FC_ERROR1_MIXER 0x10 |
107 | #define FC_ERROR1_MIXER 0x10 |
108 | #define FC_ERROR1_RES1 0x20 |
108 | #define FC_ERROR1_RES1 0x20 |
109 | #define FC_ERROR1_RES2 0x40 |
109 | #define FC_ERROR1_RES2 0x40 |
110 | #define FC_ERROR1_RES3 0x80 |
110 | #define FC_ERROR1_RES3 0x80 |
111 | 111 | ||
112 | // NC Errors |
112 | // NC Errors |
113 | #define NCERR_FLAG_FC_COMPATIBLE 0x00000001 |
113 | #define NCERR_FLAG_FC_COMPATIBLE 0x00000001 |
114 | #define NCERR_FLAG_MK3MAG_COMPATIBLE 0x00000002 |
114 | #define NCERR_FLAG_MK3MAG_COMPATIBLE 0x00000002 |
115 | #define NCERR_FLAG_FC_COMMUNICATION 0x00000004 |
115 | #define NCERR_FLAG_FC_COMMUNICATION 0x00000004 |
116 | #define NCERR_FLAG_MK3MAG_COMMUNICATION 0x00000008 |
116 | #define NCERR_FLAG_MK3MAG_COMMUNICATION 0x00000008 |
117 | #define NCERR_FLAG_MKGPS_COMMUNICATION 0x00000010 |
117 | #define NCERR_FLAG_MKGPS_COMMUNICATION 0x00000010 |
118 | #define NCERR_FLAG_BAD_COMPASS_HEADING 0x00000020 |
118 | #define NCERR_FLAG_BAD_COMPASS_HEADING 0x00000020 |
119 | #define NCERR_FLAG_RC_SIGNAL_LOST 0x00000040 |
119 | #define NCERR_FLAG_RC_SIGNAL_LOST 0x00000040 |
120 | #define NCERR_FLAG_EEPROM_NOT_FOUND 0x00000080 |
120 | #define NCERR_FLAG_EEPROM_NOT_FOUND 0x00000080 |
121 | 121 | ||
122 | //NC_To_FC_Flags |
122 | //NC_To_FC_Flags |
123 | #define NC_TO_FC_FLYING_RANGE 0x01 |
123 | #define NC_TO_FC_FLYING_RANGE 0x01 |
124 | #define NC_TO_FC_EMERGENCY_LANDING 0x02 |
124 | #define NC_TO_FC_EMERGENCY_LANDING 0x02 |
125 | #define NC_TO_FC_AUTOSTART 0x04 |
125 | #define NC_TO_FC_AUTOSTART 0x04 |
126 | #define NC_TO_FC_FAILSAFE_LANDING 0x08 // activates Servos |
126 | #define NC_TO_FC_FAILSAFE_LANDING 0x08 // activates Servos |
127 | #define NC_TO_FC_SIMULATION_ACTIVE 0x10 // don't start motors if simulation ist active |
127 | #define NC_TO_FC_SIMULATION_ACTIVE 0x10 // don't start motors if simulation ist active |
128 | 128 | ||
129 | //Parameter.GlobalConfig3 |
129 | //Parameter.GlobalConfig3 |
130 | #define CFG3_NO_SDCARD_NO_START 0x01 |
130 | #define CFG3_NO_SDCARD_NO_START 0x01 |
131 | //#define CFG3_DPH_MAX_RADIUS 0x02 |
131 | //#define CFG3_DPH_MAX_RADIUS 0x02 |
132 | #define CFG3_VARIO_FAILSAFE 0x04 |
132 | #define CFG3_VARIO_FAILSAFE 0x04 |
133 | #define CFG3_MOTOR_SWITCH_MODE 0x08 |
133 | #define CFG3_MOTOR_SWITCH_MODE 0x08 |
134 | #define CFG3_NO_GPSFIX_NO_START 0x10 |
134 | #define CFG3_NO_GPSFIX_NO_START 0x10 |
135 | 135 | ||
136 | // Parameter.GlobalConfig |
136 | // Parameter.GlobalConfig |
137 | #define FC_CFG_HOEHENREGELUNG 0x01 |
137 | #define FC_CFG_HOEHENREGELUNG 0x01 |
138 | #define FC_CFG_HOEHEN_SCHALTER 0x02 |
138 | #define FC_CFG_HOEHEN_SCHALTER 0x02 |
139 | #define FC_CFG_HEADING_HOLD 0x04 |
139 | #define FC_CFG_HEADING_HOLD 0x04 |
140 | #define FC_CFG_KOMPASS_AKTIV 0x08 |
140 | #define FC_CFG_KOMPASS_AKTIV 0x08 |
141 | #define FC_CFG_KOMPASS_FIX 0x10 |
141 | #define FC_CFG_KOMPASS_FIX 0x10 |
142 | #define FC_CFG_GPS_AKTIV 0x20 |
142 | #define FC_CFG_GPS_AKTIV 0x20 |
143 | #define FC_CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
143 | #define FC_CFG_ACHSENKOPPLUNG_AKTIV 0x40 |
144 | #define FC_CFG_DREHRATEN_BEGRENZER 0x80 |
144 | #define FC_CFG_DREHRATEN_BEGRENZER 0x80 |
145 | 145 | ||
146 | //Parameter.ExtraConfig |
146 | //Parameter.ExtraConfig |
147 | #define CFG2_HEIGHT_LIMIT 0x01 |
147 | #define CFG2_HEIGHT_LIMIT 0x01 |
148 | #define CFG2_VARIO_BEEP 0x02 |
148 | #define CFG2_VARIO_BEEP 0x02 |
149 | #define CFG_SENSITIVE_RC 0x04 |
149 | #define CFG_SENSITIVE_RC 0x04 |
150 | #define CFG_3_3V_REFERENCE 0x08 |
150 | #define CFG_3_3V_REFERENCE 0x08 |
151 | #define CFG_NO_RCOFF_BEEPING 0x10 |
151 | #define CFG_NO_RCOFF_BEEPING 0x10 |
152 | #define CFG_GPS_AID 0x20 |
152 | #define CFG_GPS_AID 0x20 |
153 | #define CFG_TEACHABLE_CAREFREE 0x40 |
153 | #define CFG_TEACHABLE_CAREFREE 0x40 |
154 | #define CFG_IGNORE_MAG_ERR_AT_STARTUP 0x80 |
154 | #define CFG_IGNORE_MAG_ERR_AT_STARTUP 0x80 |
155 | 155 | ||
156 | // Parameter.HomeYawMode |
156 | // Parameter.HomeYawMode |
157 | #define NO_CHANGE 0 |
157 | #define NO_CHANGE 0 |
158 | #define FRONT_TO_HOME 1 |
158 | #define FRONT_TO_HOME 1 |
159 | #define REAR_TO_HOME 2 |
159 | #define REAR_TO_HOME 2 |
160 | #define LIKE_AT_START 3 |
160 | #define LIKE_AT_START 3 |
161 | 161 | ||
162 | // Parameter.ReceiverType defines for the receiver selection |
162 | // Parameter.ReceiverType defines for the receiver selection |
163 | #define RECEIVER_PPM 0 |
163 | #define RECEIVER_PPM 0 |
164 | #define RECEIVER_SPEKTRUM 1 |
164 | #define RECEIVER_SPEKTRUM 1 |
165 | #define RECEIVER_SPEKTRUM_HI_RES 2 |
165 | #define RECEIVER_SPEKTRUM_HI_RES 2 |
166 | #define RECEIVER_SPEKTRUM_LOW_RES 3 |
166 | #define RECEIVER_SPEKTRUM_LOW_RES 3 |
167 | #define RECEIVER_JETI 4 |
167 | #define RECEIVER_JETI 4 |
168 | #define RECEIVER_ACT_DSL 5 |
168 | #define RECEIVER_ACT_DSL 5 |
169 | #define RECEIVER_HOTT 6 |
169 | #define RECEIVER_HOTT 6 |
170 | #define RECEIVER_SBUS 7 |
170 | #define RECEIVER_SBUS 7 |
171 | #define RECEIVER_USER 8 |
171 | #define RECEIVER_USER 8 |
172 | 172 | ||
173 | #define RECEIVER_UNKNOWN 0xFF |
173 | #define RECEIVER_UNKNOWN 0xFF |
174 | 174 | ||
175 | #define LIMIT_MIN(value, min) {if(value <= min) value = min;} |
175 | #define LIMIT_MIN(value, min) {if(value <= min) value = min;} |
176 | #define LIMIT_MAX(value, max) {if(value >= max) value = max;} |
176 | #define LIMIT_MAX(value, max) {if(value >= max) value = max;} |
177 | #define LIMIT_MIN_MAX(value, min, max) {if(value <= min) value = min; else if(value >= max) value = max;} |
177 | #define LIMIT_MIN_MAX(value, min, max) {if(value <= min) value = min; else if(value >= max) value = max;} |
178 | 178 | ||
179 | 179 | ||
180 | #define Poti1 FC.Poti[0] |
180 | #define Poti1 FC.Poti[0] |
181 | #define Poti2 FC.Poti[1] |
181 | #define Poti2 FC.Poti[1] |
182 | #define Poti3 FC.Poti[2] |
182 | #define Poti3 FC.Poti[2] |
183 | #define Poti4 FC.Poti[3] |
183 | #define Poti4 FC.Poti[3] |
184 | #define Poti5 FC.Poti[4] |
184 | #define Poti5 FC.Poti[4] |
185 | #define Poti6 FC.Poti[5] |
185 | #define Poti6 FC.Poti[5] |
186 | #define Poti7 FC.Poti[6] |
186 | #define Poti7 FC.Poti[6] |
187 | #define Poti8 FC.Poti[7] |
187 | #define Poti8 FC.Poti[7] |
188 | 188 | ||
189 | extern u16 BeepTime; |
189 | extern u16 BeepTime; |
190 | extern u8 NCFlags; |
190 | extern u8 NCFlags; |
191 | extern u8 ClearFCStatusFlags; |
191 | extern u8 ClearFCStatusFlags; |
192 | void Interrupt_Init(void); |
192 | void Interrupt_Init(void); |
193 | extern s16 GeoMagDec; |
193 | extern s16 GeoMagDec; |
194 | extern u8 NewWPL_Name; |
194 | extern u8 NewWPL_Name; |
195 | 195 | ||
196 | #define VERSION_SERIAL_MAJOR 11 // do not change! |
196 | #define VERSION_SERIAL_MAJOR 11 // do not change! |
197 | 197 | ||
198 | typedef struct |
198 | typedef struct |
199 | { |
199 | { |
200 | u8 ActiveSetting; |
200 | u8 ActiveSetting; |
201 | u8 User1; |
201 | u8 User1; |
202 | u8 User2; |
202 | u8 User2; |
203 | u8 User3; |
203 | u8 User3; |
204 | u8 User4; |
204 | u8 User4; |
205 | u8 User5; |
205 | u8 User5; |
206 | u8 User6; |
206 | u8 User6; |
207 | u8 User7; |
207 | u8 User7; |
208 | u8 User8; |
208 | u8 User8; |
209 | u8 NaviGpsModeControl; |
209 | u8 NaviGpsModeControl; |
210 | u8 NaviGpsGain; |
210 | u8 NaviGpsGain; |
211 | u8 NaviGpsP; |
211 | u8 NaviGpsP; |
212 | u8 NaviGpsI; |
212 | u8 NaviGpsI; |
213 | u8 NaviGpsD; |
213 | u8 NaviGpsD; |
214 | u8 NaviGpsPLimit; |
214 | u8 NaviGpsPLimit; |
215 | u8 NaviGpsILimit; |
215 | u8 NaviGpsILimit; |
216 | u8 NaviGpsDLimit; |
216 | u8 NaviGpsDLimit; |
217 | u8 NaviGpsACC; |
217 | u8 NaviGpsACC; |
218 | u8 NaviGpsMinSat; |
218 | u8 NaviGpsMinSat; |
219 | u8 NaviStickThreshold; |
219 | u8 NaviStickThreshold; |
220 | u8 NaviMaxFlyingRange; // in 10m |
220 | u8 NaviMaxFlyingRange; // in 10m |
221 | u8 NaviWindCorrection; |
221 | u8 NaviWindCorrection; |
222 | u8 NaviAccCompensation; |
222 | u8 NaviAccCompensation; |
223 | u8 NaviSpeedCompensation; |
223 | u8 NaviSpeedCompensation; |
224 | u8 LowVoltageWarning; |
224 | u8 LowVoltageWarning; |
225 | u8 NaviAngleLimitation; |
225 | u8 NaviAngleLimitation; |
226 | u8 NaviPH_LoginTime; |
226 | u8 NaviPH_LoginTime; |
227 | u8 OrientationAngle; // where is front - in 15° |
227 | u8 OrientationAngle; // where is front - in 15° |
228 | u8 CamOrientation; // direction of the camera in 15° |
228 | u8 CamOrientation; // direction of the camera in 15° |
229 | u8 GlobalConfig; |
229 | u8 GlobalConfig; |
230 | u8 ExtraConfig; |
230 | u8 ExtraConfig; |
231 | u8 ComingHomeAltitude; |
231 | u8 ComingHomeAltitude; |
232 | u8 GlobalConfig3; |
232 | u8 GlobalConfig3; |
233 | u8 AutoPhotoDistance; // Distance between Photo releases (Position) |
233 | u8 AutoPhotoDistance; // Distance between Photo releases (Position) |
234 | u8 FromFC_LandingSpeed; |
234 | u8 FromFC_LandingSpeed; |
235 | u8 FromFC_LowVoltageHomeActive; |
235 | u8 FromFC_LowVoltageHomeActive; |
236 | u8 AutoPhotoAltitudes; // Distance between Photo releases (Altitudes) |
236 | u8 AutoPhotoAltitudes; // Distance between Photo releases (Altitudes) |
237 | u8 SingleWpSpeed; |
237 | u8 SingleWpSpeed; |
238 | u8 DescendRange; // in 10m |
238 | u8 DescendRange; // in 10m |
239 | u8 MaximumAltitude; // in m |
239 | u8 MaximumAltitude; // in m |
240 | u8 Driftkomp; |
240 | u8 Driftkomp; |
241 | u8 ReceiverType; |
241 | u8 ReceiverType; |
242 | u8 HomeYawMode; |
242 | u8 HomeYawMode; |
243 | u8 Speak100m; |
243 | u8 Speak100m; |
244 | u8 AutoWpEventValue; |
244 | u8 AutoWpEventValue; |
245 | u8 FailSafeTime; |
245 | u8 FailSafeTime; |
246 | } __attribute__((packed)) Param_t; |
246 | } __attribute__((packed)) Param_t; |
247 | 247 | ||
248 | typedef struct |
248 | typedef struct |
249 | { |
249 | { |
250 | s8 StickNick; |
250 | s8 StickNick; |
251 | s8 StickRoll; |
251 | s8 StickRoll; |
252 | s8 StickYaw; |
252 | s8 StickYaw; |
253 | s8 StickGas; |
253 | s8 StickGas; |
254 | u8 Poti[8]; |
254 | u8 Poti[8]; |
255 | u8 RC_Quality; |
255 | u8 RC_Quality; |
256 | u8 RC_RSSI; |
256 | u8 RC_RSSI; |
257 | u16 BAT_Voltage; |
257 | u16 BAT_Voltage; |
258 | u16 BAT_Current; |
258 | u16 BAT_Current; |
259 | u16 BAT_UsedCapacity; |
259 | u16 BAT_UsedCapacity; |
260 | u8 StatusFlags; |
260 | u8 StatusFlags; |
261 | u8 Error[5]; |
261 | u8 Error[5]; |
262 | u8 StatusFlags2; |
262 | u8 StatusFlags2; |
263 | u8 FromFC_SpeakHoTT; |
263 | u8 FromFC_SpeakHoTT; |
264 | s16 FromFC_CompassOffset; |
264 | s16 FromFC_CompassOffset; |
265 | u8 FromFC_DisableDeclination; |
265 | u8 FromFC_DisableDeclination; |
266 | u8 StatusFlags3; |
266 | u8 StatusFlags3; |
267 | s16 Altimeter; |
267 | s16 Altimeter; |
268 | u8 RealStatusFlags; // this is a copy of the status flags -> but not effected by the simulation |
268 | u8 RealStatusFlags; // this is a copy of the status flags -> but not effected by the simulation |
269 | u16 AdNeutralNick; |
269 | u16 AdNeutralNick; |
270 | u16 AdNeutralRoll; |
270 | u16 AdNeutralRoll; |
271 | u16 AdNeutralYaw; |
271 | u16 AdNeutralYaw; |
272 | u16 BoatNeutralNick; |
272 | u16 BoatNeutralNick; |
273 | u16 BoatNeutralRoll; |
273 | u16 BoatNeutralRoll; |
274 | u16 BoatNeutralYaw; |
274 | u16 BoatNeutralYaw; |
275 | u8 AutoPhotoDistance; |
275 | u8 AutoPhotoDistance; |
276 | } __attribute__((packed)) FC_t; // from FC |
276 | } __attribute__((packed)) FC_t; // from FC |
277 | 277 | ||
278 | extern Param_t Parameter; |
278 | extern Param_t Parameter; |
279 | extern volatile FC_t FC; |
279 | extern volatile FC_t FC; |
280 | extern s8 ErrorMSG[25]; |
280 | extern s8 ErrorMSG[25]; |
281 | extern u8 ErrorCode; |
281 | extern u8 ErrorCode; |
282 | extern u8 StopNavigation; |
282 | extern u8 StopNavigation; |
283 | extern u8 ErrorGpsFixLost; |
283 | extern u8 ErrorGpsFixLost; |
284 | extern u8 FromFC_LoadWP_List, ToFC_MaxWpListIndex, FromFC_Load_SinglePoint, FromFC_Save_SinglePoint; |
284 | extern u8 FromFC_LoadWP_List, ToFC_MaxWpListIndex, FromFC_Load_SinglePoint, FromFC_Save_SinglePoint; |
285 | extern volatile u32 SPIWatchDog; // stop Navigation if this goes to zero |
285 | extern volatile u32 SPIWatchDog; // stop Navigation if this goes to zero |
286 | extern volatile u32 SD_WatchDog; // stop Logging if this goes to zero |
286 | extern volatile u32 SD_WatchDog; // stop Logging if this goes to zero |
287 | extern volatile u32 PollingTimeout; |
287 | extern volatile u32 PollingTimeout; |
288 | extern u32 CountGpsProcessedIn5Sec,CountNewGpsDataIn5Sec, FreqGpsNavProcessed, FreqNewGpsData; |
288 | extern u32 CountGpsProcessedIn5Sec,CountNewGpsDataIn5Sec, FreqGpsNavProcessed, FreqNewGpsData; |
289 | extern u32 TimeSinceMotorStart; |
289 | extern u32 TimeSinceMotorStart; |
290 | 290 | ||
291 | extern u16 SD_SettingWaitLED; |
291 | extern u16 SD_SettingWaitLED; |
292 | extern u16 SD_PosAccuracy; |
292 | extern u16 SD_PosAccuracy; |
293 | extern u16 SD_ComingHomeSpeed; |
293 | extern u16 SD_ComingHomeSpeed; |
294 | extern u16 SD_DPH_Speed; |
294 | extern u16 SD_DPH_Speed; |
295 | extern u32 MaxWP_Radius_in_m; |
295 | extern u32 MaxWP_Radius_in_m; |
296 | extern u8 SpeakWaypointRached; // Speak once as soon as the Points are active |
296 | extern u8 SpeakWaypointRached; // Speak once as soon as the Points are active |
297 | extern u8 SpeakNextWaypoint; // Speak once when reached |
297 | extern u8 SpeakNextWaypoint; // Speak once when reached |
298 | extern u8 NewWaypointsReceived; // when 1: activates the Waypoint list as soon as CH is started |
298 | extern u8 NewWaypointsReceived; // when 1: activates the Waypoint list as soon as CH is started |
299 | 299 | ||
300 | 300 | ||
301 | #define CHECK_ONLY 0 |
301 | #define CHECK_ONLY 0 |
302 | #define GET_LICENSE 1 |
302 | #define GET_LICENSE 1 |
303 | #define COPY_SD_TO_EE 2 |
303 | #define COPY_SD_TO_EE 2 |
304 | extern u8 CheckLicense(u8); |
304 | extern u8 CheckLicense(u8); |
305 | 305 | ||
306 | // Portpin inputs |
306 | // Portpin inputs |
307 | #define PIN6_3 (GPIO6->DR[0x3FC] & 0x08) |
307 | #define PIN6_3 (GPIO6->DR[0x3FC] & 0x08) |
308 | #define PIN6_4 (GPIO6->DR[0x3FC] & 0x10) |
308 | #define PIN6_4 (GPIO6->DR[0x3FC] & 0x10) |
309 | #define PIN6_5 (GPIO6->DR[0x3FC] & 0x20) |
309 | #define PIN6_5 (GPIO6->DR[0x3FC] & 0x20) |
310 | 310 | ||
311 | 311 | ||
312 | #endif // _MAIN_H |
312 | #endif // _MAIN_H |
313 | 313 |