瀏覽代碼

Fix file.open in STM32 eeprom emu

Scott Lahteine 6 年之前
父節點
當前提交
0b056970c6
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5
    5
      Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp

+ 5
- 5
Marlin/src/HAL/HAL_STM32F1/persistent_store_sdcard.cpp 查看文件

@@ -64,11 +64,11 @@ static char HAL_STM32F1_eeprom_content[HAL_STM32F1_EEPROM_SIZE];
64 64
     if (!card.isDetected()) return false;
65 65
 
66 66
     SdFile file, root = card.getroot();
67
-    if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC))
68
-      return false;
69
-
70
-    int16_t bytes_written = file.write(HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
71
-    file.close();
67
+    int16_t bytes_written = 0;
68
+    if (file.open(&root, EEPROM_FILENAME, O_CREAT | O_WRITE | O_TRUNC)) {
69
+      bytes_written = file.write(HAL_STM32F1_eeprom_content, HAL_STM32F1_EEPROM_SIZE);
70
+      file.close();
71
+    }
72 72
     return (bytes_written == HAL_STM32F1_EEPROM_SIZE);
73 73
   }
74 74
 

Loading…
取消
儲存