Skip to content

Commit bde8c58

Browse files
committed
cleanup
1 parent 1c34c3a commit bde8c58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+953
-124
lines changed

examples/01.Quadcopter/madflight_config.h

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

28-
29-
3028
#define MADFLIGHT_CONFIG R""(
3129

3230
// IMU - Inertial Measurement Unit (acc/gyro)
@@ -35,14 +33,14 @@
3533
imu_spi_bus 0 // connect IMU to SPI bus 0
3634
//imu_i2c_bus 1 // connect IMU to I2C bus 1
3735

38-
//NOTE: the IMU sensor should be the ONLY sensor on the selected bus
36+
// IMPORTANT: the IMU sensor should be the ONLY sensor on the selected bus
3937

4038
imu_gizmo MPU6500 // options: NONE, BMI270, MPU6000, MPU6050, MPU6500, MPU9150, MPU9250
4139
imu_align CW90 // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP, CW180FLIP, CW270FLIP
4240
imu_i2c_adr 0 // use 0 for default i2c address
4341

4442
// RCL - Remote Controller Link
45-
rcl_gizmo CRSF // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM, PWM
43+
rcl_gizmo NONE // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM, PWM
4644
rcl_num_ch 8 // number of channels
4745
rcl_deadband 0 // center stick deadband
4846

examples/02.QuadcopterAdvanced/madflight_config.h

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

28-
29-
3028
#define MADFLIGHT_CONFIG R""(
3129

3230
// IMU - Inertial Measurement Unit (acc/gyro)
@@ -35,14 +33,14 @@
3533
imu_spi_bus 0 // connect IMU to SPI bus 0
3634
//imu_i2c_bus 1 // connect IMU to I2C bus 1
3735

38-
//NOTE: the IMU sensor should be the ONLY sensor on the selected bus
36+
// IMPORTANT: the IMU sensor should be the ONLY sensor on the selected bus
3937

4038
imu_gizmo MPU6500 // options: NONE, BMI270, MPU6000, MPU6050, MPU6500, MPU9150, MPU9250
4139
imu_align CW90 // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP, CW180FLIP, CW270FLIP
4240
imu_i2c_adr 0 // use 0 for default i2c address
4341

4442
// RCL - Remote Controller Link
45-
rcl_gizmo CRSF // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM, PWM
43+
rcl_gizmo NONE // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM, PWM
4644
rcl_num_ch 8 // number of channels
4745
rcl_deadband 0 // center stick deadband
4846

examples/03.Plane/madflight_config.h

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

28-
29-
3028
#define MADFLIGHT_CONFIG R""(
3129

3230
// IMU - Inertial Measurement Unit (acc/gyro)
@@ -35,14 +33,14 @@
3533
imu_spi_bus 0 // connect IMU to SPI bus 0
3634
//imu_i2c_bus 1 // connect IMU to I2C bus 1
3735

38-
//NOTE: the IMU sensor should be the ONLY sensor on the selected bus
36+
// IMPORTANT: the IMU sensor should be the ONLY sensor on the selected bus
3937

4038
imu_gizmo MPU6500 // options: NONE, BMI270, MPU6000, MPU6050, MPU6500, MPU9150, MPU9250
4139
imu_align CW90 // options: CW0, CW90, CW180, CW270, CW0FLIP, CW90FLIP, CW180FLIP, CW270FLIP
4240
imu_i2c_adr 0 // use 0 for default i2c address
4341

4442
// RCL - Remote Controller Link
45-
rcl_gizmo CRSF // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM, PWM
43+
rcl_gizmo NONE // options: NONE, MAVLINK, CRSF, SBUS, DSM, PPM, PWM
4644
rcl_num_ch 8 // number of channels
4745
rcl_deadband 0 // center stick deadband
4846

src/madflight.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2626
SOFTWARE.
2727
===========================================================================================*/
2828

29-
//#pragma once //don't use here, should give error if included twice
29+
//#pragma once //don't use here, we want to get an error if included twice
3030

3131
//madflight config string
3232
#ifndef MADFLIGHT_BOARD
@@ -43,19 +43,19 @@ const char* madflight_config = MADFLIGHT_BOARD MADFLIGHT_CONFIG;
4343

