From 0b056970c6ad1c357c446d6f99a11fb3feadfae5 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 16 May 2019 20:43:20 -0500 Subject: [PATCH] Fix file.open in STM32 eeprom emu --- Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp b/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp index 9c9197bac..5ef638263 100644 --- a/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp +++ b/Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp @@ -64,11 +64,11 @@ static char HAL_STM32F1_eeprom_content[HAL_STM32F1_EEPROM_SIZE]; if (!card.isDetected()) return false; SdFile file, root = card.getroot(); - if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) - return false; - - int16_t bytes_written = file.write(HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE); - file.close(); + int16_t bytes_written = 0; + if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) { + bytes_written = file.write(HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE); + file.close(); + } return (bytes_written == HAL_STM32F1_EEPROM_SIZE); }