diff --git a/src/main/config/config.c b/src/main/config/config.c index 378a9f6b58..2ec00c1de6 100644 --- a/src/main/config/config.c +++ b/src/main/config/config.c @@ -97,6 +97,8 @@ static bool configIsDirty; /* someone indicated that the config is modified and static bool rebootRequired = false; // set if a config change requires a reboot to take effect +static bool eepromWriteInProgress = false; + pidProfile_t *currentPidProfile; #ifndef RX_SPI_DEFAULT_PROTOCOL @@ -126,6 +128,11 @@ PG_RESET_TEMPLATE(systemConfig_t, systemConfig, .enableStickArming = false, ); +bool isEepromWriteInProgress(void) +{ + return eepromWriteInProgress; +} + uint8_t getCurrentPidProfileIndex(void) { return systemConfig()->pidProfileIndex; @@ -738,9 +745,9 @@ void writeUnmodifiedConfigToEEPROM(void) validateAndFixConfig(); suspendRxSignal(); - + eepromWriteInProgress = true; writeConfigToEEPROM(); - + eepromWriteInProgress = false; resumeRxSignal(); configIsDirty = false; } diff --git a/src/main/config/config.h b/src/main/config/config.h index 4d7fff7ad5..afdcd9bf5a 100644 --- a/src/main/config/config.h +++ b/src/main/config/config.h @@ -90,3 +90,4 @@ void targetValidateConfiguration(void); bool isSystemConfigured(void); void setRebootRequired(void); bool getRebootRequired(void); +bool isEepromWriteInProgress(void); diff --git a/src/main/rx/crsf.c b/src/main/rx/crsf.c index 35169c471d..03a59944a0 100644 --- a/src/main/rx/crsf.c +++ b/src/main/rx/crsf.c @@ -34,6 +34,8 @@ #include "common/maths.h" #include "common/utils.h" +#include "config/config.h" + #include "pg/rx.h" #include "drivers/serial.h" @@ -464,8 +466,8 @@ STATIC_UNIT_TESTED void crsfDataReceive(uint16_t c, void *data) } } #if defined(USE_CRSF_V3) - if (crsfBaudNegotiationInProgress()) { - // don't count errors when negotiation in progress. + if (crsfBaudNegotiationInProgress() || isEepromWriteInProgress()) { + // don't count errors when negotiation or eeprom write is in progress crsfFrameErrorCnt = 0; } else if (crsfFrameErrorCnt >= CRSF_FRAME_ERROR_COUNT_THRESHOLD) { // fall back to default speed if speed mismatch detected