1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 06:15:16 +03:00

Allow EEPROM reset without power cycling in DEBUG build

This commit is contained in:
jflyper 2019-05-05 15:10:54 +09:00
parent de1c1d5377
commit 7df2828053

View file

@ -303,7 +303,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;
@ -321,7 +328,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