Skip to content

Commit 1c34c3a

Browse files
committed
example plane v2
1 parent 1963a8a commit 1c34c3a

File tree

9 files changed

+107
-111
lines changed

9 files changed

+107
-111
lines changed

examples/01.Quadcopter/madflight_config.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
//
2626
//========================================================================================================================//
2727

28+
29+
2830
#define MADFLIGHT_CONFIG R""(
2931

3032
// IMU - Inertial Measurement Unit (acc/gyro)
@@ -45,22 +47,22 @@ rcl_num_ch 8 // number of channels
4547
rcl_deadband 0 // center stick deadband
4648

4749
// BAR - Barometer
48-
bar_gizmo NONE // options: NONE, BMP390, BMP388, BMP280, MS5611
50+
bar_gizmo NONE // options: NONE, BMP390, BMP388, BMP280, MS5611
4951
bar_i2c_adr 0
5052

5153
// MAG - Magnetometer
52-
mag_gizmo NONE // options: NONE, QMC5883, MS5611
54+
mag_gizmo NONE // options: NONE, QMC5883, MS5611
5355
mag_i2c_adr 0
5456

5557
// BAT - Battery Monitor
56-
bat_gizmo NONE // options: NONE, ADC, INA226, INA228
58+
bat_gizmo NONE // options: NONE, ADC, INA226, INA228
5759
bat_i2c_adr 0
5860

59-
// GPS -- TODO (crashes)
60-
gps_gizmo NONE // options: NONE, UBLOX
61+
// GPS
62+
gps_gizmo NONE // options: NONE, UBLOX
6163
gps_baud 0 // use 0 for auto baud
6264

63-
// BBX - Black Box Data Logger -- TODO
65+
// BBX - Black Box Data Logger
6466
bbx_gizmo NONE // options: NONE, SDSPI, SDMMC
6567

6668
)"" // End of MADFLIGHT_CONFIG

examples/02.QuadcopterAdvanced/madflight_config.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,22 @@ rcl_num_ch 8 // number of channels
4747
rcl_deadband 0 // center stick deadband
4848

4949
// BAR - Barometer
50-
bar_gizmo NONE // options: NONE, BMP390, BMP388, BMP280, MS5611
50+
bar_gizmo NONE // options: NONE, BMP390, BMP388, BMP280, MS5611
5151
bar_i2c_adr 0
5252

5353
// MAG - Magnetometer
54-
mag_gizmo NONE // options: NONE, QMC5883, MS5611
54+
mag_gizmo NONE // options: NONE, QMC5883, MS5611
5555
mag_i2c_adr 0
5656

5757
// BAT - Battery Monitor
58-
bat_gizmo NONE // options: NONE, ADC, INA226, INA228
58+
bat_gizmo NONE // options: NONE, ADC, INA226, INA228
5959
bat_i2c_adr 0
6060

61-
// GPS -- TODO (crashes)
62-
gps_gizmo NONE // options: NONE, UBLOX
61+
// GPS
62+
gps_gizmo NONE // options: NONE, UBLOX
6363
gps_baud 0 // use 0 for auto baud
6464

65-
// BBX - Black Box Data Logger -- TODO
65+
// BBX - Black Box Data Logger
6666
bbx_gizmo NONE // options: NONE, SDSPI, SDMMC
6767

6868
)"" // End of MADFLIGHT_CONFIG

examples/03.Plane/03.Plane.ino

Lines changed: 65 additions & 87 deletions
Large diffs are not rendered by default.

examples/03.Plane/madflight_config.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
//
2626
//========================================================================================================================//
2727

28+
29+
2830
#define MADFLIGHT_CONFIG R""(
2931

3032
// IMU - Inertial Measurement Unit (acc/gyro)
@@ -40,24 +42,24 @@ imu_align CW90 // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP,
4042
imu_i2c_adr 0 // use 0 for default i2c address
4143

4244
// RCL - Remote Controller Link
43-
rcl_gizmo SBUS // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM, PWM
45+
rcl_gizmo CRSF // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM, PWM
4446
rcl_num_ch 8 // number of channels
4547
rcl_deadband 0 // center stick deadband
4648

