Skip to content

Commit 604c0f9

Browse files
committed
madflight_config
1 parent d2caf65 commit 604c0f9

File tree

12 files changed

+139
-125
lines changed

12 files changed

+139
-125
lines changed

examples/00.HelloWorld/madflight_config.h

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,25 @@
22
MADFLIGHT CONFIG
33
==========================================================================================================================
44
5-
madflight_config is a multi-line raw string in with a key-value list. Anything after '#' or '/' is ignored as comment.
5+
The configuration is loaded from two strings: first from madflight_board in <madflight_board.h>, and then from
6+
madflight_config in this file. If the same setting occurs more than once, the last one is applied.
67
7-
You have 4 options to setup the pins (gpio numbers) and serial/spi/i2c busses for the flight controller:
8+
The strings are multi-line raw strings in with a key-value list. Anything after '#' or '/' is ignored as comment.
89
9-
1) Default - #include <madflight_board.h> and see https://madflight.com for default pinout diagrams for the supported
10-
processor families. Default pinouts are defined in the board header files library/madflight/src/madflight_board_XXX.h
11-
Leave lines with "pin_..." and "..._bus" commented in madflight_config.
12-
13-
2) BetaFlight - #include the BetaFlight flight controller you want to use. See library/madflight/src for all available
14-
boards. For example: #include <madflight_zzz_MTKS-MATEKH743.h>
10+
You have 3 options to setup the flight controller:
1511
16-
3) Override - Keep #include <madflight_board.h>, and uncomment lines in madflight_config to override the board settings.
12+
1) Default - Keep "#include <madflight_board.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 "#include <madflight_board.h>" to the BetaFlight flight controller you want to use, for example:
17+
"#include <madflight_zzz_MTKS-MATEKH743.h>". See library/madflight/src for all available boards. Edit madflight_config
18+
to fine-tune the configuration.
1719
18-
4) Bare Metal - Remove #include <madflight_board.h>, and set the full configuration in madflight_config below.
20+
4) Bare Metal - Remove "#include <madflight_board.h>", and set the full configuration in madflight_config below.
1921
20-
Pins and busses use zero-based numbering, i.e. imu_spi_bus 0 is the first spi bus. Use -1 to disable a pin or bus.
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.
2124
2225
You can also modify the configuration from the CLI, for example "set imu_gizmo MPU6500" or "set imu_spi_bus 1", then
2326
use "cwrite" to save the config to eeprom and reboot to use the new config.
@@ -28,71 +31,71 @@ If things do not work as expected, have a good look at the startup messages!
2831

2932
#include <madflight_board.h>
3033

