Skip to content

Commit 19131ed

Browse files
committed
add MF_CONFIG_CLEAR
1 parent e5fe19f commit 19131ed

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

examples/01.Quadcopter/madflight_config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,6 @@ imu_i2c_bus -1
182182

183183
//-- AHRS sensor fusion
184184
#define AHR_USE AHR_USE_MAHONY // Select one: AHRS_USE_MAHONY, AHRS_USE_MAHONY_BF, AHRS_USE_MADGWICK, AHRS_USE_VQF
185+
186+
// Reset config eeprom to defaults (uncomment this, upload, then comment out again)
187+
//#define MF_CONFIG_CLEAR

examples/02.QuadcopterAdvanced/madflight_config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,6 @@ imu_i2c_bus -1
182182

183183
//-- AHRS sensor fusion
184184
#define AHR_USE AHR_USE_MAHONY // Select one: AHRS_USE_MAHONY, AHRS_USE_MAHONY_BF, AHRS_USE_MADGWICK, AHRS_USE_VQF
185+
186+
// Reset config eeprom to defaults (uncomment this, upload, then comment out again)
187+
//#define MF_CONFIG_CLEAR

examples/03.Plane/madflight_config.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,6 @@ imu_i2c_bus -1
182182

183183
//-- AHRS sensor fusion
184184
#define AHR_USE AHR_USE_MAHONY // Select one: AHRS_USE_MAHONY, AHRS_USE_MAHONY_BF, AHRS_USE_MADGWICK, AHRS_USE_VQF
185+
186+
// Reset config eeprom to defaults (uncomment this, upload, then comment out again)
187+
//#define MF_CONFIG_CLEAR

src/madflight.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ void madflight_setup() {
100100
#endif
101101

102102
cfg.begin();
103+
#ifdef MF_CONFIG_CLEAR
104+
cfg.clear();
105+
cfg.writeToEeprom();
106+
madflight_die("Config cleared. comment out '#define MF_CONFIG_CLEAR' and upload again.");
107+
#endif
103108
cfg.loadFromEeprom(); //load parameters from EEPROM
104109
if(madflight_config) {
105110
#ifdef MF_DEBUG

0 commit comments

Comments
 (0)