mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 17:25:20 +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 rebootRequired = false; // set if a config change requires a reboot to take effect
|
||||||
|
|
||||||
|
static bool eepromWriteInProgress = false;
|
||||||
|
|
||||||
pidProfile_t *currentPidProfile;
|
pidProfile_t *currentPidProfile;
|
||||||
|
|
||||||
#ifndef RX_SPI_DEFAULT_PROTOCOL
|
#ifndef RX_SPI_DEFAULT_PROTOCOL
|
||||||
|
@ -126,6 +128,11 @@ PG_RESET_TEMPLATE(systemConfig_t, systemConfig,
|
||||||
.enableStickArming = false,
|
.enableStickArming = false,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
bool isEepromWriteInProgress(void)
|
||||||
|
{
|
||||||
|
return eepromWriteInProgress;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t getCurrentPidProfileIndex(void)
|
uint8_t getCurrentPidProfileIndex(void)
|
||||||
{
|
{
|
||||||
return systemConfig()->pidProfileIndex;
|
return systemConfig()->pidProfileIndex;
|
||||||
|
@ -738,9 +745,9 @@ void writeUnmodifiedConfigToEEPROM(void)
|
||||||
validateAndFixConfig();
|
validateAndFixConfig();
|
||||||
|
|
||||||
suspendRxSignal();
|
suspendRxSignal();
|
||||||
|
eepromWriteInProgress = true;
|
||||||
writeConfigToEEPROM();
|
writeConfigToEEPROM();
|
||||||
|
eepromWriteInProgress = false;
|
||||||
resumeRxSignal();
|
resumeRxSignal();
|
||||||
configIsDirty = false;
|
configIsDirty = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,3 +90,4 @@ void targetValidateConfiguration(void);
|
||||||
bool isSystemConfigured(void);
|
bool isSystemConfigured(void);
|
||||||
void setRebootRequired(void);
|
void setRebootRequired(void);
|
||||||
bool getRebootRequired(void);
|
bool getRebootRequired(void);
|
||||||
|
bool isEepromWriteInProgress(void);
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
#include "common/maths.h"
|
#include "common/maths.h"
|
||||||
#include "common/utils.h"
|
#include "common/utils.h"
|
||||||
|
|
||||||
|
#include "config/config.h"
|
||||||
|
|
||||||
#include "pg/rx.h"
|
#include "pg/rx.h"
|
||||||
|
|
||||||
#include "drivers/serial.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 defined(USE_CRSF_V3)
|
||||||
if (crsfBaudNegotiationInProgress()) {
|
if (crsfBaudNegotiationInProgress() || isEepromWriteInProgress()) {
|
||||||
// don't count errors when negotiation in progress.
|
// don't count errors when negotiation or eeprom write is in progress
|
||||||
crsfFrameErrorCnt = 0;
|
crsfFrameErrorCnt = 0;
|
||||||
} else if (crsfFrameErrorCnt >= CRSF_FRAME_ERROR_COUNT_THRESHOLD) {
|
} else if (crsfFrameErrorCnt >= CRSF_FRAME_ERROR_COUNT_THRESHOLD) {
|
||||||
// fall back to default speed if speed mismatch detected
|
// fall back to default speed if speed mismatch detected
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue