Fix STM32F1 SD-based EEPROM emulation (#13475)
If `openFile` is given `true`, then it has read-only access. Because all the writing occurs on the next line, this breaks SD card as EEPROM.
This commit is contained in:
parent
aacc1148b0
commit
ef3b93daa1
|
@ -55,7 +55,7 @@ bool PersistentStore::access_start() {
|
||||||
|
|
||||||
bool PersistentStore::access_finish() {
|
bool PersistentStore::access_finish() {
|
||||||
if (!card.isDetected()) return false;
|
if (!card.isDetected()) return false;
|
||||||
card.openFile(eeprom_filename, true);
|
card.openFile(eeprom_filename, false);
|
||||||
int16_t bytes_written = card.write(HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
|
int16_t bytes_written = card.write(HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
|
||||||
card.closefile();
|
card.closefile();
|
||||||
return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
|
return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
|
||||||
|
|
Loading…
Reference in a new issue