4444
//include all "_cpp.h" modules which have compile time config options
4545
#define MF_ALLOW_INCLUDE_CCP_H
46-
#include "madflight/cfg/cfg_cpp.h"
47-
#include "madflight/hal/hal_cpp.h"
48-
#include "madflight/cli/cli_cpp.h"
46+
#include "madflight/cfg/cfg_cpp.h" //include this first, because cfg.xxx parameters are used by other "_cpp.h" modules
47+
#include "madflight/bbx/bbx_cpp.h"
4948
#include "madflight/ahr/ahr_cpp.h"
5049
#include "madflight/alt/alt_cpp.h"
50+
#include "madflight/cli/cli_cpp.h"
51+
#include "madflight/hal/hal_cpp.h"
5152
#include "madflight/imu/imu_cpp.h"
52-
#include "madflight/rcl/rcl_cpp.h" //needs "cfg_cpp.h" included before this
53+
#include "madflight/rcl/rcl_cpp.h"
5354
#undef MF_ALLOW_INCLUDE_CCP_H
5455

5556
//include all other modules without compile time config options
5657
#include "madflight/bar/bar.h"
5758
#include "madflight/bat/bat.h"
58-
#include "madflight/bbx/bbx.h"
5959
#include "madflight/gps/gps.h"
6060
#include "madflight/led/led.h"
6161
#include "madflight/mag/mag.h"

src/madflight/ahr/ahr.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/*==========================================================================================
2+
MIT License
3+
4+
Copyright (c) 2023-2025 https://madflight.com
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
===========================================================================================*/
24+
125
#pragma once
226

327
class Ahr {

src/madflight/ahr/ahr_cpp.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,35 @@
1+
/*==========================================================================================
2+
MIT License
3+
4+
Copyright (c) 2023-2025 https://madflight.com
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
===========================================================================================*/
24+
125
//This file is kept as header to allow #AHR_xxx defines to be added in user code (Arduino IDE has no easy way to add -D compiler options)
226

27+
// Make sure this file is includes from madflight.h and not from somewhere else
328
#ifndef MF_ALLOW_INCLUDE_CCP_H
429
#error "Only include this file from madflight.h"
530
#endif
31+
//#pragma once //don't use here, we want to get an error if included twice
32+
633

734
#define AHR_USE_MAHONY 1 //default when AHR_USE is not defined
835
#define AHR_USE_MAHONY_BF 2 //betaflight flavored: only use accel if near 1G

src/madflight/alt/alt.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/*==========================================================================================
2+
MIT License
3+
4+
Copyright (c) 2023-2025 https://madflight.com
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
===========================================================================================*/
24+
125
#pragma once
226

327
//=================================================================================================

src/madflight/alt/alt_cpp.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
1+
/*==========================================================================================
2+
MIT License
3+
4+
Copyright (c) 2023-2025 https://madflight.com
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
===========================================================================================*/
24+
125
/*=================================================================================================
226
Each ALT_USE_xxx section in this file defines a specific altimeter estimator class
327
=================================================================================================*/
428

29+
// Make sure this file is includes from madflight.h and not from somewhere else
530
#ifndef MF_ALLOW_INCLUDE_CCP_H
631
#error "Only include this file from madflight.h"
732
#endif
33+
//#pragma once //don't use here, we want to get an error if included twice
834

935
#define ALT_USE_NONE 0
1036
#define ALT_USE_KALMAN2 1 // Kalman filter estimates h and v from barometer and acceleration

src/madflight/bar/bar.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/*==========================================================================================
2+
MIT License
3+
4+
Copyright (c) 2023-2025 https://madflight.com
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
===========================================================================================*/
24+
125
#define MF_MOD "BAR"
226

327
#include <Arduino.h> //Serial

src/madflight/bar/bar.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
/*==========================================================================================
2+
MIT License
3+
4+
Copyright (c) 2023-2025 https://madflight.com
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.
23+
===========================================================================================*/
24+
125
#pragma once
226

327
#include "../hal/MF_I2C.h"

0 commit comments

Comments
 (0)