31-
const char* madflight_config = R""(
34+
const char madflight_config[] = R""(
3235

3336
//--- IMU --- Inertial Measurement Unit (use spi -OR- i2c bus)
34-
imu_gizmo MPU6500 // options: NONE, BMI270, MPU6000, MPU6050, MPU6500, MPU9150, MPU9250
35-
imu_bus_type SPI // options: SPI, I2C (not all combinations of gizmo and bus_type are supported)
36-
imu_align CW90 // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP, CW180FLIP, CW270FLIP
37+
//imu_gizmo NONE // options: NONE, BMI270, MPU6000, MPU6050, MPU6500, MPU9150, MPU9250, ICM45686, ICM42688
38+
//imu_bus_type SPI // options: SPI, I2C (not all combinations of gizmo and bus_type are supported)
39+
//imu_align CW0 // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP, CW180FLIP, CW270FLIP
3740
//imu_spi_bus -1 //spi
3841
//pin_imu_cs -1 //spi
39-
//pin_imu_int -1 //spi
42+
//pin_imu_int -1 //spi and i2c
4043
//imu_i2c_bus -1 //i2c
4144
//imu_i2c_adr 0 //i2c: enter decimal i2c address, not hex (use 0 for default i2c address)
4245

4346
// IMPORTANT: the IMU sensor should be the ONLY sensor on the selected bus
4447

4548

4649
//--- RCL --- Remote Controller Link (use serial bus -OR- ppm pin)
47-
rcl_gizmo CRSF // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM
48-
rcl_num_ch 8 // number of channels
49-
rcl_deadband 0 // center stick deadband
50+
//rcl_gizmo NONE // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM
51+
//rcl_num_ch 8 // number of channels
52+
//rcl_deadband 0 // center stick deadband
5053
//rcl_ser_bus -1
5154
//pin_rcl_ppm -1
5255

5356
//--- BAR --- Barometer
54-
bar_gizmo NONE // options: NONE, BMP390, BMP388, BMP280, MS5611, HP203B
57+
//bar_gizmo NONE // options: NONE, BMP390, BMP388, BMP280, MS5611, HP203B
5558
//bar_i2c_adr 0
5659
//bar_i2c_bus -1
5760

5861
//--- MAG --- Magnetometer
59-
mag_gizmo NONE // options: NONE, QMC5883, QMC6309, RM3100
62+
//mag_gizmo NONE // options: NONE, QMC5883, QMC6309, RM3100
6063
//mag_i2c_adr 0
6164
//mag_i2c_bus -1
6265

6366
//--- BAT --- Battery Monitor (use i2c bus -OR- adc pins)
64-
bat_gizmo NONE // options: NONE, ADC, INA226, INA228
67+
//bat_gizmo NONE // options: NONE, ADC, INA226, INA228
6568
//bat_i2c_adr 0
6669
//bat_i2c_bus -1
6770
//pin_bat_i -1
6871
//pin_bat_v -1
6972

7073
//--- GPS ---
71-
gps_gizmo NONE // options: NONE, UBLOX
74+
//gps_gizmo NONE // options: NONE, UBLOX
7275
//gps_baud 0 // use 0 for auto baud
7376
//gps_ser_bus -1
7477

7578
//--- BBX --- Black Box Data Logger (use spi -OR- mmc)
76-
bbx_gizmo NONE // options: NONE, SDSPI, SDMMC
79+
//bbx_gizmo NONE // options: NONE, SDSPI, SDMMC
7780
//pin_bbx_cs -1 // spi
7881
//bbx_spi_bus -1 // spi
7982
//pin_mmc_dat -1 // mmc
8083
//pin_mmc_clk -1 // mmc
8184
//pin_mmc_cmd -1 // mmc
8285

8386
//--- RDR --- Radar (use serial bus -OR- trig+echo pins)
84-
rdr_gizmo NONE // options: NONE, LD2411S, LD2413, USD1, SR04
87+
//rdr_gizmo NONE // options: NONE, LD2411S, LD2413, USD1, SR04
8588
//rdr_baud 0
8689
//rdr_ser_bus -1
8790
//pin_rdr_trig -1
8891
//pin_rdr_echo -1
8992

9093
//--- LED ---
91-
//led_on LOW_IS_ON // options: LOW_IS_ON,HIGH_IS_ON
94+
//led_on LOW_IS_ON // options: LOW_IS_ON, HIGH_IS_ON
9295
//pin_led -1
9396

9497
//--- AHR --- AHRS (keep MAHONY, unless you want to experiment)
95-
ahr_gizmo MAHONY // options: MAHONY, MAHONY_BF, MADGWICK, VQF
98+
//ahr_gizmo MAHONY // options: MAHONY, MAHONY_BF, MADGWICK, VQF
9699

97100
//--- Serial bus 0 ---
98101
//pin_ser0_rx -1

examples/01.Quadcopter/madflight_config.h

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,25 @@
22
MADFLIGHT CONFIG
33
==========================================================================================================================
44
5-
madflight_config is a multi-line raw string in with a key-value list. Anything after '#' or '/' is ignored as comment.
5+
The configuration is loaded from two strings: first from madflight_board in <madflight_board.h>, and then from
6+
madflight_config in this file. If the same setting occurs more than once, the last one is applied.
67
7-
You have 4 options to setup the pins (gpio numbers) and serial/spi/i2c busses for the flight controller:
8+
The strings are multi-line raw strings in with a key-value list. Anything after '#' or '/' is ignored as comment.
89
9-
1) Default - #include <madflight_board.h> and see https://madflight.com for default pinout diagrams for the supported
10-
processor families. Default pinouts are defined in the board header files library/madflight/src/madflight_board_XXX.h
11-
Leave lines with "pin_..." and "..._bus" commented in madflight_config.
12-
13-
2) BetaFlight - #include the BetaFlight flight controller you want to use. See library/madflight/src for all available
14-
boards. For example: #include <madflight_zzz_MTKS-MATEKH743.h>
10+
You have 3 options to setup the flight controller:
1511
16-
3) Override - Keep #include <madflight_board.h>, and uncomment lines in madflight_config to override the board settings.
12+
1) Default - Keep "#include <madflight_board.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 "#include <madflight_board.h>" to the BetaFlight flight controller you want to use, for example:
17+
"#include <madflight_zzz_MTKS-MATEKH743.h>". See library/madflight/src for all available boards. Edit madflight_config
18+
to fine-tune the configuration.
1719
18-
4) Bare Metal - Remove #include <madflight_board.h>, and set the full configuration in madflight_config below.
20+
4) Bare Metal - Remove "#include <madflight_board.h>", and set the full configuration in madflight_config below.
1921
20-
Pins and busses use zero-based numbering, i.e. imu_spi_bus 0 is the first spi bus. Use -1 to disable a pin or bus.
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.
2124
2225
You can also modify the configuration from the CLI, for example "set imu_gizmo MPU6500" or "set imu_spi_bus 1", then
2326
use "cwrite" to save the config to eeprom and reboot to use the new config.
@@ -28,71 +31,71 @@ If things do not work as expected, have a good look at the startup messages!
2831

