|
| 1 | +/*======================================================================================================================== |
| 2 | + MADFLIGHT CONFIG |
| 3 | +========================================================================================================================== |
| 4 | +
|
| 5 | +The configuration is loaded from two strings: first from madflight_board in from the board header in /brd/, and then from |
| 6 | +madflight_config in this file. If the same setting occurs more than once, the last one is applied. |
| 7 | +
|
| 8 | +The strings are multi-line raw strings in with a key-value list. Anything after '#' or '/' is ignored as comment. |
| 9 | +
|
| 10 | +You have 3 options to setup the flight controller: |
| 11 | +
|
| 12 | + 1) Default - Keep #define MF_BOARD "brd/default.h", this defines the default pinout as shown on https://madflight.com |
| 13 | + for the supported processor families. Now edit madflight_config below, and uncomment and configure imu_gizmo, |
| 14 | + imu_bus_type, rcl_gizmo, and other lines as needed. (Do not change the pin_xxx_yyy and xxx_yyy_bus settings.) |
| 15 | + |
| 16 | + 2) BetaFlight - Change "brd/default.h" to the BetaFlight flight controller you want to use, for example: |
| 17 | + #define MF_BOARD "brd/betaflight/MTKS-MATEKH743.h". See library/madflight/src for all available boards. Edit |
| 18 | + madflight_config to fine-tune the configuration. |
| 19 | + |
| 20 | + 3) Bare Metal - Comment out "#define MF_BOARD", and set the full configuration in madflight_config below. |
| 21 | +
|
| 22 | +Pins and spi/i2c/serial busses use zero-based numbering, i.e. "gps_ser_bus 0" connects the GPS to the first serial bus |
| 23 | +with pins pin_ser0_tx and pin_ser0_rx. Pins use GPIO numbers, not physical pin numbers. Use -1 to disable a pin or bus. |
| 24 | +
|
| 25 | +You can also modify the configuration from the CLI, for example "set imu_gizmo MPU6500" or "set imu_spi_bus 1", then |
| 26 | +use "save" to save the config to eeprom and reboot to use the new config. |
| 27 | +
|
| 28 | +If things do not work as expected, have a good look at the startup messages! |
| 29 | +
|
| 30 | +========================================================================================================================*/ |
| 31 | + |
| 32 | +//define the board header to use, or comment out for none |
| 33 | +#define MF_BOARD "brd/default.h" |
| 34 | + |
| 35 | +const char madflight_config[] = R""( |
| 36 | + |
| 37 | +//--- IMU --- Inertial Measurement Unit (use spi -OR- i2c bus) |
| 38 | +//imu_gizmo NONE // options: NONE, BMI270, MPU6000, MPU6050, MPU6500, MPU9150, MPU9250, ICM45686, ICM42688 |
| 39 | +//imu_bus_type SPI // options: SPI, I2C (not all combinations of gizmo and bus_type are supported) |
| 40 | +//imu_align CW0 // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP, CW180FLIP, CW270FLIP |
| 41 | +//imu_spi_bus -1 //spi |
| 42 | +//pin_imu_cs -1 //spi |
| 43 | +//pin_imu_int -1 //spi and i2c |
| 44 | +//imu_i2c_bus -1 //i2c |
| 45 | +//imu_i2c_adr 0 //i2c: enter decimal i2c address, not hex (use 0 for default i2c address) |
| 46 | + |
| 47 | +// IMPORTANT: the IMU sensor should be the ONLY sensor on the selected bus |
| 48 | + |
| 49 | + |
| 50 | +//--- RCL --- Remote Controller Link (use serial bus -OR- ppm pin) |
| 51 | +//rcl_gizmo NONE // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM |
| 52 | +//rcl_num_ch 8 // number of channels |
| 53 | +//rcl_deadband 0 // center stick deadband |
| 54 | +//rcl_ser_bus -1 |
| 55 | +//pin_rcl_ppm -1 |
| 56 | + |
| 57 | +//--- BAR --- Barometer |
| 58 | +//bar_gizmo NONE // options: NONE, BMP390, BMP388, BMP280, MS5611, HP203B |
| 59 | +//bar_i2c_adr 0 |
| 60 | +//bar_i2c_bus -1 |
| 61 | + |
| 62 | +//--- MAG --- Magnetometer |
| 63 | +//mag_gizmo NONE // options: NONE, QMC5883, QMC6309, RM3100 |
| 64 | +//mag_i2c_adr 0 |
| 65 | +//mag_i2c_bus -1 |
| 66 | + |
| 67 | +//--- BAT --- Battery Monitor (use i2c bus -OR- adc pins) |
| 68 | +//bat_gizmo NONE // options: NONE, ADC, INA226, INA228 |
| 69 | +//bat_i2c_adr 0 |
| 70 | +//bat_i2c_bus -1 |
| 71 | +//pin_bat_i -1 |
| 72 | +//pin_bat_v -1 |
| 73 | +//bat_cal_v 1 //adc voltage scale, value is: actual_voltage_in_v / adc_reading |
| 74 | +//bat_cal_i, 1 //adc current scale, value is: actual_current_in_a / adc_reading; for ina226/228: rshunt value in ohm |
| 75 | + |
| 76 | +//--- GPS --- |
| 77 | +//gps_gizmo NONE // options: NONE, UBLOX |
| 78 | +//gps_baud 0 // use 0 for auto baud |
| 79 | +//gps_ser_bus -1 |
| 80 | + |
| 81 | +//--- BBX --- Black Box Data Logger (use spi -OR- mmc) |
| 82 | +//bbx_gizmo NONE // options: NONE, SDSPI, SDMMC |
| 83 | +//pin_bbx_cs -1 // spi |
| 84 | +//bbx_spi_bus -1 // spi |
| 85 | +//pin_mmc_dat -1 // mmc |
| 86 | +//pin_mmc_clk -1 // mmc |
| 87 | +//pin_mmc_cmd -1 // mmc |
| 88 | + |
| 89 | +//--- RDR --- Radar (use serial bus -OR- trig+echo pins) |
| 90 | +//rdr_gizmo NONE // options: NONE, LD2411S, LD2413, USD1, SR04 |
| 91 | +//rdr_baud 0 |
| 92 | +//rdr_ser_bus -1 |
| 93 | +//pin_rdr_trig -1 |
| 94 | +//pin_rdr_echo -1 |
| 95 | + |
| 96 | +//--- LED --- |
| 97 | +//led_on LOW_IS_ON // options: LOW_IS_ON, HIGH_IS_ON |
| 98 | +//pin_led -1 |
| 99 | + |
| 100 | +//--- AHR --- AHRS (keep MAHONY, unless you want to experiment) |
| 101 | +//ahr_gizmo MAHONY // options: MAHONY, MAHONY_BF, MADGWICK, VQF |
| 102 | + |
| 103 | +//--- Serial bus 0 --- |
| 104 | +//pin_ser0_rx -1 |
| 105 | +//pin_ser0_tx -1 |
| 106 | + |
| 107 | +//--- Serial bus 1 --- |
| 108 | +//pin_ser1_rx -1 |
| 109 | +//pin_ser1_tx -1 |
| 110 | + |
| 111 | +//--- SPI bus 0 --- |
| 112 | +//pin_spi0_miso -1 |
| 113 | +//pin_spi0_mosi -1 |
| 114 | +//pin_spi0_sclk -1 |
| 115 | + |
| 116 | +//--- SPI bus 1 --- |
| 117 | +//pin_spi1_miso -1 |
| 118 | +//pin_spi1_mosi -1 |
| 119 | +//pin_spi1_sclk -1 |
| 120 | + |
| 121 | +//--- I2C Bus 0 --- |
| 122 | +//pin_i2c0_sda -1 |
| 123 | +//pin_i2c0_scl -1 |
| 124 | + |
| 125 | +//--- I2C Bus 1 --- |
| 126 | +//pin_i2c1_sda -1 |
| 127 | +//pin_i2c1_scl -1 |
| 128 | + |
| 129 | +//--- OUT Pins --- |
| 130 | +//pin_out0 -1 |
| 131 | +//pin_out1 -1 |
| 132 | +//pin_out2 -1 |
| 133 | +//pin_out3 -1 |
| 134 | +//pin_out4 -1 |
| 135 | +//pin_out5 -1 |
| 136 | +//pin_out6 -1 |
| 137 | +//pin_out7 -1 |
| 138 | +//pin_out8 -1 |
| 139 | +//pin_out9 -1 |
| 140 | +//pin_out10 -1 |
| 141 | +//pin_out11 -1 |
| 142 | +//pin_out12 -1 |
| 143 | +//pin_out13 -1 |
| 144 | +//pin_out14 -1 |
| 145 | +//pin_out15 -1 |
| 146 | + |
| 147 | +)""; // End of madflight_config |
| 148 | + |
| 149 | + |
| 150 | +//========================================================================================================================// |
| 151 | +// COMPILER OPTIONS // |
| 152 | +//========================================================================================================================// |
| 153 | + |
| 154 | +// Reset config eeprom to defaults (uncomment this, upload, execute, then comment out, and upload again) |
| 155 | +//#define MF_CONFIG_CLEAR |
| 156 | + |
| 157 | +// Uncomment to print additional debug information and reduce startup delay |
| 158 | +//#define MF_DEBUG |
| 159 | + |
| 160 | +// Uncomment to enable Lua Scripting |
| 161 | +//#define MF_LUA_ENABLE 1 |
0 commit comments