mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 22:05:17 +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:
commit
d259831cca
1 changed files with 12 additions and 2 deletions
|
@ -304,7 +304,14 @@ void init(void)
|
||||||
|
|
||||||
delayMicroseconds(10); // allow configuration to settle // XXX Could be removed, too?
|
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)
|
#if defined(BUTTON_A_PIN) && defined(BUTTON_B_PIN)
|
||||||
// two buttons required
|
// two buttons required
|
||||||
uint8_t secondsRemaining = 5;
|
uint8_t secondsRemaining = 5;
|
||||||
|
@ -322,7 +329,10 @@ void init(void)
|
||||||
} while (bothButtonsHeld);
|
} while (bothButtonsHeld);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#undef EEPROM_RESET_PRECONDITION
|
||||||
|
|
||||||
|
#endif // USE_BUTTONS
|
||||||
|
|
||||||
// Note that spektrumBind checks if a call is immediately after
|
// Note that spektrumBind checks if a call is immediately after
|
||||||
// hard reset (including power cycle), so it should be called before
|
// hard reset (including power cycle), so it should be called before
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue