forked from bradquick/bradwii
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.h
202 lines (161 loc) · 9.87 KB
/
config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/*
Copyright 2013 Brad Quick
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// this is the file that is used to configure the software. Uncomment the appropriate lines by removing the // in front of them.
// Configuration works with a lot of defaults. The only thing you really need to choose is the control board. After that,
// all defaults will be chosen for that board. If you want to use other than defaults, then uncomment the things you want
// to change. To see what the defaults are, look in defs.h
// The options are defined in options.h
#include "options.h"
// Choose your control board:
#define CONTROL_BOARD_TYPE CONTROL_BOARD_HK_MULTIWII_PRO_2
//#define CONTROL_BOARD_TYPE CONTROL_BOARD_HK_MULTIWII_328P
//#define CONTROL_BOARD_TYPE CONTROL_BOARD_HK_NANOWII
//#define CONTROL_BOARD_TYPE CONTROL_BOARD_HK_POCKET_QUAD
//#define CONTROL_BOARD_TYPE CONTROL_BOARD_SIRIUS_AIR
//#define CONTROL_BOARD_TYPE CONTROL_BOARD_SIRIUS_AIR_GPS
//#define CONTROL_BOARD_TYPE CONTROL_BOARD_SIRIUS_PARIS_V4
//#define CONTROL_BOARD_TYPE CONTROL_BOARD_WITESPY_FLIP
//#define CONTROL_BOARD_TYPE CONTROL_BOARD_WITESPY_MULTIWII_PRO_2
//#define CONTROL_BOARD_TYPE CONTROL_BOARD_WITESPY_MULTIWII_PRO_2_GPS
// Choose the type of r/c reciever that will be used
#define RX_TYPE RX_NORMAL
//#define RX_TYPE RX_CPPM
//#define RX_TYPE RX_DSM2_1024
//#define RX_TYPE RX_DSM2_2048
//#define RX_DSM2_SERIAL_PORT 1
// Choose a channel order if you don't like the default for your receiver type selected above
//#define RX_CHANNEL_ORDER THROTTLE_INDEX,ROLL_INDEX,PITCH_INDEX,YAW_INDEX,AUX1_INDEX,AUX2_INDEX,AUX3_INDEX,AUX4_INDEX,8,9,10,11 //For Graupner/Spektrum
//#define RX_CHANNEL_ORDER ROLL_INDEX,PITCH_INDEX,THROTTLE_INDEX,YAW_INDEX,AUX1_INDEX,AUX2_INDEX,AUX3_INDEX,AUX4_INDEX,8,9,10,11 //For Robe/Hitec/Futaba
//#define RX_CHANNEL_ORDER ROLL_INDEX,PITCH_INDEX,YAW_INDEX,THROTTLE_INDEX,AUX1_INDEX,AUX2_INDEX,AUX3_INDEX,AUX4_INDEX,8,9,10,11 //For Multiplex
//#define RX_CHANNEL_ORDER PITCH_INDEX,ROLL_INDEX,THROTTLE_INDEX,YAW_INDEX,AUX1_INDEX,AUX2_INDEX,AUX3_INDEX,AUX4_INDEX,8,9,10,11 //For some Hitec/Sanwa/Others
// uncomment to set the number of RX channels, otherwise it will default to what the control board/receiver can handle
#define RX_NUM_CHANNELS 6
// uncomment to allow arming and disarming with the sticks:
// Arming and disarming only happen at low throttle
// Uncomment the following two lines to allow arming using yaw
//#define STICK_ARM STICK_COMMAND_YAW_HIGH
//#define STICK_DISARM STICK_COMMAND_YAW_LOW
// uncomment the following two lines to allow arming using yaw, roll, and pitch all at once
//#define STICK_ARM STICK_COMMAND_YAW_HIGH+STICK_COMMAND_ROLL_HIGH+STICK_COMMAND_PITCH_LOW
//#define STICK_DISARM STICK_COMMAND_YAW_LOW+STICK_COMMAND_ROLL_LOW+STICK_COMMAND_PITCH_LOW
#define STICK_ARM STICK_COMMAND_ROLL_HIGH+STICK_COMMAND_PITCH_LOW
#define STICK_DISARM STICK_COMMAND_ROLL_LOW+STICK_COMMAND_PITCH_LOW
// Choose an aircraft configuration (defaults to QUADX)
//#define AIRCRAFT_CONFIGURATION QUADX
#define AIRCRAFT_CONFIGURATION TRI
// Choose which serial ports will be used to transfer data to a configuration device.
// Multiple serial channels can be configured. (i.e. one for computer, one for bluetooth).
// Be sure to uncomment and set the baud rate for any enabled serial ports.
// note: two examples are given below, but any combination of ports can be added together.
//#define MULTIWII_CONFIG_SERIAL_PORTS NOSERIALPORT
//#define MULTIWII_CONFIG_SERIAL_PORTS SERIALPORT1
#define MULTIWII_CONFIG_SERIAL_PORTS SERIALPORT1+SERIALPORT3
//#define SERIAL_0_BAUD 115200
//#define SERIAL_1_BAUD 9600
//#define SERIAL_2_BAUD 9600
//#define SERIAL_3_BAUD 115200
// Choose whether to include code for a GPS and set parameters for the GPS, otherwise it will default o what the control board come with
//#define GPS_TYPE NO_GPS // select if no GPS is going to be used
//#define GPS_TYPE I2C_GPS // select if an i2c gps is going to be used
#define GPS_TYPE SERIAL_GPS // select if a serial GPS (NMEA) is going to be used
#define GPS_SERIAL_PORT 2
#define GPS_BAUD 115200
// Choose a multiplier for high rotation rates when in acro mode
#define HIGH_RATES_MULTIPLIER 2.0
// Choose maximum tilt angles when in level mode
#define LEVEL_MODE_MAX_TILT 55 // 55 degrees
#define LEVEL_MODE_MAX_TILT_HIGH_ANGLE 80 // 80 degrees when high angle checkbox active
// Choose maximum tilt angles owhile navigating. This will determine how fast it moves from point to point.
#define NAVIGATION_MAX_TILT 8 //15 degrees
// Choose output ranges (in microseconds)
#define MIN_MOTOR_OUTPUT 1000
#define MAX_MOTOR_OUTPUT 2000
// un-comment if you don't want to include autotune code
//#define NO_FAILSAFE
#define FAILSAFE_MOTOR_OUTPUT 1200 // throttle setting for bringing the aircraft down at a safe speed
// Un-comment and set to YES or NO to override the default value.
// When YES, motors will stop when throttle stick is below STICK_RANGE_LOW (see below) and not in acro or semi acro mode.
//#define MOTORS_STOP YES
// set the minimum motor output when armed. If not set, 1067 will be used as a default
#define ARMED_MIN_MOTOR_OUTPUT 1067 // motors spin slowly when armed
//#define ARMED_MIN_MOTOR_OUTPUT 1170 // motors spin slowly when armed (for blheli flashed q-brain)
// Optionally set an offset from RX Input to ESC output. Usually used to make sure
// the throttle can go to zero.
//#define THROTTLE_TO_MOTOR_OFFSET 0
// Divide the Aux inputs into low, medium, and high using the following divisions
#define AUX_MID_RANGE_LOW 1300
#define AUX_MID_RANGE_HIGH 1700
// Define low and high values for stick commands
#define STICK_RANGE_LOW 1170
#define STICK_RANGE_HIGH 1830
// un-comment if you don't want to include code for a compass, otherwise it will default to what the control board has on it
//#define COMPASS_TYPE NO_COMPASS
//#define COMPASS_TYPE HMC5883
//#define COMPASS_TYPE HMC5843
//#define COMPASS_TYPE MAG3110
//#define COMPASS_ORIENTATION(VALUES,X, Y, Z) {VALUES[ROLL_INDEX] = X; VALUES[PITCH_INDEX] = Y; VALUES[YAW_INDEX] = -Z;}
// un-comment if you don't want to include code for a barometer, otherwise it will default to what the control board has on it
//#define BAROMETER_TYPE NO_BAROMETER
// Get your magnetic decliniation from here : http://magnetic-declination.com/
//#define MAG_DECLINATION_DEGREES -13.4 // for Hyde Park, NY
#define MAG_DECLINATION_DEGREES -13.52 // for Sayville, NY
// ESCs calibration
// To calibrate all ESCs connected to the aircraft at the same time (useful to avoid unplugging/re-plugging each ESC)
// Warning: this creates a special version of code
// You cannot fly with this special version. It is only to be used for calibrating ESCs
//#define ESC_CALIB_CANNOT_FLY // uncomment to activate
#define ESC_CALIB_LOW MIN_MOTOR_OUTPUT
#define ESC_CALIB_HIGH MAX_MOTOR_OUTPUT
// un-comment if you don't want to include autotune code
//#define NO_AUTOTUNE
// To adjust how agressive the tuning is, adjust the AUTOTUNEMAXOSCILLATION value. A larger
// value will result in more agressive tuning. A lower value will result in softer tuning.
// It will rock back and forth between -AUTOTUNE_TARGET_ANGLE and AUTOTUNE_TARGET_ANGLE degrees
// AUTOTUNE_D_MULTIPLIER is a multiplier that puts in a little extra D when autotuning is done. This helps damp
// the wobbles after a quick angle change.
// Always autotune on a full battery.
#define AUTOTUNE_MAX_OSCILLATION 1.0
#define AUTOTUNE_TARGET_ANGLE 20.0
#define AUTOTUNE_D_MULTIPLIER 1.2
// Gyro low pass filter.
// If your aircraft jumps around randomly, or it drifts from level over time when in level mode,
// then you are probably getting vibration feeding from your motors to your gyros.
// The first step is to isolate the control board from the frame of the aircraft (google Sorbothane). If all else fails,
// increase the GYRO_LOW_PASS_FILTER from 0 through 10. The lowest value that works correctly is the one you should use.
// Leave comment to use the default value.
//#define GYRO_LOW_PASS_FILTER 2
// un-comment if you don't want to include uncrashable code
//#define NO_UNCRASHABLE
#define UNCRAHSABLE_MAX_ALTITUDE_OFFSET 30.0 // 30 meters above where uncrashability was enabled
#define UNCRAHSABLE_RADIUS 50.0 // 50 meter radius
// un-comment if you don't want to include autopilot code
//#define NO_AUTOPILOT
#define AUTOPILOT_NEAR_WAYPOINT_RADIUS 1.0 // 1 meters
#define AUTOPILOT_MAX_SPEED 2.0 // 2 m/s (<5 mph)
// Auto Throttle Adjust - Increases the throttle when the aircraft is tilted so that the vertical
// component of thrust remains constant.
// The AUTOTHROTTLE_DEAD_AREA adjusts the value at which the throttle starts taking effect. If this
// value is too low, the aircraft will gain altitude when banked, if it's too low, it will lose
// altitude when banked. Adjust to suit.
// un-comment if you don't want to include the autothrottle code
//#define NO_AUTOTHROTTLE
#define AUTOTHROTTLE_DEAD_AREA FIXEDPOINTCONSTANT(.25)
// Uncomment the following line if you want to modify gain scheduling. Gain scheduling adjusts the PID gains
// depending on the level of throttle. It attempts to eliminate the wobbles while decending under low throttle.
// A value of zero is no gain scheduling. A value of 1.0 (the default) results in 50% gains at zero throttle, 100% gains at mid
// throttle, and 150% gains at full throttle.
// Range is 0 to 2.0
#define GAIN_SCHEDULING_FACTOR 1.0
// Uncomment if using DC motors
//#define DC_MOTORS