2932
#include <madflight_board.h>
3033

31-
const char* madflight_config = R""(
34+
const char madflight_config[] = R""(
3235

3336
//--- IMU --- Inertial Measurement Unit (use spi -OR- i2c bus)
34-
imu_gizmo MPU6500 // options: NONE, BMI270, MPU6000, MPU6050, MPU6500, MPU9150, MPU9250
35-
imu_bus_type SPI // options: SPI, I2C (not all combinations of gizmo and bus_type are supported)
36-
imu_align CW90 // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP, CW180FLIP, CW270FLIP
37+
//imu_gizmo NONE // options: NONE, BMI270, MPU6000, MPU6050, MPU6500, MPU9150, MPU9250, ICM45686, ICM42688
38+
//imu_bus_type SPI // options: SPI, I2C (not all combinations of gizmo and bus_type are supported)
39+
//imu_align CW0 // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP, CW180FLIP, CW270FLIP
3740
//imu_spi_bus -1 //spi
3841
//pin_imu_cs -1 //spi
39-
//pin_imu_int -1 //spi
42+
//pin_imu_int -1 //spi and i2c
4043
//imu_i2c_bus -1 //i2c
4144
//imu_i2c_adr 0 //i2c: enter decimal i2c address, not hex (use 0 for default i2c address)
4245

4346
// IMPORTANT: the IMU sensor should be the ONLY sensor on the selected bus
4447

4548

4649
//--- RCL --- Remote Controller Link (use serial bus -OR- ppm pin)
47-
rcl_gizmo CRSF // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM
48-
rcl_num_ch 8 // number of channels
49-
rcl_deadband 0 // center stick deadband
50+
//rcl_gizmo NONE // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM
51+
//rcl_num_ch 8 // number of channels
52+
//rcl_deadband 0 // center stick deadband
5053
//rcl_ser_bus -1
5154
//pin_rcl_ppm -1
5255

5356
//--- BAR --- Barometer
54-
bar_gizmo NONE // options: NONE, BMP390, BMP388, BMP280, MS5611, HP203B
57+
//bar_gizmo NONE // options: NONE, BMP390, BMP388, BMP280, MS5611, HP203B
5558
//bar_i2c_adr 0
5659
//bar_i2c_bus -1
5760

5861
//--- MAG --- Magnetometer
59-
mag_gizmo NONE // options: NONE, QMC5883, QMC6309, RM3100
62+
//mag_gizmo NONE // options: NONE, QMC5883, QMC6309, RM3100
6063
//mag_i2c_adr 0
6164
//mag_i2c_bus -1
6265

6366
//--- BAT --- Battery Monitor (use i2c bus -OR- adc pins)
64-
bat_gizmo NONE // options: NONE, ADC, INA226, INA228
67+
//bat_gizmo NONE // options: NONE, ADC, INA226, INA228
6568
//bat_i2c_adr 0
6669
//bat_i2c_bus -1
6770
//pin_bat_i -1
6871
//pin_bat_v -1
6972

7073
//--- GPS ---
71-
gps_gizmo NONE // options: NONE, UBLOX
74+
//gps_gizmo NONE // options: NONE, UBLOX
7275
//gps_baud 0 // use 0 for auto baud
7376
//gps_ser_bus -1
7477

7578
//--- BBX --- Black Box Data Logger (use spi -OR- mmc)
76-
bbx_gizmo NONE // options: NONE, SDSPI, SDMMC
79+
//bbx_gizmo NONE // options: NONE, SDSPI, SDMMC
7780
//pin_bbx_cs -1 // spi
7881
//bbx_spi_bus -1 // spi
7982
//pin_mmc_dat -1 // mmc
8083
//pin_mmc_clk -1 // mmc
8184
//pin_mmc_cmd -1 // mmc
8285

8386
//--- RDR --- Radar (use serial bus -OR- trig+echo pins)
84-
rdr_gizmo NONE // options: NONE, LD2411S, LD2413, USD1, SR04
87+
//rdr_gizmo NONE // options: NONE, LD2411S, LD2413, USD1, SR04
8588
//rdr_baud 0
8689
//rdr_ser_bus -1
8790
//pin_rdr_trig -1
8891
//pin_rdr_echo -1
8992

9093
//--- LED ---
91-
//led_on LOW_IS_ON // options: LOW_IS_ON,HIGH_IS_ON
94+
//led_on LOW_IS_ON // options: LOW_IS_ON, HIGH_IS_ON
9295
//pin_led -1
9396

9497
//--- AHR --- AHRS (keep MAHONY, unless you want to experiment)
95-
ahr_gizmo MAHONY // options: MAHONY, MAHONY_BF, MADGWICK, VQF
98+
//ahr_gizmo MAHONY // options: MAHONY, MAHONY_BF, MADGWICK, VQF
9699

97100
//--- Serial bus 0 ---
98101
//pin_ser0_rx -1

examples/02.QuadcopterAdvanced/madflight_config.h

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,25 @@
22
MADFLIGHT CONFIG
33
==========================================================================================================================
44
5-
madflight_config is a multi-line raw string in with a key-value list. Anything after '#' or '/' is ignored as comment.
5+
The configuration is loaded from two strings: first from madflight_board in <madflight_board.h>, and then from
6+
madflight_config in this file. If the same setting occurs more than once, the last one is applied.
67
7-
You have 4 options to setup the pins (gpio numbers) and serial/spi/i2c busses for the flight controller:
8+
The strings are multi-line raw strings in with a key-value list. Anything after '#' or '/' is ignored as comment.
89
9-
1) Default - #include <madflight_board.h> and see https://madflight.com for default pinout diagrams for the supported
10-
processor families. Default pinouts are defined in the board header files library/madflight/src/madflight_board_XXX.h
11-
Leave lines with "pin_..." and "..._bus" commented in madflight_config.
12-
13-
2) BetaFlight - #include the BetaFlight flight controller you want to use. See library/madflight/src for all available
14-
boards. For example: #include <madflight_zzz_MTKS-MATEKH743.h>
10+
You have 3 options to setup the flight controller:
1511
16-
3) Override - Keep #include <madflight_board.h>, and uncomment lines in madflight_config to override the board settings.
12+
1) Default - Keep "#include <madflight_board.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 "#include <madflight_board.h>" to the BetaFlight flight controller you want to use, for example:
17+
"#include <madflight_zzz_MTKS-MATEKH743.h>". See library/madflight/src for all available boards. Edit madflight_config
18+
to fine-tune the configuration.
1719
18-
4) Bare Metal - Remove #include <madflight_board.h>, and set the full configuration in madflight_config below.
20+
4) Bare Metal - Remove "#include <madflight_board.h>", and set the full configuration in madflight_config below.
1921
20-
Pins and busses use zero-based numbering, i.e. imu_spi_bus 0 is the first spi bus. Use -1 to disable a pin or bus.
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.
2124
2225
You can also modify the configuration from the CLI, for example "set imu_gizmo MPU6500" or "set imu_spi_bus 1", then
2326
use "cwrite" to save the config to eeprom and reboot to use the new config.
@@ -28,71 +31,71 @@ If things do not work as expected, have a good look at the startup messages!
2831

