mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 17:25:20 +03:00
Fix false RX loss detection on EEPROM read/write
The problem is caused by hardware counters (timekeeping and PPM/PWM measurement) that keep running while the firmware is frozen. The result is misinterpretation of received data. EEPROM read & write now call a suspend and resume function to make RX ignore incoming wrong data during reads/writes (and flush the wrong data on resume). Fixes issue #1257 (+1 squashed commit) - Moved the check for skipSamples to the right place. As commented by hydra
This commit is contained in:
parent
f7530df974
commit
3a13edfdad
3 changed files with 28 additions and 0 deletions
|
@ -829,6 +829,8 @@ void readEEPROM(void)
|
|||
if (!isEEPROMContentValid())
|
||||
failureMode(10);
|
||||
|
||||
suspendRxSignal();
|
||||
|
||||
// Read flash
|
||||
memcpy(&masterConfig, (char *) CONFIG_START_FLASH_ADDRESS, sizeof(master_t));
|
||||
|
||||
|
@ -844,6 +846,8 @@ void readEEPROM(void)
|
|||
|
||||
validateAndFixConfig();
|
||||
activateConfig();
|
||||
|
||||
resumeRxSignal();
|
||||
}
|
||||
|
||||
void readEEPROMAndNotify(void)
|
||||
|
@ -862,6 +866,8 @@ void writeEEPROM(void)
|
|||
uint32_t wordOffset;
|
||||
int8_t attemptsRemaining = 3;
|
||||
|
||||
suspendRxSignal();
|
||||
|
||||
// prepare checksum/version constants
|
||||
masterConfig.version = EEPROM_CONF_VERSION;
|
||||
masterConfig.size = sizeof(master_t);
|
||||
|
@ -903,6 +909,8 @@ void writeEEPROM(void)
|
|||
if (status != FLASH_COMPLETE || !isEEPROMContentValid()) {
|
||||
failureMode(10);
|
||||
}
|
||||
|
||||
resumeRxSignal();
|
||||
}
|
||||
|
||||
void ensureEEPROMContainsValidData(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue