1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 13:25:30 +03:00

Allow EEPROM reset without power cycling in DEBUG build (#8174)

Allow EEPROM reset without power cycling in DEBUG build
This commit is contained in:
Michael Keller 2019-05-06 19:06:54 +12:00 committed by GitHub
commit d259831cca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -304,7 +304,14 @@ void init(void)
delayMicroseconds(10); // allow configuration to settle // XXX Could be removed, too?
if (!isMPUSoftReset()) {
// Allow EEPROM reset with two-button-press without power cycling in DEBUG build
#ifdef DEBUG
#define EEPROM_RESET_PRECONDITION true
#else
#define EEPROM_RESET_PRECONDITION (!isMPUSoftReset())
#endif
if (EEPROM_RESET_PRECONDITION) {
#if defined(BUTTON_A_PIN) && defined(BUTTON_B_PIN)
// two buttons required
uint8_t secondsRemaining = 5;
@ -322,7 +329,10 @@ void init(void)
} while (bothButtonsHeld);
#endif
}
#endif
#undef EEPROM_RESET_PRECONDITION
#endif // USE_BUTTONS
// Note that spektrumBind checks if a call is immediately after
// hard reset (including power cycle), so it should be called before