2932
#include <madflight_board.h>
3033

31-
const char* madflight_config = R""(
34+
const char madflight_config[] = R""(
3235

3336
//--- IMU --- Inertial Measurement Unit (use spi -OR- i2c bus)
34-
imu_gizmo MPU6500 // options: NONE, BMI270, MPU6000, MPU6050, MPU6500, MPU9150, MPU9250
35-
imu_bus_type SPI // options: SPI, I2C (not all combinations of gizmo and bus_type are supported)
36-
imu_align CW90 // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP, CW180FLIP, CW270FLIP
37+
//imu_gizmo NONE // options: NONE, BMI270, MPU6000, MPU6050, MPU6500, MPU9150, MPU9250, ICM45686, ICM42688
38+
//imu_bus_type SPI // options: SPI, I2C (not all combinations of gizmo and bus_type are supported)
39+
//imu_align CW0 // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP, CW180FLIP, CW270FLIP
3740
//imu_spi_bus -1 //spi
3841
//pin_imu_cs -1 //spi
39-
//pin_imu_int -1 //spi
42+
//pin_imu_int -1 //spi and i2c
4043
//imu_i2c_bus -1 //i2c
4144
//imu_i2c_adr 0 //i2c: enter decimal i2c address, not hex (use 0 for default i2c address)
4245

4346
// IMPORTANT: the IMU sensor should be the ONLY sensor on the selected bus
4447

4548

4649
//--- RCL --- Remote Controller Link (use serial bus -OR- ppm pin)
47-
rcl_gizmo CRSF // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM
48-
rcl_num_ch 8 // number of channels
49-
rcl_deadband 0 // center stick deadband
50+
//rcl_gizmo NONE // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM
51+
//rcl_num_ch 8 // number of channels
52+
//rcl_deadband 0 // center stick deadband
5053
//rcl_ser_bus -1
5154
//pin_rcl_ppm -1
5255

5356
//--- BAR --- Barometer
54-
bar_gizmo NONE // options: NONE, BMP390, BMP388, BMP280, MS5611, HP203B
57+
//bar_gizmo NONE // options: NONE, BMP390, BMP388, BMP280, MS5611, HP203B
5558
//bar_i2c_adr 0
5659
//bar_i2c_bus -1
5760

5861
//--- MAG --- Magnetometer
59-
mag_gizmo NONE // options: NONE, QMC5883, QMC6309, RM3100
62+
//mag_gizmo NONE // options: NONE, QMC5883, QMC6309, RM3100
6063
//mag_i2c_adr 0
6164
//mag_i2c_bus -1
6265

6366
//--- BAT --- Battery Monitor (use i2c bus -OR- adc pins)
64-
bat_gizmo NONE // options: NONE, ADC, INA226, INA228
67+
//bat_gizmo NONE // options: NONE, ADC, INA226, INA228
6568
//bat_i2c_adr 0
6669
//bat_i2c_bus -1
6770
//pin_bat_i -1
6871
//pin_bat_v -1
6972

7073
//--- GPS ---
71-
gps_gizmo NONE // options: NONE, UBLOX
74+
//gps_gizmo NONE // options: NONE, UBLOX
7275
//gps_baud 0 // use 0 for auto baud
7376
//gps_ser_bus -1
7477

7578
//--- BBX --- Black Box Data Logger (use spi -OR- mmc)
76-
bbx_gizmo NONE // options: NONE, SDSPI, SDMMC
79+
//bbx_gizmo NONE // options: NONE, SDSPI, SDMMC
7780
//pin_bbx_cs -1 // spi
7881
//bbx_spi_bus -1 // spi
7982
//pin_mmc_dat -1 // mmc
8083
//pin_mmc_clk -1 // mmc
8184
//pin_mmc_cmd -1 // mmc
8285

8386
//--- RDR --- Radar (use serial bus -OR- trig+echo pins)
84-
rdr_gizmo NONE // options: NONE, LD2411S, LD2413, USD1, SR04
87+
//rdr_gizmo NONE // options: NONE, LD2411S, LD2413, USD1, SR04
8588
//rdr_baud 0
8689
//rdr_ser_bus -1
8790
//pin_rdr_trig -1
8891
//pin_rdr_echo -1
8992

9093
//--- LED ---
91-
//led_on LOW_IS_ON // options: LOW_IS_ON,HIGH_IS_ON
94+
//led_on LOW_IS_ON // options: LOW_IS_ON, HIGH_IS_ON
9295
//pin_led -1
9396

9497
//--- AHR --- AHRS (keep MAHONY, unless you want to experiment)
95-
ahr_gizmo MAHONY // options: MAHONY, MAHONY_BF, MADGWICK, VQF
98+
//ahr_gizmo MAHONY // options: MAHONY, MAHONY_BF, MADGWICK, VQF
9699

97100
//--- Serial bus 0 ---
98101
//pin_ser0_rx -1

0 commit comments

Comments
 (0)