mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
Don't count crsf errors while eeprom write is in progress
to avoid false errors while writing to flash.
This commit is contained in:
parent
97b934a436
commit
bef70530a8
3 changed files with 14 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -90,3 +90,4 @@ void targetValidateConfiguration(void);
|
|||
bool isSystemConfigured(void);
|
||||
void setRebootRequired(void);
|
||||
bool getRebootRequired(void);
|
||||
bool isEepromWriteInProgress(void);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue