From c672ffeb5b298b4b8580e24916da2c80b2518ac2 Mon Sep 17 00:00:00 2001 From: Wintermute Date: Tue, 22 Oct 2013 20:03:40 +0200 Subject: [PATCH] =?utf8?q?Fortschrittspeichern=20funktionst=C3=BCchtig.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- badge/jumpnrun/starter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/badge/jumpnrun/starter.c b/badge/jumpnrun/starter.c index 146e85c..4deb635 100644 --- a/badge/jumpnrun/starter.c +++ b/badge/jumpnrun/starter.c @@ -18,6 +18,7 @@ static uint8_t jumpnrun_load_progress(void) { if(FR_OK == f_open(&fd, PROGRESS_FNAME, FA_OPEN_EXISTING | FA_READ)) { UINT bytes; f_read(&fd, &progress, sizeof(progress), &bytes); + f_close(&fd); } return progress; @@ -26,9 +27,10 @@ static uint8_t jumpnrun_load_progress(void) { static void jumpnrun_save_progress(uint8_t progress) { FIL fd; - if(FR_OK == f_open(&fd, PROGRESS_FNAME, FA_CREATE_NEW | FA_WRITE)) { + if(FR_OK == f_open(&fd, PROGRESS_FNAME, FA_CREATE_ALWAYS | FA_WRITE)) { UINT bytes; f_write(&fd, &progress, sizeof(progress), &bytes); + f_close(&fd); } } -- 2.20.1