From 7df2828053d3a8af4ed67f2262842ba4703104c6 Mon Sep 17 00:00:00 2001 From: jflyper Date: Sun, 5 May 2019 15:10:54 +0900 Subject: [PATCH] Allow EEPROM reset without power cycling in DEBUG build --- src/main/fc/init.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/fc/init.c b/src/main/fc/init.c index f5936e92c7..918c46cba7 100644 --- a/src/main/fc/init.c +++ b/src/main/fc/init.c @@ -303,7 +303,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; @@ -321,7 +328,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