4749
// BAR - Barometer
48-
bar_gizmo BMP280 // options: NONE, BMP390, BMP388, BMP280, MS5611
50+
bar_gizmo NONE // options: NONE, BMP390, BMP388, BMP280, MS5611
4951
bar_i2c_adr 0
5052

5153
// MAG - Magnetometer
52-
mag_gizmo QMC5883 // options: NONE, QMC5883, MS5611
54+
mag_gizmo NONE // options: NONE, QMC5883, MS5611
5355
mag_i2c_adr 0
5456

5557
// BAT - Battery Monitor
56-
bat_gizmo INA226 // options: NONE, ADC, INA226, INA228
58+
bat_gizmo NONE // options: NONE, ADC, INA226, INA228
5759
bat_i2c_adr 0
5860

5961
// GPS
60-
gps_gizmo UBLOX // options: NONE, UBLOX
62+
gps_gizmo NONE // options: NONE, UBLOX
6163
gps_baud 0 // use 0 for auto baud
6264

6365
// BBX - Black Box Data Logger

src/madflight/gps/gps.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ Gps gps;
1313
int Gps::setup() {
1414
Cfg::printModule(MF_MOD);
1515

16+
if(!config.ser_bus && config.gizmo != Cfg::gps_gizmo_enum::mf_NONE) {
17+
Serial.println("\n" MF_MOD ": ERROR Serial bus not connected, check pins.\n");
18+
return -1002;
19+
}
20+
1621
//create gizmo
1722
delete gizmo;
1823
switch(config.gizmo) {

src/madflight/hal/ESP32/hal_ESP32_cpp.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@
1616
//======================================================================================================================//
1717
// IMU
1818
//======================================================================================================================//
19-
#define IMU_EXEC IMU_EXEC_FREERTOS //ESP32 always uses FreeRTOS on core0 (can't used float on core1)
20-
#define IMU_FREERTOS_TASK_PRIORITY 24 //IMU Interrupt task priority, higher number is higher priority. Max priority on ESP32 is 31, but max allowed is 24
19+
#ifndef IMU_EXEC
20+
#define IMU_EXEC IMU_EXEC_FREERTOS //ESP32 always uses FreeRTOS on core0 (can't used float on core1)
21+
#endif
22+
#ifndef IMU_FREERTOS_TASK_PRIORITY
23+
#define IMU_FREERTOS_TASK_PRIORITY (configMAX_PRIORITIES - 1) //IMU Interrupt task priority, higher number is higher priority.
24+
#endif
2125

2226
//======================================================================================================================//
2327
// FREERTOS

src/madflight/rcl/rcl_cpp.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Rcl rcl;
2727

2828
int Rcl::setup() {
2929
Cfg::printModule("rcl");
30-
30+
3131
//clear vars
3232
throttle = 0;
3333
roll = 0;
@@ -36,6 +36,11 @@ int Rcl::setup() {
3636
vspeed = 0;
3737
arm = false;
3838

39+
if(!config.ser_bus && config.gizmo != Cfg::rcl_gizmo_enum::mf_PPM && config.gizmo != Cfg::rcl_gizmo_enum::mf_NONE) {
40+
Serial.println("\n" MF_MOD ": ERROR Serial bus not connected, check pins.\n");
41+
return -1002;
42+
}
43+
3944
//create gizmo
4045
delete gizmo;
4146
switch(config.gizmo) {

src/madflight_board__ESP32-S3.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ pin_rcl_ppm -1
9999
// BUSSES
100100

101101
// Serial Busses
102-
rcl_ser_bus 1
103-
gps_ser_bus 2
102+
rcl_ser_bus 0
103+
gps_ser_bus 1
104104
rdr_ser_bus -1
105105

106106
// SPI Busses

src/madflight_board__ESP32.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ pin_rcl_ppm -1
9898
// BUSSES
9999

100100
// Serial Busses
101-
rcl_ser_bus 1
102-
gps_ser_bus 2
101+
rcl_ser_bus 0
102+
gps_ser_bus 1
103103
rdr_ser_bus -1
104104

105105
// SPI Busses

0 commit comments

Comments
 (0)